Generate lint diagnostic message from BuiltinLintDiag
Translation of the lint message happens when the actual diagnostic is created, not when the lint is buffered. Generating the message from BuiltinLintDiag ensures that all required data to construct the message is preserved in the LintBuffer, eventually allowing the messages to be moved to fluent. Remove the `msg` field from BufferedEarlyLint, it is either generated from the data in the BuiltinLintDiag or stored inside BuiltinLintDiag::Normal.
This commit is contained in:
parent
2482f3c17c
commit
c227f35a9c
26 changed files with 212 additions and 130 deletions
|
@ -1370,7 +1370,6 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
|
|||
PROC_MACRO_BACK_COMPAT,
|
||||
item.ident.span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"using an old version of `rental`",
|
||||
BuiltinLintDiag::ProcMacroBackCompat(
|
||||
"older versions of the `rental` crate will stop compiling in future versions of Rust; \
|
||||
please update to `rental` v0.5.6, or switch to one of the `rental` alternatives".to_string()
|
||||
|
|
|
@ -1803,7 +1803,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
|||
UNUSED_DOC_COMMENTS,
|
||||
current_span,
|
||||
self.cx.current_expansion.lint_node_id,
|
||||
"unused doc comment",
|
||||
BuiltinLintDiag::UnusedDocComment(attr.span),
|
||||
);
|
||||
} else if rustc_attr::is_builtin_attr(attr) {
|
||||
|
@ -1815,7 +1814,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
|||
UNUSED_ATTRIBUTES,
|
||||
attr.span,
|
||||
self.cx.current_expansion.lint_node_id,
|
||||
format!("unused attribute `{attr_name}`"),
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute {
|
||||
attr_name,
|
||||
macro_name: pprust::path_to_string(&call.path),
|
||||
|
|
|
@ -83,7 +83,6 @@ impl<'a> ParserAnyMacro<'a> {
|
|||
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
|
||||
parser.token.span,
|
||||
lint_node_id,
|
||||
"trailing semicolon in macro used in expression position",
|
||||
BuiltinLintDiag::TrailingMacro(is_trailing_mac, macro_ident),
|
||||
);
|
||||
}
|
||||
|
@ -1158,7 +1157,6 @@ fn check_matcher_core<'tt>(
|
|||
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||
span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",
|
||||
BuiltinLintDiag::OrPatternsBackCompat(span, suggestion),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue