diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-29 11:58:51 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-05 12:14:49 +1100 |
| commit | 18715c98c67235274843974c928a70e84946398b (patch) | |
| tree | b7b610fd528d57a6efcbc78c734e89f1f236f8ec /compiler/rustc_errors/src | |
| parent | d849f5c2259ae6b5d2c11e42ff4b78f303a9d909 (diff) | |
| download | rust-18715c98c67235274843974c928a70e84946398b.tar.gz rust-18715c98c67235274843974c928a70e84946398b.zip | |
Rename `DiagnosticMessage` as `DiagMessage`.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 28 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 20 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 68 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/tests.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/translation.rs | 14 |
6 files changed, 75 insertions, 77 deletions
diff --git a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs index e6668769b95..b71b93cc67c 100644 --- a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs +++ b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs @@ -9,8 +9,8 @@ use crate::emitter::FileWithAnnotatedLines; use crate::snippet::Line; use crate::translation::{to_fluent_args, Translate}; use crate::{ - CodeSuggestion, DiagInner, DiagnosticMessage, Emitter, ErrCode, FluentBundle, - LazyFallbackBundle, Level, MultiSpan, Style, Subdiag, + CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, FluentBundle, LazyFallbackBundle, + Level, MultiSpan, Style, Subdiag, }; use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation}; use rustc_data_structures::sync::Lrc; @@ -125,7 +125,7 @@ impl AnnotateSnippetEmitter { fn emit_messages_default( &mut self, level: &Level, - messages: &[(DiagnosticMessage, Style)], + messages: &[(DiagMessage, Style)], args: &FluentArgs<'_>, code: &Option<ErrCode>, msp: &MultiSpan, diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 1c820bfd01f..eb3fdd0b01b 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -1,7 +1,7 @@ use crate::snippet::Style; use crate::{ - CodeSuggestion, DiagCtxt, DiagnosticMessage, ErrCode, ErrorGuaranteed, ExplicitBug, Level, - MultiSpan, StashKey, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle, + CodeSuggestion, DiagCtxt, DiagMessage, ErrCode, ErrorGuaranteed, ExplicitBug, Level, MultiSpan, + StashKey, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle, }; use rustc_data_structures::fx::FxIndexMap; use rustc_error_messages::fluent_value_from_str_list_sep_by_and; @@ -199,7 +199,7 @@ pub trait DecorateLint<'a, G: EmissionGuarantee> { /// Decorate and emit a lint. fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, G>); - fn msg(&self) -> DiagnosticMessage; + fn msg(&self) -> DiagMessage; } #[derive(Clone, Debug, Encodable, Decodable)] @@ -291,7 +291,7 @@ pub struct DiagInner { // outside of what methods in this crate themselves allow. pub(crate) level: Level, - pub messages: Vec<(DiagnosticMessage, Style)>, + pub messages: Vec<(DiagMessage, Style)>, pub code: Option<ErrCode>, pub span: MultiSpan, pub children: Vec<Subdiag>, @@ -312,12 +312,12 @@ pub struct DiagInner { impl DiagInner { #[track_caller] - pub fn new<M: Into<DiagnosticMessage>>(level: Level, message: M) -> Self { + pub fn new<M: Into<DiagMessage>>(level: Level, message: M) -> Self { DiagInner::new_with_messages(level, vec![(message.into(), Style::NoStyle)]) } #[track_caller] - pub fn new_with_messages(level: Level, messages: Vec<(DiagnosticMessage, Style)>) -> Self { + pub fn new_with_messages(level: Level, messages: Vec<(DiagMessage, Style)>) -> Self { DiagInner { level, messages, @@ -397,7 +397,7 @@ impl DiagInner { pub(crate) fn subdiagnostic_message_to_diagnostic_message( &self, attr: impl Into<SubdiagnosticMessage>, - ) -> DiagnosticMessage { + ) -> DiagMessage { let msg = self.messages.iter().map(|(msg, _)| msg).next().expect("diagnostic with no messages"); msg.with_subdiagnostic_message(attr.into()) @@ -429,7 +429,7 @@ impl DiagInner { &self, ) -> ( &Level, - &[(DiagnosticMessage, Style)], + &[(DiagMessage, Style)], &Option<ErrCode>, &MultiSpan, &[Subdiag], @@ -472,7 +472,7 @@ impl PartialEq for DiagInner { #[derive(Clone, Debug, PartialEq, Hash, Encodable, Decodable)] pub struct Subdiag { pub level: Level, - pub messages: Vec<(DiagnosticMessage, Style)>, + pub messages: Vec<(DiagMessage, Style)>, pub span: MultiSpan, } @@ -578,7 +578,7 @@ macro_rules! with_fn { impl<'a, G: EmissionGuarantee> Diag<'a, G> { #[rustc_lint_diagnostics] #[track_caller] - pub fn new<M: Into<DiagnosticMessage>>(dcx: &'a DiagCtxt, level: Level, message: M) -> Self { + pub fn new<M: Into<DiagMessage>>(dcx: &'a DiagCtxt, level: Level, message: M) -> Self { Self::new_diagnostic(dcx, DiagInner::new(level, message)) } @@ -1203,7 +1203,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { with_fn! { with_primary_message, /// Add a primary message. - pub fn primary_message(&mut self, msg: impl Into<DiagnosticMessage>) -> &mut Self { + pub fn primary_message(&mut self, msg: impl Into<DiagMessage>) -> &mut Self { self.messages[0] = (msg.into(), Style::NoStyle); self } } @@ -1219,13 +1219,13 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { self } } - /// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by + /// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagMessage` by /// combining it with the primary message of the diagnostic (if translatable, otherwise it just /// passes the user's string along). pub(crate) fn subdiagnostic_message_to_diagnostic_message( &self, attr: impl Into<SubdiagnosticMessage>, - ) -> DiagnosticMessage { + ) -> DiagMessage { self.deref().subdiagnostic_message_to_diagnostic_message(attr) } @@ -1338,7 +1338,7 @@ impl<G: EmissionGuarantee> Drop for Diag<'_, G> { Some(diag) if !panicking() => { self.dcx.emit_diagnostic(DiagInner::new( Level::Bug, - DiagnosticMessage::from("the following error was constructed but not emitted"), + DiagMessage::from("the following error was constructed but not emitted"), )); self.dcx.emit_diagnostic(*diag); panic!("error was constructed but not emitted"); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 5637c05d04c..293d8f01e67 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -17,7 +17,7 @@ use crate::snippet::{ use crate::styled_buffer::StyledBuffer; use crate::translation::{to_fluent_args, Translate}; use crate::{ - diagnostic::DiagLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagnosticMessage, ErrCode, + diagnostic::DiagLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagMessage, ErrCode, FluentBundle, LazyFallbackBundle, Level, MultiSpan, Subdiag, SubstitutionHighlight, SuggestionStyle, TerminalUrl, }; @@ -339,7 +339,7 @@ pub trait Emitter: Translate { children.push(Subdiag { level: Level::Note, - messages: vec![(DiagnosticMessage::from(msg), Style::NoStyle)], + messages: vec![(DiagMessage::from(msg), Style::NoStyle)], span: MultiSpan::new(), }); } @@ -543,12 +543,10 @@ pub struct SilentEmitter { pub fatal_note: String, } -pub fn silent_translate<'a>( - message: &'a DiagnosticMessage, -) -> Result<Cow<'_, str>, TranslateError<'_>> { +pub fn silent_translate<'a>(message: &'a DiagMessage) -> Result<Cow<'_, str>, TranslateError<'_>> { match message { - DiagnosticMessage::Str(msg) | DiagnosticMessage::Translated(msg) => Ok(Cow::Borrowed(msg)), - DiagnosticMessage::FluentIdentifier(identifier, _) => { + DiagMessage::Str(msg) | DiagMessage::Translated(msg) => Ok(Cow::Borrowed(msg)), + DiagMessage::FluentIdentifier(identifier, _) => { // Any value works here. Ok(identifier.clone()) } @@ -568,7 +566,7 @@ impl Translate for SilentEmitter { // subdiagnostics result in a call to this. fn translate_message<'a>( &'a self, - message: &'a DiagnosticMessage, + message: &'a DiagMessage, _: &'a FluentArgs<'_>, ) -> Result<Cow<'_, str>, TranslateError<'_>> { silent_translate(message) @@ -1216,7 +1214,7 @@ impl HumanEmitter { fn msgs_to_buffer( &self, buffer: &mut StyledBuffer, - msgs: &[(DiagnosticMessage, Style)], + msgs: &[(DiagMessage, Style)], args: &FluentArgs<'_>, padding: usize, label: &str, @@ -1291,7 +1289,7 @@ impl HumanEmitter { fn emit_messages_default_inner( &mut self, msp: &MultiSpan, - msgs: &[(DiagnosticMessage, Style)], + msgs: &[(DiagMessage, Style)], args: &FluentArgs<'_>, code: &Option<ErrCode>, level: &Level, @@ -2060,7 +2058,7 @@ impl HumanEmitter { fn emit_messages_default( &mut self, level: &Level, - messages: &[(DiagnosticMessage, Style)], + messages: &[(DiagMessage, Style)], args: &FluentArgs<'_>, code: &Option<ErrCode>, span: &MultiSpan, diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6b1ccbc5f7c..504a2dfbd6f 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -47,8 +47,8 @@ pub use diagnostic_impls::{ }; pub use emitter::ColorConfig; pub use rustc_error_messages::{ - fallback_fluent_bundle, fluent_bundle, DelayDm, DiagnosticMessage, FluentBundle, - LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagnosticMessage, + fallback_fluent_bundle, fluent_bundle, DelayDm, DiagMessage, FluentBundle, LanguageIdentifier, + LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagnosticMessage, }; pub use rustc_lint_defs::{pluralize, Applicability}; pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker}; @@ -154,7 +154,7 @@ pub struct CodeSuggestion { /// ] /// ``` pub substitutions: Vec<Substitution>, - pub msg: DiagnosticMessage, + pub msg: DiagMessage, /// Visual representation of this suggestion. pub style: SuggestionStyle, /// Whether or not the suggestion is approximate @@ -634,7 +634,7 @@ impl DiagCtxt { /// Translate `message` eagerly with `args` to `SubdiagnosticMessage::Eager`. pub fn eagerly_translate<'a>( &self, - message: DiagnosticMessage, + message: DiagMessage, args: impl Iterator<Item = DiagArg<'a>>, ) -> SubdiagnosticMessage { let inner = self.inner.borrow(); @@ -644,7 +644,7 @@ impl DiagCtxt { /// Translate `message` eagerly with `args` to `String`. pub fn eagerly_translate_to_string<'a>( &self, - message: DiagnosticMessage, + message: DiagMessage, args: impl Iterator<Item = DiagArg<'a>>, ) -> String { let inner = self.inner.borrow(); @@ -904,7 +904,7 @@ impl DiagCtxt { // configuration like `--cap-lints allow --force-warn bare_trait_objects`. inner.emit_diagnostic(DiagInner::new( ForceWarning(None), - DiagnosticMessage::Str(warnings), + DiagMessage::Str(warnings), )); } (_, 0) => { @@ -1078,13 +1078,13 @@ impl DiagCtxt { impl DiagCtxt { // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing. #[track_caller] - pub fn struct_bug(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, BugAbort> { + pub fn struct_bug(&self, msg: impl Into<DiagMessage>) -> Diag<'_, BugAbort> { Diag::new(self, Bug, msg) } // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing. #[track_caller] - pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! { + pub fn bug(&self, msg: impl Into<DiagMessage>) -> ! { self.struct_bug(msg).emit() } @@ -1093,14 +1093,14 @@ impl DiagCtxt { pub fn struct_span_bug( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> Diag<'_, BugAbort> { self.struct_bug(msg).with_span(span) } // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing. #[track_caller] - pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! { + pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) -> ! { self.struct_span_bug(span, msg).emit() } @@ -1116,13 +1116,13 @@ impl DiagCtxt { #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_fatal(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, FatalAbort> { + pub fn struct_fatal(&self, msg: impl Into<DiagMessage>) -> Diag<'_, FatalAbort> { Diag::new(self, Fatal, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! { + pub fn fatal(&self, msg: impl Into<DiagMessage>) -> ! { self.struct_fatal(msg).emit() } @@ -1131,14 +1131,14 @@ impl DiagCtxt { pub fn struct_span_fatal( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> Diag<'_, FatalAbort> { self.struct_fatal(msg).with_span(span) } #[rustc_lint_diagnostics] #[track_caller] - pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! { + pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) -> ! { self.struct_span_fatal(span, msg).emit() } @@ -1174,13 +1174,13 @@ impl DiagCtxt { // FIXME: This method should be removed (every error should have an associated error code). #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_> { + pub fn struct_err(&self, msg: impl Into<DiagMessage>) -> Diag<'_> { Diag::new(self, Error, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed { + pub fn err(&self, msg: impl Into<DiagMessage>) -> ErrorGuaranteed { self.struct_err(msg).emit() } @@ -1189,7 +1189,7 @@ impl DiagCtxt { pub fn struct_span_err( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> Diag<'_> { self.struct_err(msg).with_span(span) } @@ -1199,7 +1199,7 @@ impl DiagCtxt { pub fn span_err( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> ErrorGuaranteed { self.struct_span_err(span, msg).emit() } @@ -1217,7 +1217,7 @@ impl DiagCtxt { /// Ensures that an error is printed. See `Level::DelayedBug`. // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing. #[track_caller] - pub fn delayed_bug(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed { + pub fn delayed_bug(&self, msg: impl Into<DiagMessage>) -> ErrorGuaranteed { Diag::<ErrorGuaranteed>::new(self, DelayedBug, msg).emit() } @@ -1230,20 +1230,20 @@ impl DiagCtxt { pub fn span_delayed_bug( &self, sp: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> ErrorGuaranteed { Diag::<ErrorGuaranteed>::new(self, DelayedBug, msg).with_span(sp).emit() } #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, ()> { + pub fn struct_warn(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> { Diag::new(self, Warning, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn warn(&self, msg: impl Into<DiagnosticMessage>) { + pub fn warn(&self, msg: impl Into<DiagMessage>) { self.struct_warn(msg).emit() } @@ -1252,14 +1252,14 @@ impl DiagCtxt { pub fn struct_span_warn( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> Diag<'_, ()> { self.struct_warn(msg).with_span(span) } #[rustc_lint_diagnostics] #[track_caller] - pub fn span_warn(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) { + pub fn span_warn(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) { self.struct_span_warn(span, msg).emit() } @@ -1275,13 +1275,13 @@ impl DiagCtxt { #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_note(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, ()> { + pub fn struct_note(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> { Diag::new(self, Note, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn note(&self, msg: impl Into<DiagnosticMessage>) { + pub fn note(&self, msg: impl Into<DiagMessage>) { self.struct_note(msg).emit() } @@ -1290,14 +1290,14 @@ impl DiagCtxt { pub fn struct_span_note( &self, span: impl Into<MultiSpan>, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, ) -> Diag<'_, ()> { self.struct_note(msg).with_span(span) } #[rustc_lint_diagnostics] #[track_caller] - pub fn span_note(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) { + pub fn span_note(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) { self.struct_span_note(span, msg).emit() } @@ -1313,19 +1313,19 @@ impl DiagCtxt { #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_help(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, ()> { + pub fn struct_help(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> { Diag::new(self, Help, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_failure_note(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, ()> { + pub fn struct_failure_note(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> { Diag::new(self, FailureNote, msg) } #[rustc_lint_diagnostics] #[track_caller] - pub fn struct_allow(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_, ()> { + pub fn struct_allow(&self, msg: impl Into<DiagMessage>) -> Diag<'_, ()> { Diag::new(self, Allow, msg) } @@ -1333,7 +1333,7 @@ impl DiagCtxt { #[track_caller] pub fn struct_expect( &self, - msg: impl Into<DiagnosticMessage>, + msg: impl Into<DiagMessage>, id: LintExpectationId, ) -> Diag<'_, ()> { Diag::new(self, Expect(id), msg) @@ -1556,7 +1556,7 @@ impl DiagCtxtInner { /// Translate `message` eagerly with `args` to `SubdiagnosticMessage::Eager`. pub fn eagerly_translate<'a>( &self, - message: DiagnosticMessage, + message: DiagMessage, args: impl Iterator<Item = DiagArg<'a>>, ) -> SubdiagnosticMessage { SubdiagnosticMessage::Translated(Cow::from(self.eagerly_translate_to_string(message, args))) @@ -1565,7 +1565,7 @@ impl DiagCtxtInner { /// Translate `message` eagerly with `args` to `String`. pub fn eagerly_translate_to_string<'a>( &self, - message: DiagnosticMessage, + message: DiagMessage, args: impl Iterator<Item = DiagArg<'a>>, ) -> String { let args = crate::translation::to_fluent_args(args); diff --git a/compiler/rustc_errors/src/tests.rs b/compiler/rustc_errors/src/tests.rs index 79a2af7f38f..50d58aec36a 100644 --- a/compiler/rustc_errors/src/tests.rs +++ b/compiler/rustc_errors/src/tests.rs @@ -5,7 +5,7 @@ use crate::FluentBundle; use rustc_data_structures::sync::{IntoDynSyncSend, Lrc}; use rustc_error_messages::fluent_bundle::resolver::errors::{ReferenceKind, ResolverError}; use rustc_error_messages::langid; -use rustc_error_messages::DiagnosticMessage; +use rustc_error_messages::DiagMessage; struct Dummy { bundle: FluentBundle, @@ -53,7 +53,7 @@ fn wellformed_fluent() { args.set("name", "Foo"); args.set("ty", "std::string::String"); { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("suggestion".into()), ); @@ -65,7 +65,7 @@ fn wellformed_fluent() { } { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("value_borrowed_label".into()), ); @@ -77,7 +77,7 @@ fn wellformed_fluent() { } { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("occurs_because_label".into()), ); @@ -88,7 +88,7 @@ fn wellformed_fluent() { ); { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("label".into()), ); @@ -112,7 +112,7 @@ fn misformed_fluent() { args.set("name", "Foo"); args.set("ty", "std::string::String"); { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("value_borrowed_label".into()), ); @@ -141,7 +141,7 @@ fn misformed_fluent() { } { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("label".into()), ); @@ -168,7 +168,7 @@ fn misformed_fluent() { } { - let message = DiagnosticMessage::FluentIdentifier( + let message = DiagMessage::FluentIdentifier( "mir_build_borrow_of_moved_value".into(), Some("occurs_because_label".into()), ); diff --git a/compiler/rustc_errors/src/translation.rs b/compiler/rustc_errors/src/translation.rs index 1f98ba4c3b9..bf0026568ce 100644 --- a/compiler/rustc_errors/src/translation.rs +++ b/compiler/rustc_errors/src/translation.rs @@ -1,6 +1,6 @@ use crate::error::{TranslateError, TranslateErrorKind}; use crate::snippet::Style; -use crate::{DiagArg, DiagnosticMessage, FluentBundle}; +use crate::{DiagArg, DiagMessage, FluentBundle}; use rustc_data_structures::sync::Lrc; pub use rustc_error_messages::FluentArgs; use std::borrow::Cow; @@ -37,10 +37,10 @@ pub trait Translate { /// unavailable for the requested locale. fn fallback_fluent_bundle(&self) -> &FluentBundle; - /// Convert `DiagnosticMessage`s to a string, performing translation if necessary. + /// Convert `DiagMessage`s to a string, performing translation if necessary. fn translate_messages( &self, - messages: &[(DiagnosticMessage, Style)], + messages: &[(DiagMessage, Style)], args: &FluentArgs<'_>, ) -> Cow<'_, str> { Cow::Owned( @@ -51,18 +51,18 @@ pub trait Translate { ) } - /// Convert a `DiagnosticMessage` to a string, performing translation if necessary. + /// Convert a `DiagMessage` to a string, performing translation if necessary. fn translate_message<'a>( &'a self, - message: &'a DiagnosticMessage, + message: &'a DiagMessage, args: &'a FluentArgs<'_>, ) -> Result<Cow<'_, str>, TranslateError<'_>> { trace!(?message, ?args); let (identifier, attr) = match message { - DiagnosticMessage::Str(msg) | DiagnosticMessage::Translated(msg) => { + DiagMessage::Str(msg) | DiagMessage::Translated(msg) => { return Ok(Cow::Borrowed(msg)); } - DiagnosticMessage::FluentIdentifier(identifier, attr) => (identifier, attr), + DiagMessage::FluentIdentifier(identifier, attr) => (identifier, attr), }; let translate_with_bundle = |bundle: &'a FluentBundle| -> Result<Cow<'_, str>, TranslateError<'_>> { |
