-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Commits on Dec 23, 2023
-
There is room for improvement on some of these, but something is better than nothing.
Configuration menu - View commit details
-
Copy full SHA for c8c1615 - Browse repository at this point
Copy the full SHA c8c1615View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for de303b8 - Browse repository at this point
Copy the full SHA de303b8View commit details -
Improve
use
items incompiler/rustc_errors/src/lib.rs
.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.
Configuration menu - View commit details
-
Copy full SHA for 1b36958 - Browse repository at this point
Copy the full SHA 1b36958View commit details -
Configuration menu - View commit details
-
Copy full SHA for aec78dd - Browse repository at this point
Copy the full SHA aec78ddView commit details -
`IntoDiagnostic` defaults to `G = ErrorGuaranteed`. Take advantage of this in one place that currently doesn't.
Configuration menu - View commit details
-
Copy full SHA for 6257f3b - Browse repository at this point
Copy the full SHA 6257f3bView commit details -
Give
DiagnosticBuilder
a default type.`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
Configuration menu - View commit details
-
Copy full SHA for 757d6f6 - Browse repository at this point
Copy the full SHA 757d6f6View commit details -
- Take a `Vec` instead of an iterator, because that's all that is needed. - Do an early return for the "no bugs" case. - Use `enumerate` and an `i == 0` test to identify the first bug. Those changes mean the `no_bug` variable can be removed, which I found hard to read.
Configuration menu - View commit details
-
Copy full SHA for a108a3b - Browse repository at this point
Copy the full SHA a108a3bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f147af - Browse repository at this point
Copy the full SHA 6f147afView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1502596 - Browse repository at this point
Copy the full SHA 1502596View commit details -
Remove
DiagCtxtInner::span_bug
.`DiagCtxt::span_bug` is different to the other `DiagCtxt::span_*` methods. This commit makes it the same, which requires changing `DiagCtxt::span_delayed_bug` to not do everything within the `inner.borrow_mut()`.
Configuration menu - View commit details
-
Copy full SHA for 1f08bfa - Browse repository at this point
Copy the full SHA 1f08bfaView commit details -
Rename
EarlyDiagCtxt
methods to matchDiagCtxt
.- `early_error_no_abort` -> `early_err` - `early_error` -> `early_fatal` - `early_struct_error` -> `early_struct_fatal`
Configuration menu - View commit details
-
Copy full SHA for 3a1b8e6 - Browse repository at this point
Copy the full SHA 3a1b8e6View commit details -
Remove
Diagnostic::new_with_code
.Its single use can be replaced with `Diagnostic::new_with_messages`.
Configuration menu - View commit details
-
Copy full SHA for d7a3b62 - Browse repository at this point
Copy the full SHA d7a3b62View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 824667f - Browse repository at this point
Copy the full SHA 824667fView commit details -
Remove
render_span
args fromDiagnostic::{sub,sub_with_highlight}
.They're always `None`.
Configuration menu - View commit details
-
Copy full SHA for 125337b - Browse repository at this point
Copy the full SHA 125337bView commit details -
Configuration menu - View commit details
-
Copy full SHA for ce0f703 - Browse repository at this point
Copy the full SHA ce0f703View commit details -
It has three variants, but only `LabelKind::Label` is ever used. This means `SingleLabelManySpans::kind` can also be removed.
Configuration menu - View commit details
-
Copy full SHA for 49040d0 - Browse repository at this point
Copy the full SHA 49040d0View commit details -
Take full advantage of a
use Level::*;
.Some of the `Level::` qualifiers in this file are omitted. This commit removes the remainder.
Configuration menu - View commit details
-
Copy full SHA for e0461f9 - Browse repository at this point
Copy the full SHA e0461f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3944301 - Browse repository at this point
Copy the full SHA 3944301View commit details -
Configuration menu - View commit details
-
Copy full SHA for 81f50fd - Browse repository at this point
Copy the full SHA 81f50fdView commit details -
There are quite a few hand-written `IntoDiagnostic` impls.
Configuration menu - View commit details
-
Copy full SHA for 3db58e6 - Browse repository at this point
Copy the full SHA 3db58e6View commit details -
Remove all uses of
DiagnosticBuilder::forget_guarantee()
.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.
Configuration menu - View commit details
-
Copy full SHA for 00e8485 - Browse repository at this point
Copy the full SHA 00e8485View commit details -
Remove
DiagnosticBuilder::forget_guarantee
.It's unused. And this means `DiagnosticBuilderInner` no longer needs to be separate from `DiagnosticBuilder`.
Configuration menu - View commit details
-
Copy full SHA for 2cd14bc - Browse repository at this point
Copy the full SHA 2cd14bcView commit details