FIX - ambiguous Diagnostic link in docs
UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic
[Gardening] FIX - formatting via `x fmt`
FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way
DELETE - unneeded allow attributes in Handler method
FIX - broken test
FIX - Rebase conflict
UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
On later stages, the feature is already stable.
Result of running:
rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
Further simplify the macros generated by `rustc_queries`
This doesn't actually move anything outside the macros, but it makes them simpler to read.
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
(despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
r? `@cjgillot`
We want to refer to `crate::plumbing::try_load_from_disk` in the const, but hard-coding it in
rustc_queries, where we don't yet know the crate this macro will be called in, seems kind of hacky.
Do it in query_impl instead.
In practice, it was only ever used with `ArenaCacheSelector`. Change it to a single boolean
`arena_cache` rather than allowing queries to specify an arbitrary type.
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
(despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler
Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
This reimplements ac638c1, which had to be reverted in the previous
commit because it contains a rebase accident that itself reverted
significant unrelated changes to SessionSubdiagnostic.
This reverts parts of commit ac638c1f5f.
During rebase, this commit accidentally reverted unrelated changes to
the subdiagnostic derive (those allowing multipart_suggestions to be
derived). This commit reverts all changes to the subdiagnostic code made
in ac638c1f5f, the next commit will reintroduce the actually intended
changes.
translations: rename warn_ to warning
## Description
This MR renames the the macro `warn_` to `warning`.
To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by ```````@davidtwco``````` in the Zulip channel, `warn_` was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also
taken.
However, it is no longer the case and we can rename `warn_` to `warning`.
Simplify the arguments to macros generated by the `rustc_queries` proc macro
Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code.
r? `@cjgillot`
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of`
Fixes#49735
Updates #48685
The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`.
We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
The macro warn_ was named like that because it the
keyword warn is a built-in attribute and at the time
this macro was created the word 'warning' was also
taken.
However it is no longer the case and we can rename
warn_ to warning.
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used.
- Remove the `[]` brackets around the macro name
- Require an `ident`, not an arbitrary `tt`
fluent: mandate slug names to be prefixed by crate name
This is currently only convention, but not actively checked for.
Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.
This will conflict with #100671, so I'll leave it as draft until that's merged.
Example error before:
error: name `generic_does_not_live_long_enough` does not start with the crate name
--> compiler/rustc_error_messages/src/lib.rs:33:17
|
33 | borrowck => "../locales/en-US/borrowck.ftl",
| ^^^^^^^^
|
= help: prepend `borrowck_` to the slug name: `borrowck_generic_does_not_live_long_enough`
after:
error: name `generic_does_not_live_long_enough` does not start with the crate name
--> compiler/rustc_error_messages/src/lib.rs:33:17
|
33 | borrowck => "../locales/en-US/borrowck.ftl",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: prepend `borrowck_` to the slug name: `borrowck_generic_does_not_live_long_enough`