-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup error handlers: round 4 #119171
Cleanup error handlers: round 4 #119171
Conversation
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt
cc @davidtwco, @compiler-errors, @TaKO8Ki Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_codegen_gcc Some changes occurred in need_type_info.rs cc @lcnr Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
☔ The latest upstream changes (presumably #119097) made this pull request unmergeable. Please resolve the merge conflicts. |
aa1eeef
to
4bea661
Compare
The Miri subtree was changed cc @rust-lang/miri |
Lots of commits, but they're mostly small and all self-contained. |
compiler/rustc_errors/src/lib.rs
Outdated
Bug, | ||
|
||
/// This is a strange one: lets you register an error without emitting it. If compilation ends | ||
/// without any other errors occurring, this will be emitted as an error. Otherwise, it will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be emitted as an error
It will be emitted as a bug, I though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some unclear terminology. Sometimes "error" means Level::Error
and sometimes it means Level::{BugDelayed,Fatal,Error,FailureNote}
, e.g. here.
But even with that in mind, this is a clumsy sentence, I'll fix it up in a minute.
@bors r+ |
4bea661
to
fbfe0e7
Compare
I fixed the comment. @bors r=compiler-errors |
☔ The latest upstream changes (presumably #118824) made this pull request unmergeable. Please resolve the merge conflicts. |
There is room for improvement on some of these, but something is better than nothing.
We can just get the error level in the `match` and then use `DiagnosticBuilder::new`. This then means a number of `DiagCtxt` functions are no longer needed, because this was the one place that used them. Note: the commit changes the treatment of spans for `Expect`, which was different to all the other cases, but this has no apparent effect.
There are a bunch of them about 400 lines down, which is weird and annoying. This commit moves them up and puts them in a more sensible order.
`IntoDiagnostic` defaults to `G = ErrorGuaranteed`. Take advantage of this in one place that currently doesn't.
Its single use can be replaced with `Diagnostic::new_with_messages`.
Lots of vectors of messages called `message` or `msg`. This commit pluralizes them. Note that `emit_message_default` and `emit_messages_default` both already existed, and both process a vector, so I renamed the former `emit_messages_default_inner` because it's called by the latter.
They're always `None`.
It's only ever set to `None`.
It has three variants, but only `LabelKind::Label` is ever used. This means `SingleLabelManySpans::kind` can also be removed.
Some of the `Level::` qualifiers in this file are omitted. This commit removes the remainder.
There are quite a few hand-written `IntoDiagnostic` impls.
There are only three. It's simpler to make the type `DiagnosticBuilder<'_, ()>` from the start, no matter the level, than to change the guarantee later.
It's unused. And this means `DiagnosticBuilderInner` no longer needs to be separate from `DiagnosticBuilder`.
fbfe0e7
to
2cd14bc
Compare
I fixed the conflicts. @bors r=compiler-errors |
…mpiler-errors Rollup of 6 pull requests Successful merges: - rust-lang#119012 (Extract `layout_of_{struct,enum}` fn) - rust-lang#119077 (Separate MIR lints from validation) - rust-lang#119171 (Cleanup error handlers: round 4) - rust-lang#119198 (Split coroutine desugaring kind from source) - rust-lang#119222 (Add `IntoAsyncIterator`) - rust-lang#119230 (Exhaustiveness: clean up after librarification) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119171 - nnethercote:cleanup-errors-4, r=compiler-errors Cleanup error handlers: round 4 More `rustc_errors` cleanups. A sequel to rust-lang#118933. r? `@compiler-errors`
…mpiler-errors Cleanup error handlers: round 4 More `rustc_errors` cleanups. A sequel to rust-lang#118933. r? `@compiler-errors`
…mpiler-errors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang#119171. r? `@compiler-errors`
…mpiler-errors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang#119171. r? ``@compiler-errors``
…mpiler-errors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang#119171. r? ```@compiler-errors```
…mpiler-errors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang#119171. r? ````@compiler-errors````
Rollup merge of rust-lang#119538 - nnethercote:cleanup-errors-5, r=compiler-errors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang#119171. r? ````@compiler-errors````
…rors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang/rust#119171. r? ````@compiler-errors````
…rors Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to rust-lang/rust#119171. r? ````@compiler-errors````
More
rustc_errors
cleanups. A sequel to #118933.r? @compiler-errors