diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2024-04-14 17:59:54 +0000 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2024-05-21 20:16:39 +0000 |
| commit | c227f35a9cd7ef894abfb623a16ad28abf8b6e3f (patch) | |
| tree | fe7288d38b63650035965c61d2767e7453e7d882 /compiler/rustc_resolve/src/diagnostics.rs | |
| parent | 2482f3c17cd1fd4c4988b1f4fbf07270cd93c771 (diff) | |
| download | rust-c227f35a9cd7ef894abfb623a16ad28abf8b6e3f.tar.gz rust-c227f35a9cd7ef894abfb623a16ad28abf8b6e3f.zip | |
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.
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index b28312fa473..791d777b3d4 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -128,13 +128,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.report_with_use_injections(krate); for &(span_use, span_def) in &self.macro_expanded_macro_export_errors { - let msg = "macro-expanded `macro_export` macros from the current crate \ - cannot be referred to by absolute paths"; self.lint_buffer.buffer_lint_with_diagnostic( MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS, CRATE_NODE_ID, span_use, - msg, BuiltinLintDiag::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def), ); } @@ -149,7 +146,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { AMBIGUOUS_GLOB_IMPORTS, import.root_id, ambiguity_error.ident.span, - diag.msg.to_string(), BuiltinLintDiag::AmbiguousGlobImports { diag }, ); } else { @@ -530,8 +526,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE, node_id, root_span, - "absolute paths must start with `self`, `super`, \ - `crate`, or an external crate name in the 2018 edition", diag, ); } |
