Change how force-warn
lint diagnostics are recorded.
`is_force_warn` is only possible for diagnostics with `Level::Warning`, but it is currently stored in `Diagnostic::code`, which every diagnostic has. This commit: - removes the boolean `DiagnosticId::Lint::is_force_warn` field; - adds a `ForceWarning` variant to `Level`. Benefits: - The common `Level::Warning` case now has no arguments, replacing lots of `Warning(None)` occurrences. - `rustc_session::lint::Level` and `rustc_errors::Level` are more similar, both having `ForceWarning` and `Warning`.
This commit is contained in:
parent
06cf881969
commit
0e388f2192
12 changed files with 45 additions and 53 deletions
|
@ -1847,14 +1847,9 @@ impl SharedEmitterMain {
|
|||
dcx.emit_diagnostic(d);
|
||||
}
|
||||
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
|
||||
let err_level = match level {
|
||||
Level::Error => Level::Error,
|
||||
Level::Warning(_) => Level::Warning(None),
|
||||
Level::Note => Level::Note,
|
||||
_ => bug!("Invalid inline asm diagnostic level"),
|
||||
};
|
||||
assert!(matches!(level, Level::Error | Level::Warning | Level::Note));
|
||||
let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
|
||||
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), err_level, msg);
|
||||
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), level, msg);
|
||||
|
||||
// If the cookie is 0 then we don't have span information.
|
||||
if cookie != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue