diff options
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_attr/src/builtin.rs | 2 | ||||
-rw-r--r-- | compiler/rustc_attr/src/lib.rs | 5 | ||||
-rw-r--r-- | compiler/rustc_attr/src/session_diagnostics.rs | 19 |
3 files changed, 16 insertions, 10 deletions
diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index 40531c1c1..3d240108b 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -731,7 +731,7 @@ pub fn eval_condition( sess, sym::cfg_target_compact, cfg.span, - &"compact `cfg(target(..))` is experimental and subject to change" + "compact `cfg(target(..))` is experimental and subject to change" ).emit(); } diff --git a/compiler/rustc_attr/src/lib.rs b/compiler/rustc_attr/src/lib.rs index 4580ffcc6..5fede0a58 100644 --- a/compiler/rustc_attr/src/lib.rs +++ b/compiler/rustc_attr/src/lib.rs @@ -11,6 +11,9 @@ #[macro_use] extern crate rustc_macros; +use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; +use rustc_macros::fluent_messages; + mod builtin; mod session_diagnostics; @@ -22,3 +25,5 @@ pub use StabilityLevel::*; pub use rustc_ast::attr::*; pub(crate) use rustc_ast::HashStableContext; + +fluent_messages! { "../locales/en-US.ftl" } diff --git a/compiler/rustc_attr/src/session_diagnostics.rs b/compiler/rustc_attr/src/session_diagnostics.rs index 3ba7a3c53..ee79545e3 100644 --- a/compiler/rustc_attr/src/session_diagnostics.rs +++ b/compiler/rustc_attr/src/session_diagnostics.rs @@ -2,11 +2,12 @@ use std::num::IntErrorKind; use rustc_ast as ast; use rustc_errors::{ - error_code, fluent, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, + error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, }; use rustc_macros::Diagnostic; use rustc_span::{Span, Symbol}; +use crate::fluent_generated as fluent; use crate::UnsupportedLiteralReason; #[derive(Diagnostic)] @@ -59,7 +60,7 @@ impl<'a> IntoDiagnostic<'a> for UnknownMetaItem<'_> { ); diag.set_arg("item", self.item); diag.set_arg("expected", expected.join(", ")); - diag.span_label(self.span, fluent::label); + diag.span_label(self.span, fluent::attr_label); diag } } @@ -99,31 +100,31 @@ pub(crate) struct InvalidIssueString { // translatable. #[derive(Subdiagnostic)] pub(crate) enum InvalidIssueStringCause { - #[label(must_not_be_zero)] + #[label(attr_must_not_be_zero)] MustNotBeZero { #[primary_span] span: Span, }, - #[label(empty)] + #[label(attr_empty)] Empty { #[primary_span] span: Span, }, - #[label(invalid_digit)] + #[label(attr_invalid_digit)] InvalidDigit { #[primary_span] span: Span, }, - #[label(pos_overflow)] + #[label(attr_pos_overflow)] PosOverflow { #[primary_span] span: Span, }, - #[label(neg_overflow)] + #[label(attr_neg_overflow)] NegOverflow { #[primary_span] span: Span, @@ -275,7 +276,7 @@ pub(crate) struct IncorrectReprFormatGeneric<'a> { #[derive(Subdiagnostic)] pub(crate) enum IncorrectReprFormatGenericCause<'a> { - #[suggestion(suggestion, code = "{name}({int})", applicability = "machine-applicable")] + #[suggestion(attr_suggestion, code = "{name}({int})", applicability = "machine-applicable")] Int { #[primary_span] span: Span, @@ -287,7 +288,7 @@ pub(crate) enum IncorrectReprFormatGenericCause<'a> { int: u128, }, - #[suggestion(suggestion, code = "{name}({symbol})", applicability = "machine-applicable")] + #[suggestion(attr_suggestion, code = "{name}({symbol})", applicability = "machine-applicable")] Symbol { #[primary_span] span: Span, |