| Age | Commit message (Collapse) | Author | Lines |
|
|
|
This ensures all diagnostic messages are created at diagnostic emission
time, making them translatable.
|
|
|
|
Translation of the lint message happens when the actual diagnostic is
created, not when the lint is buffered. Generating the message from
BuiltinLintDiag ensures that all required data to construct the message
is preserved in the LintBuffer, eventually allowing the messages to be
moved to fluent.
Remove the `msg` field from BufferedEarlyLint, it is either generated
from the data in the BuiltinLintDiag or stored inside
BuiltinLintDiag::Normal.
|
|
This commit moves the `#[do_not_recommend]` attribute to the
`#[diagnostic]` namespace. It still requires
`#![feature(do_not_recommend)]` to work.
|
|
fixes #122714
|
|
|
|
`rustc_resolve` cleanups
Some improvements I found while looking through this code.
r? `@estebank`
|
|
|
|
delegation: Implement list delegation
```rust
reuse prefix::{a, b, c};
```
Using design described in https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823 (the lists are desugared at macro expansion time).
List delegations are expanded eagerly when encountered, similarly to `#[cfg]`s, and not enqueued for later resolution/expansion like regular macros or glob delegation (https://github.com/rust-lang/rust/pull/124135).
Part of https://github.com/rust-lang/rust/issues/118212.
|
|
```rust
reuse prefix::{a, b, c}
```
|
|
|
|
Some minor (English only) heroics are performed to print error messages
like "5th rule of macro `m` is never used". The form "rule #5 of macro
`m` is never used" is just as good and much simpler to implement.
|
|
|
|
Explicit imports are more standard nowadays and easier to read.
|
|
The `#[allow(rustdoc:private_intra_doc_links)]` isn't necessary.
Also sort them, as is done in other files like
`compiler/rustc_errors/src/lib.rs`.
|
|
Remove braces when fixing a nested use tree into a single item
[Back in 2019](https://github.com/rust-lang/rust/pull/56645) I added rustfix support for the `unused_imports` lint, to automatically remove them when running `cargo fix`. For the most part this worked great, but when removing all but one childs of a nested use tree it turned `use foo::{Unused, Used}` into `use foo::{Used}`. This is slightly annoying, because it then requires you to run `rustfmt` to get `use foo::Used`.
This PR automatically removes braces and the surrouding whitespace when all but one child of a nested use tree are unused. To get it done I had to add the span of the nested use tree to the AST, and refactor a bit the code I wrote back then.
A thing I noticed is, there doesn't seem to be any `//@ run-rustfix` test for fixing the `unused_imports` lint. I created a test in `tests/suggestions` (is that the right directory?) that for now tests just what I added in the PR. I can followup in a separate PR to add more tests for fixing `unused_lints`.
This PR is best reviewed commit-by-commit.
|
|
Let miri and const eval execute intrinsics' fallback bodies
fixes https://github.com/rust-lang/miri/issues/3397
r? ``@RalfJung``
|
|
Add raw identifier in a typo suggestion
Fixes #68962
|
|
preserve all UB that the native intrinsic would have
|
|
|
|
|
|
Fix the assertion crash from rustdoc document indent widths
Fixes #124363
|
|
|
|
ast: Generalize item kind visiting
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
The diff is better viewed with whitespace ignored.
|
|
`rustc_builtin_macros` cleanups
Some improvements I found while looking over this code.
r? ``@fee1-dead``
|
|
Making this a proper struct, and giving its fields names, makes things
easier to understand.
|
|
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
|
|
Macro calls are ephemeral, they should not add anything to the definition tree, even if their AST could contains something with identity.
Thankfully, macro call AST cannot contain anything like that, so these walks are just noops.
In majority of other places in def_collector / build_reduced_graph they are already not visited.
(Also, a minor match reformatting is included.)
|
|
Also allow `impl Trait` in delegated functions.
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
|
|
Allow nesting subdiagnostics in #[derive(Subdiagnostic)]
|
|
weak lang items are not allowed to be #[track_caller]
For instance the panic handler will be called via this import
```rust
extern "Rust" {
#[lang = "panic_impl"]
fn panic_impl(pi: &PanicInfo<'_>) -> !;
}
```
A `#[track_caller]` would add an extra argument and thus make this the wrong signature.
The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
|
|
This requires nested subdiagnostics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|