diff options
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 62 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 154 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 45 |
3 files changed, 129 insertions, 132 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index c186d5b284f..0c3e7fb75b0 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -38,7 +38,7 @@ pub enum DiagArgValue { Str(Cow<'static, str>), // This gets converted to a `FluentNumber`, which is an `f64`. An `i32` // safely fits in an `f64`. Any integers bigger than that will be converted - // to strings in `into_diagnostic_arg` and stored using the `Str` variant. + // to strings in `into_diag_arg` and stored using the `Str` variant. Number(i32), StrListSepByAnd(Vec<Cow<'static, str>>), } @@ -112,48 +112,48 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError { /// When implemented manually, it should be generic over the emission /// guarantee, i.e.: /// ```ignore (fragment) -/// impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for Foo { ... } +/// impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for Foo { ... } /// ``` /// rather than being specific: /// ```ignore (fragment) -/// impl<'a> IntoDiagnostic<'a> for Bar { ... } // the default type param is `ErrorGuaranteed` -/// impl<'a> IntoDiagnostic<'a, ()> for Baz { ... } +/// impl<'a> Diagnostic<'a> for Bar { ... } // the default type param is `ErrorGuaranteed` +/// impl<'a> Diagnostic<'a, ()> for Baz { ... } /// ``` /// There are two reasons for this. /// - A diagnostic like `Foo` *could* be emitted at any level -- `level` is -/// passed in to `into_diagnostic` from outside. Even if in practice it is +/// passed in to `into_diag` from outside. Even if in practice it is /// always emitted at a single level, we let the diagnostic creation/emission /// site determine the level (by using `create_err`, `emit_warn`, etc.) -/// rather than the `IntoDiagnostic` impl. +/// rather than the `Diagnostic` impl. /// - Derived impls are always generic, and it's good for the hand-written /// impls to be consistent with them. -#[rustc_diagnostic_item = "IntoDiagnostic"] -pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> { +#[rustc_diagnostic_item = "Diagnostic"] +pub trait Diagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> { /// Write out as a diagnostic out of `DiagCtxt`. #[must_use] - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G>; + fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G>; } -impl<'a, T, G> IntoDiagnostic<'a, G> for Spanned<T> +impl<'a, T, G> Diagnostic<'a, G> for Spanned<T> where - T: IntoDiagnostic<'a, G>, + T: Diagnostic<'a, G>, G: EmissionGuarantee, { - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> { - self.node.into_diagnostic(dcx, level).with_span(self.span) + fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> { + self.node.into_diag(dcx, level).with_span(self.span) } } -/// Converts a value of a type into a `DiagArg` (typically a field of an `IntoDiagnostic` struct). +/// Converts a value of a type into a `DiagArg` (typically a field of an `Diag` struct). /// Implemented as a custom trait rather than `From` so that it is implemented on the type being /// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to /// implement this. -pub trait IntoDiagnosticArg { - fn into_diagnostic_arg(self) -> DiagArgValue; +pub trait IntoDiagArg { + fn into_diag_arg(self) -> DiagArgValue; } -impl IntoDiagnosticArg for DiagArgValue { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for DiagArgValue { + fn into_diag_arg(self) -> DiagArgValue { self } } @@ -170,19 +170,19 @@ impl Into<FluentValue<'static>> for DiagArgValue { /// Trait implemented by error types. This should not be implemented manually. Instead, use /// `#[derive(Subdiagnostic)]` -- see [rustc_macros::Subdiagnostic]. -#[rustc_diagnostic_item = "AddToDiagnostic"] -pub trait AddToDiagnostic +#[rustc_diagnostic_item = "Subdiagnostic"] +pub trait Subdiagnostic where Self: Sized, { /// Add a subdiagnostic to an existing diagnostic. - fn add_to_diagnostic<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { - self.add_to_diagnostic_with(diag, |_, m| m); + fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { + self.add_to_diag_with(diag, |_, m| m); } /// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used /// (to optionally perform eager translation). - fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( + fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( self, diag: &mut Diag<'_, G>, f: F, @@ -193,8 +193,8 @@ pub trait SubdiagMessageOp<G> = Fn(&mut Diag<'_, G>, SubdiagMessage) -> SubdiagM /// Trait implemented by lint types. This should not be implemented manually. Instead, use /// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic]. -#[rustc_diagnostic_item = "DecorateLint"] -pub trait DecorateLint<'a, G: EmissionGuarantee> { +#[rustc_diagnostic_item = "LintDiagnostic"] +pub trait LintDiagnostic<'a, G: EmissionGuarantee> { /// Decorate and emit a lint. fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, G>); @@ -419,8 +419,8 @@ impl DiagInner { self.children.push(sub); } - pub(crate) fn arg(&mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagnosticArg) { - self.args.insert(name.into(), arg.into_diagnostic_arg()); + pub(crate) fn arg(&mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagArg) { + self.args.insert(name.into(), arg.into_diag_arg()); } /// Fields used for Hash, and PartialEq trait. @@ -482,7 +482,7 @@ pub struct Subdiag { /// - The `EmissionGuarantee`, which determines the type returned from `emit`. /// /// Each constructed `Diag` must be consumed by a function such as `emit`, -/// `cancel`, `delay_as_bug`, or `into_diagnostic`. A panic occurrs if a `Diag` +/// `cancel`, `delay_as_bug`, or `into_diag`. A panic occurrs if a `Diag` /// is dropped without being consumed by one of these functions. /// /// If there is some state in a downstream crate you would like to access in @@ -1194,9 +1194,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { pub fn subdiagnostic( &mut self, dcx: &crate::DiagCtxt, - subdiagnostic: impl AddToDiagnostic, + subdiagnostic: impl Subdiagnostic, ) -> &mut Self { - subdiagnostic.add_to_diagnostic_with(self, |diag, msg| { + subdiagnostic.add_to_diag_with(self, |diag, msg| { let args = diag.args.iter(); let msg = diag.subdiagnostic_message_to_diagnostic_message(msg); dcx.eagerly_translate(msg, args) @@ -1243,7 +1243,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { pub fn arg( &mut self, name: impl Into<DiagArgName>, - arg: impl IntoDiagnosticArg, + arg: impl IntoDiagArg, ) -> &mut Self { self.deref_mut().arg(name, arg); self diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 839bd65e4a6..f90190797ae 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -1,8 +1,8 @@ use crate::diagnostic::DiagLocation; -use crate::{fluent_generated as fluent, AddToDiagnostic}; +use crate::{fluent_generated as fluent, Subdiagnostic}; use crate::{ - Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg, - Level, SubdiagMessageOp, + Diag, DiagArgValue, DiagCtxt, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level, + SubdiagMessageOp, }; use rustc_ast as ast; use rustc_ast_pretty::pprust; @@ -22,9 +22,9 @@ use std::process::ExitStatus; pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display); -impl IntoDiagnosticArg for DiagArgFromDisplay<'_> { - fn into_diagnostic_arg(self) -> DiagArgValue { - self.0.to_string().into_diagnostic_arg() +impl IntoDiagArg for DiagArgFromDisplay<'_> { + fn into_diag_arg(self) -> DiagArgValue { + self.0.to_string().into_diag_arg() } } @@ -40,34 +40,34 @@ impl<'a, T: fmt::Display> From<&'a T> for DiagArgFromDisplay<'a> { } } -impl<'a, T: Clone + IntoDiagnosticArg> IntoDiagnosticArg for &'a T { - fn into_diagnostic_arg(self) -> DiagArgValue { - self.clone().into_diagnostic_arg() +impl<'a, T: Clone + IntoDiagArg> IntoDiagArg for &'a T { + fn into_diag_arg(self) -> DiagArgValue { + self.clone().into_diag_arg() } } -macro_rules! into_diagnostic_arg_using_display { +macro_rules! into_diag_arg_using_display { ($( $ty:ty ),+ $(,)?) => { $( - impl IntoDiagnosticArg for $ty { - fn into_diagnostic_arg(self) -> DiagArgValue { - self.to_string().into_diagnostic_arg() + impl IntoDiagArg for $ty { + fn into_diag_arg(self) -> DiagArgValue { + self.to_string().into_diag_arg() } } )+ } } -macro_rules! into_diagnostic_arg_for_number { +macro_rules! into_diag_arg_for_number { ($( $ty:ty ),+ $(,)?) => { $( - impl IntoDiagnosticArg for $ty { - fn into_diagnostic_arg(self) -> DiagArgValue { + impl IntoDiagArg for $ty { + fn into_diag_arg(self) -> DiagArgValue { // Convert to a string if it won't fit into `Number`. if let Ok(n) = TryInto::<i32>::try_into(self) { DiagArgValue::Number(n) } else { - self.to_string().into_diagnostic_arg() + self.to_string().into_diag_arg() } } } @@ -75,7 +75,7 @@ macro_rules! into_diagnostic_arg_for_number { } } -into_diagnostic_arg_using_display!( +into_diag_arg_using_display!( ast::ParamKindOrd, std::io::Error, Box<dyn std::error::Error>, @@ -92,10 +92,10 @@ into_diagnostic_arg_using_display!( ErrCode, ); -into_diagnostic_arg_for_number!(i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize); +into_diag_arg_for_number!(i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize); -impl IntoDiagnosticArg for bool { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for bool { + fn into_diag_arg(self) -> DiagArgValue { if self { DiagArgValue::Str(Cow::Borrowed("true")) } else { @@ -104,64 +104,64 @@ impl IntoDiagnosticArg for bool { } } -impl IntoDiagnosticArg for char { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for char { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(format!("{self:?}"))) } } -impl IntoDiagnosticArg for Vec<char> { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for Vec<char> { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::StrListSepByAnd( self.into_iter().map(|c| Cow::Owned(format!("{c:?}"))).collect(), ) } } -impl IntoDiagnosticArg for Symbol { - fn into_diagnostic_arg(self) -> DiagArgValue { - self.to_ident_string().into_diagnostic_arg() +impl IntoDiagArg for Symbol { + fn into_diag_arg(self) -> DiagArgValue { + self.to_ident_string().into_diag_arg() } } -impl<'a> IntoDiagnosticArg for &'a str { - fn into_diagnostic_arg(self) -> DiagArgValue { - self.to_string().into_diagnostic_arg() +impl<'a> IntoDiagArg for &'a str { + fn into_diag_arg(self) -> DiagArgValue { + self.to_string().into_diag_arg() } } -impl IntoDiagnosticArg for String { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for String { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self)) } } -impl<'a> IntoDiagnosticArg for Cow<'a, str> { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl<'a> IntoDiagArg for Cow<'a, str> { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.into_owned())) } } -impl<'a> IntoDiagnosticArg for &'a Path { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl<'a> IntoDiagArg for &'a Path { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.display().to_string())) } } -impl IntoDiagnosticArg for PathBuf { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for PathBuf { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.display().to_string())) } } -impl IntoDiagnosticArg for PanicStrategy { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for PanicStrategy { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.desc().to_string())) } } -impl IntoDiagnosticArg for hir::ConstContext { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for hir::ConstContext { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Borrowed(match self { hir::ConstContext::ConstFn => "const_fn", hir::ConstContext::Static(_) => "static", @@ -170,58 +170,58 @@ impl IntoDiagnosticArg for hir::ConstContext { } } -impl IntoDiagnosticArg for ast::Expr { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for ast::Expr { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(pprust::expr_to_string(&self))) } } -impl IntoDiagnosticArg for ast::Path { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for ast::Path { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(pprust::path_to_string(&self))) } } -impl IntoDiagnosticArg for ast::token::Token { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for ast::token::Token { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(pprust::token_to_string(&self)) } } -impl IntoDiagnosticArg for ast::token::TokenKind { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for ast::token::TokenKind { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(pprust::token_kind_to_string(&self)) } } -impl IntoDiagnosticArg for type_ir::FloatTy { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for type_ir::FloatTy { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Borrowed(self.name_str())) } } -impl IntoDiagnosticArg for std::ffi::CString { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for std::ffi::CString { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned())) } } -impl IntoDiagnosticArg for rustc_data_structures::small_c_str::SmallCStr { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for rustc_data_structures::small_c_str::SmallCStr { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned())) } } -impl IntoDiagnosticArg for ast::Visibility { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for ast::Visibility { + fn into_diag_arg(self) -> DiagArgValue { let s = pprust::vis_to_string(&self); let s = s.trim_end().to_string(); DiagArgValue::Str(Cow::Owned(s)) } } -impl IntoDiagnosticArg for rustc_lint_defs::Level { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for rustc_lint_defs::Level { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Borrowed(self.to_cmd_flag())) } } @@ -235,22 +235,22 @@ impl From<Vec<Symbol>> for DiagSymbolList { } } -impl IntoDiagnosticArg for DiagSymbolList { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for DiagSymbolList { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::StrListSepByAnd( self.0.into_iter().map(|sym| Cow::Owned(format!("`{sym}`"))).collect(), ) } } -impl<Id> IntoDiagnosticArg for hir::def::Res<Id> { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl<Id> IntoDiagArg for hir::def::Res<Id> { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::Borrowed(self.descr())) } } -impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetDataLayoutErrors<'_> { - fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> { +impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> { + fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> { match self { TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => { Diag::new(dcx, level, fluent::errors_target_invalid_address_space) @@ -297,8 +297,8 @@ pub struct SingleLabelManySpans { pub spans: Vec<Span>, pub label: &'static str, } -impl AddToDiagnostic for SingleLabelManySpans { - fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( +impl Subdiagnostic for SingleLabelManySpans { + fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( self, diag: &mut Diag<'_, G>, _: F, @@ -315,20 +315,20 @@ pub struct ExpectedLifetimeParameter { pub count: usize, } -impl IntoDiagnosticArg for DiagLocation { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for DiagLocation { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::from(self.to_string())) } } -impl IntoDiagnosticArg for Backtrace { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for Backtrace { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::from(self.to_string())) } } -impl IntoDiagnosticArg for Level { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for Level { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(Cow::from(self.to_string())) } } @@ -342,8 +342,8 @@ pub struct IndicateAnonymousLifetime { pub suggestion: String, } -impl IntoDiagnosticArg for type_ir::ClosureKind { - fn into_diagnostic_arg(self) -> DiagArgValue { +impl IntoDiagArg for type_ir::ClosureKind { + fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::Str(self.as_str().into()) } } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 76b44f73f47..bedb677c1e9 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -37,9 +37,9 @@ extern crate self as rustc_errors; pub use codes::*; pub use diagnostic::{ - AddToDiagnostic, BugAbort, DecorateLint, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, - DiagInner, DiagStyledString, EmissionGuarantee, FatalAbort, IntoDiagnostic, IntoDiagnosticArg, - StringPart, Subdiag, SubdiagMessageOp, + BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString, + Diagnostic, EmissionGuarantee, FatalAbort, IntoDiagArg, LintDiagnostic, StringPart, Subdiag, + SubdiagMessageOp, Subdiagnostic, }; pub use diagnostic_impls::{ DiagArgFromDisplay, DiagSymbolList, ExpectedLifetimeParameter, IndicateAnonymousLifetime, @@ -1134,12 +1134,12 @@ impl DiagCtxt { } #[track_caller] - pub fn create_bug<'a>(&'a self, bug: impl IntoDiagnostic<'a, BugAbort>) -> Diag<'a, BugAbort> { - bug.into_diagnostic(self, Bug) + pub fn create_bug<'a>(&'a self, bug: impl Diagnostic<'a, BugAbort>) -> Diag<'a, BugAbort> { + bug.into_diag(self, Bug) } #[track_caller] - pub fn emit_bug<'a>(&'a self, bug: impl IntoDiagnostic<'a, BugAbort>) -> ! { + pub fn emit_bug<'a>(&'a self, bug: impl Diagnostic<'a, BugAbort>) -> ! { self.create_bug(bug).emit() } @@ -1174,29 +1174,26 @@ impl DiagCtxt { #[track_caller] pub fn create_fatal<'a>( &'a self, - fatal: impl IntoDiagnostic<'a, FatalAbort>, + fatal: impl Diagnostic<'a, FatalAbort>, ) -> Diag<'a, FatalAbort> { - fatal.into_diagnostic(self, Fatal) + fatal.into_diag(self, Fatal) } #[track_caller] - pub fn emit_fatal<'a>(&'a self, fatal: impl IntoDiagnostic<'a, FatalAbort>) -> ! { + pub fn emit_fatal<'a>(&'a self, fatal: impl Diagnostic<'a, FatalAbort>) -> ! { self.create_fatal(fatal).emit() } #[track_caller] pub fn create_almost_fatal<'a>( &'a self, - fatal: impl IntoDiagnostic<'a, FatalError>, + fatal: impl Diagnostic<'a, FatalError>, ) -> Diag<'a, FatalError> { - fatal.into_diagnostic(self, Fatal) + fatal.into_diag(self, Fatal) } #[track_caller] - pub fn emit_almost_fatal<'a>( - &'a self, - fatal: impl IntoDiagnostic<'a, FatalError>, - ) -> FatalError { + pub fn emit_almost_fatal<'a>(&'a self, fatal: impl Diagnostic<'a, FatalError>) -> FatalError { self.create_almost_fatal(fatal).emit() } @@ -1234,12 +1231,12 @@ impl DiagCtxt { } #[track_caller] - pub fn create_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> Diag<'a> { - err.into_diagnostic(self, Error) + pub fn create_err<'a>(&'a self, err: impl Diagnostic<'a>) -> Diag<'a> { + err.into_diag(self, Error) } #[track_caller] - pub fn emit_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed { + pub fn emit_err<'a>(&'a self, err: impl Diagnostic<'a>) -> ErrorGuaranteed { self.create_err(err).emit() } @@ -1297,12 +1294,12 @@ impl DiagCtxt { } #[track_caller] - pub fn create_warn<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) -> Diag<'a, ()> { - warning.into_diagnostic(self, Warning) + pub fn create_warn<'a>(&'a self, warning: impl Diagnostic<'a, ()>) -> Diag<'a, ()> { + warning.into_diag(self, Warning) } #[track_caller] - pub fn emit_warn<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) { + pub fn emit_warn<'a>(&'a self, warning: impl Diagnostic<'a, ()>) { self.create_warn(warning).emit() } @@ -1335,12 +1332,12 @@ impl DiagCtxt { } #[track_caller] - pub fn create_note<'a>(&'a self, note: impl IntoDiagnostic<'a, ()>) -> Diag<'a, ()> { - note.into_diagnostic(self, Note) + pub fn create_note<'a>(&'a self, note: impl Diagnostic<'a, ()>) -> Diag<'a, ()> { + note.into_diag(self, Note) } #[track_caller] - pub fn emit_note<'a>(&'a self, note: impl IntoDiagnostic<'a, ()>) { + pub fn emit_note<'a>(&'a self, note: impl Diagnostic<'a, ()>) { self.create_note(note).emit() } |
