Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errors
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use - Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing. - Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic. - Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc. cc #100717
This commit is contained in:
commit
e11511dfa6
17 changed files with 286 additions and 238 deletions
|
@ -88,34 +88,13 @@ pub struct BuiltinEllpisisInclusiveRangePatterns {
|
|||
pub replace: String,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(lint::requested_level)]
|
||||
pub struct RequestedLevel {
|
||||
pub level: Level,
|
||||
pub lint_name: String,
|
||||
}
|
||||
|
||||
impl AddToDiagnostic for RequestedLevel {
|
||||
fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F)
|
||||
where
|
||||
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
|
||||
{
|
||||
diag.note(fluent::lint::requested_level);
|
||||
diag.set_arg(
|
||||
"level",
|
||||
match self.level {
|
||||
Level::Allow => "-A",
|
||||
Level::Warn => "-W",
|
||||
Level::ForceWarn(_) => "--force-warn",
|
||||
Level::Deny => "-D",
|
||||
Level::Forbid => "-F",
|
||||
Level::Expect(_) => {
|
||||
unreachable!("lints with the level of `expect` should not run this code");
|
||||
}
|
||||
},
|
||||
);
|
||||
diag.set_arg("lint_name", self.lint_name);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint::unsupported_group, code = "E0602")]
|
||||
pub struct UnsupportedGroup {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue