diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2022-08-17 12:12:59 +0200 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2022-08-22 08:42:46 +0200 |
| commit | 28b29db8f02302997ff161cd97af766fa601aab1 (patch) | |
| tree | 5f0ff35270fa2493a008074b529a29cf1ca2bb0a /compiler/rustc_macros/src/diagnostics/fluent.rs | |
| parent | c9b1a5874d06ca6c437ca8cca2224d546e8669ec (diff) | |
| download | rust-28b29db8f02302997ff161cd97af766fa601aab1.tar.gz rust-28b29db8f02302997ff161cd97af766fa601aab1.zip | |
fluent: point to path containing error instead of module name
Example error before: error: name `generic_does_not_live_long_enough` does not start with the crate name --> compiler/rustc_error_messages/src/lib.rs:33:17 | 33 | borrowck => "../locales/en-US/borrowck.ftl", | ^^^^^^^^ | = help: prepend `borrowck_` to the slug name: `borrowck_generic_does_not_live_long_enough` after: error: name `generic_does_not_live_long_enough` does not start with the crate name --> compiler/rustc_error_messages/src/lib.rs:33:17 | 33 | borrowck => "../locales/en-US/borrowck.ftl", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: prepend `borrowck_` to the slug name: `borrowck_generic_does_not_live_long_enough`
Diffstat (limited to 'compiler/rustc_macros/src/diagnostics/fluent.rs')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/fluent.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/fluent.rs b/compiler/rustc_macros/src/diagnostics/fluent.rs index a222b9d5f12..f7d8b494ee2 100644 --- a/compiler/rustc_macros/src/diagnostics/fluent.rs +++ b/compiler/rustc_macros/src/diagnostics/fluent.rs @@ -187,11 +187,11 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok for entry in resource.entries() { let span = res.ident.span(); if let Entry::Message(Message { id: Identifier { name }, attributes, .. }) = entry { - let _ = previous_defns.entry(name.to_string()).or_insert(ident_span); + let _ = previous_defns.entry(name.to_string()).or_insert(path_span); if name.contains('-') { Diagnostic::spanned( - ident_span, + path_span, Level::Error, format!("name `{name}` contains a '-' character"), ) @@ -212,7 +212,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok Some(rest) => Ident::new(rest, span), None => { Diagnostic::spanned( - ident_span, + path_span, Level::Error, format!("name `{name}` does not start with the crate name"), ) @@ -238,7 +238,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok if attr_name.contains('-') { Diagnostic::spanned( - ident_span, + path_span, Level::Error, format!("attribute `{attr_name}` contains a '-' character"), ) @@ -261,7 +261,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok match e { FluentError::Overriding { kind, id } => { Diagnostic::spanned( - ident_span, + path_span, Level::Error, format!("overrides existing {}: `{}`", kind, id), ) |
