Remove EarlyDiagCtxt::early_{note,help} - #162671
Merged
rust-bors[bot] merged 3 commits intoSep 13, 2026
Merged
Conversation
A command like `rustc -optimize a.rs` currently gives this: ``` warning: option `-o` has no space between flag name and value, which can be confusing note: output filename `-o ptimize` is applied instead of a flag named `optimize` help: insert a space between `-o` and `ptimize` if this is intentional: `-o ptimize` ``` A top-level warning, then a top-level note, then a top-level help. Weird! This commit converts the note and the help into children of the warning, which looks better and matches how things are normally done, giving this: ``` warning: option `-o` has no space between flag name and value, which can be confusing | = note: output filename `-o ptimize` is applied instead of a flag named `optimize` = help: insert a space between `-o` and `ptimize` if this is intentional: `-o ptimize` ``` Much better.
Currently the command `rustc -Zunstable-options -j3 --jobs-backend=1 a.rs`, when run on stable rustc, gives this: ``` error: the option `Z` is only accepted on the nightly compiler error: the option `jobs` is only accepted on the nightly compiler error: the option `jobs-backend` is only accepted on the nightly compiler help: consider switching to a nightly toolchain: `rustup default nightly` note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html> note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features> error: 3 nightly options were parsed ``` The errors are fine, but top-level help and notes are weird. This commit changes it to this, which is more normal: ``` error: the option `Z` is only accepted on the nightly compiler error: the option `jobs` is only accepted on the nightly compiler error: the option `jobs-backend` is only accepted on the nightly compiler error: 3 nightly options were parsed | = help: consider switching to a nightly toolchain: `rustup default nightly` = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html> = note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features> ``` It's a slightly different order but that seems fine. The commit also makes two other small improvements: - An unnecessary `match opt.stability` is removed. (There's another `opt.stability` check a few lines above.) - It fixes "1 nightly option were parsed" to "1 nightly option was parsed".
They're now unused.
Contributor
|
@bors r+ @nnethercote would you like to take the lead on landing #151345? It is morally the same thing you're doing on this PR (merging multiple linker errors/notes into one per mistake instead of loose unrelated messages). I think things have already diverged enough that it's not a plain rebase, but the hard part is still just coming up with the tests for them. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have some top-level
helpandnotediagnostics emittable at startup. These are weird. This PR eliminates them. Details in individual commits.r? @estebank