Skip to content

Commit 7a294e9

Browse files
committed
Rename IntoDiagnostic as Diagnostic.
To match `derive(Diagnostic)`. Also rename `into_diagnostic` as `into_diag`.
1 parent a09b1d3 commit 7a294e9

File tree

28 files changed

+146
-164
lines changed

28 files changed

+146
-164
lines changed

Diff for: compiler/rustc_attr/src/session_diagnostics.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use std::num::IntErrorKind;
22

33
use rustc_ast as ast;
4-
use rustc_errors::{
5-
codes::*, Applicability, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level,
6-
};
4+
use rustc_errors::{codes::*, Applicability, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
75
use rustc_macros::Diagnostic;
86
use rustc_span::{Span, Symbol};
97

@@ -50,8 +48,8 @@ pub(crate) struct UnknownMetaItem<'a> {
5048
}
5149

5250
// Manual implementation to be able to format `expected` items correctly.
53-
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnknownMetaItem<'_> {
54-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
51+
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnknownMetaItem<'_> {
52+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
5553
let expected = self.expected.iter().map(|name| format!("`{name}`")).collect::<Vec<_>>();
5654
Diag::new(dcx, level, fluent::attr_unknown_meta_item)
5755
.with_span(self.span)
@@ -203,8 +201,8 @@ pub(crate) struct UnsupportedLiteral {
203201
pub start_point_span: Span,
204202
}
205203

206-
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnsupportedLiteral {
207-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
204+
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnsupportedLiteral {
205+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
208206
let mut diag = Diag::new(
209207
dcx,
210208
level,

Diff for: compiler/rustc_builtin_macros/src/errors.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_errors::{
2-
codes::*, AddToDiagnostic, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
2+
codes::*, AddToDiagnostic, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level, MultiSpan,
33
SingleLabelManySpans, SubdiagMessageOp,
44
};
55
use rustc_macros::{Diagnostic, Subdiagnostic};
@@ -425,9 +425,9 @@ pub(crate) struct EnvNotDefinedWithUserMessage {
425425
}
426426

427427
// Hand-written implementation to support custom user messages.
428-
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for EnvNotDefinedWithUserMessage {
428+
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for EnvNotDefinedWithUserMessage {
429429
#[track_caller]
430-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
430+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
431431
#[expect(
432432
rustc::untranslatable_diagnostic,
433433
reason = "cannot translate user-provided messages"
@@ -785,8 +785,8 @@ pub(crate) struct AsmClobberNoReg {
785785
pub(crate) clobbers: Vec<Span>,
786786
}
787787

788-
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for AsmClobberNoReg {
789-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
788+
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AsmClobberNoReg {
789+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
790790
// eager translation as `span_labels` takes `AsRef<str>`
791791
let lbl1 = dcx.eagerly_translate_to_string(
792792
crate::fluent_generated::builtin_macros_asm_clobber_abi,

Diff for: compiler/rustc_codegen_gcc/src/errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_errors::{Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level};
1+
use rustc_errors::{Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
22
use rustc_macros::{Diagnostic, Subdiagnostic};
33
use rustc_span::Span;
44

@@ -89,8 +89,8 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
8989
#[help(codegen_gcc_missing_features)]
9090
pub(crate) struct MissingFeatures;
9191

92-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
93-
fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
92+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
93+
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
9494
let mut diag = Diag::new(dcx, level, fluent::codegen_gcc_target_feature_disable_or_enable);
9595
if let Some(span) = self.span {
9696
diag.span(span);

Diff for: compiler/rustc_codegen_llvm/src/errors.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::path::Path;
44

55
use crate::fluent_generated as fluent;
66
use rustc_data_structures::small_c_str::SmallCStr;
7-
use rustc_errors::{Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level};
7+
use rustc_errors::{Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
88
use rustc_macros::{Diagnostic, Subdiagnostic};
99
use rustc_span::Span;
1010

@@ -99,9 +99,9 @@ pub(crate) struct DynamicLinkingWithLTO;
9999

100100
pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
101101

102-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for ParseTargetMachineConfig<'_> {
103-
fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
104-
let diag: Diag<'_, G> = self.0.into_diagnostic(dcx, level);
102+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for ParseTargetMachineConfig<'_> {
103+
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
104+
let diag: Diag<'_, G> = self.0.into_diag(dcx, level);
105105
let (message, _) = diag.messages.first().expect("`LlvmError` with no message");
106106
let message = dcx.eagerly_translate_to_string(message.clone(), diag.args.iter());
107107
Diag::new(dcx, level, fluent::codegen_llvm_parse_target_machine_config)
@@ -119,8 +119,8 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
119119
#[help(codegen_llvm_missing_features)]
120120
pub(crate) struct MissingFeatures;
121121

122-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
123-
fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
122+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
123+
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
124124
let mut diag = Diag::new(dcx, level, fluent::codegen_llvm_target_feature_disable_or_enable);
125125
if let Some(span) = self.span {
126126
diag.span(span);
@@ -179,8 +179,8 @@ pub enum LlvmError<'a> {
179179

180180
pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String);
181181

182-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> {
183-
fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
182+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
183+
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
184184
use LlvmError::*;
185185
let msg_with_llvm_err = match &self.0 {
186186
WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err,
@@ -198,7 +198,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> {
198198
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
199199
};
200200
self.0
201-
.into_diagnostic(dcx, level)
201+
.into_diag(dcx, level)
202202
.with_primary_message(msg_with_llvm_err)
203203
.with_arg("llvm_err", self.1)
204204
}

Diff for: compiler/rustc_codegen_ssa/src/errors.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::assert_module_sources::CguReuse;
44
use crate::back::command::Command;
55
use crate::fluent_generated as fluent;
66
use rustc_errors::{
7-
codes::*, Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagArg, IntoDiagnostic, Level,
7+
codes::*, Diag, DiagArgValue, DiagCtxt, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
88
};
99
use rustc_macros::Diagnostic;
1010
use rustc_middle::ty::layout::LayoutError;
@@ -214,8 +214,8 @@ pub enum LinkRlibError {
214214

215215
pub struct ThorinErrorWrapper(pub thorin::Error);
216216

217-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for ThorinErrorWrapper {
218-
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
217+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for ThorinErrorWrapper {
218+
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
219219
let build = |msg| Diag::new(dcx, level, msg);
220220
match self.0 {
221221
thorin::Error::ReadInput(_) => build(fluent::codegen_ssa_thorin_read_input_failure),
@@ -347,8 +347,8 @@ pub struct LinkingFailed<'a> {
347347
pub escaped_output: String,
348348
}
349349

350-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for LinkingFailed<'_> {
351-
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
350+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
351+
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
352352
let mut diag = Diag::new(dcx, level, fluent::codegen_ssa_linking_failed);
353353
diag.arg("linker_path", format!("{}", self.linker_path.display()));
354354
diag.arg("exit_status", format!("{}", self.exit_status));

Diff for: compiler/rustc_const_eval/src/const_eval/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::mem;
22

3-
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, IntoDiagArg, IntoDiagnostic};
3+
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagArg};
44
use rustc_hir::CRATE_HIR_ID;
55
use rustc_middle::mir::AssertKind;
66
use rustc_middle::query::TyCtxtAt;
@@ -130,7 +130,7 @@ pub(super) fn report<'tcx, C, F, E>(
130130
where
131131
C: FnOnce() -> (Span, Vec<FrameNote>),
132132
F: FnOnce(Span, Vec<FrameNote>) -> E,
133-
E: IntoDiagnostic<'tcx>,
133+
E: Diagnostic<'tcx>,
134134
{
135135
// Special handling for certain errors
136136
match error {

Diff for: compiler/rustc_const_eval/src/errors.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
use rustc_errors::{
4-
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, EmissionGuarantee, IntoDiagnostic, Level,
4+
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, Diagnostic, EmissionGuarantee, Level,
55
};
66
use rustc_hir::ConstContext;
77
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@@ -858,8 +858,7 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
858858
InvalidProgramInfo::Layout(e) => {
859859
// The level doesn't matter, `dummy_diag` is consumed without it being used.
860860
let dummy_level = Level::Bug;
861-
let dummy_diag: Diag<'_, ()> =
862-
e.into_diagnostic().into_diagnostic(diag.dcx, dummy_level);
861+
let dummy_diag: Diag<'_, ()> = e.into_diagnostic().into_diag(diag.dcx, dummy_level);
863862
for (name, val) in dummy_diag.args.iter() {
864863
diag.arg(name.clone(), val.clone());
865864
}

Diff for: compiler/rustc_errors/src/diagnostic.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -112,39 +112,39 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError {
112112
/// When implemented manually, it should be generic over the emission
113113
/// guarantee, i.e.:
114114
/// ```ignore (fragment)
115-
/// impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for Foo { ... }
115+
/// impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for Foo { ... }
116116
/// ```
117117
/// rather than being specific:
118118
/// ```ignore (fragment)
119-
/// impl<'a> IntoDiagnostic<'a> for Bar { ... } // the default type param is `ErrorGuaranteed`
120-
/// impl<'a> IntoDiagnostic<'a, ()> for Baz { ... }
119+
/// impl<'a> Diagnostic<'a> for Bar { ... } // the default type param is `ErrorGuaranteed`
120+
/// impl<'a> Diagnostic<'a, ()> for Baz { ... }
121121
/// ```
122122
/// There are two reasons for this.
123123
/// - A diagnostic like `Foo` *could* be emitted at any level -- `level` is
124-
/// passed in to `into_diagnostic` from outside. Even if in practice it is
124+
/// passed in to `into_diag` from outside. Even if in practice it is
125125
/// always emitted at a single level, we let the diagnostic creation/emission
126126
/// site determine the level (by using `create_err`, `emit_warn`, etc.)
127-
/// rather than the `IntoDiagnostic` impl.
127+
/// rather than the `Diagnostic` impl.
128128
/// - Derived impls are always generic, and it's good for the hand-written
129129
/// impls to be consistent with them.
130-
#[rustc_diagnostic_item = "IntoDiagnostic"]
131-
pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> {
130+
#[rustc_diagnostic_item = "Diagnostic"]
131+
pub trait Diagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> {
132132
/// Write out as a diagnostic out of `DiagCtxt`.
133133
#[must_use]
134-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G>;
134+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G>;
135135
}
136136

137-
impl<'a, T, G> IntoDiagnostic<'a, G> for Spanned<T>
137+
impl<'a, T, G> Diagnostic<'a, G> for Spanned<T>
138138
where
139-
T: IntoDiagnostic<'a, G>,
139+
T: Diagnostic<'a, G>,
140140
G: EmissionGuarantee,
141141
{
142-
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
143-
self.node.into_diagnostic(dcx, level).with_span(self.span)
142+
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
143+
self.node.into_diag(dcx, level).with_span(self.span)
144144
}
145145
}
146146

147-
/// Converts a value of a type into a `DiagArg` (typically a field of an `IntoDiagnostic` struct).
147+
/// Converts a value of a type into a `DiagArg` (typically a field of an `Diag` struct).
148148
/// Implemented as a custom trait rather than `From` so that it is implemented on the type being
149149
/// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to
150150
/// implement this.
@@ -482,7 +482,7 @@ pub struct Subdiag {
482482
/// - The `EmissionGuarantee`, which determines the type returned from `emit`.
483483
///
484484
/// Each constructed `Diag` must be consumed by a function such as `emit`,
485-
/// `cancel`, `delay_as_bug`, or `into_diagnostic`. A panic occurrs if a `Diag`
485+
/// `cancel`, `delay_as_bug`, or `into_diag`. A panic occurrs if a `Diag`
486486
/// is dropped without being consumed by one of these functions.
487487
///
488488
/// If there is some state in a downstream crate you would like to access in

Diff for: compiler/rustc_errors/src/diagnostic_impls.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::diagnostic::DiagLocation;
22
use crate::{fluent_generated as fluent, AddToDiagnostic};
33
use crate::{
4-
Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagArg, IntoDiagnostic, Level,
4+
Diag, DiagArgValue, DiagCtxt, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level,
55
SubdiagMessageOp,
66
};
77
use rustc_ast as ast;
@@ -249,8 +249,8 @@ impl<Id> IntoDiagArg for hir::def::Res<Id> {
249249
}
250250
}
251251

252-
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetDataLayoutErrors<'_> {
253-
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
252+
impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> {
253+
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
254254
match self {
255255
TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => {
256256
Diag::new(dcx, level, fluent::errors_target_invalid_address_space)

Diff for: compiler/rustc_errors/src/lib.rs

+19-22
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern crate self as rustc_errors;
3838
pub use codes::*;
3939
pub use diagnostic::{
4040
AddToDiagnostic, BugAbort, DecorateLint, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue,
41-
DiagInner, DiagStyledString, EmissionGuarantee, FatalAbort, IntoDiagArg, IntoDiagnostic,
41+
DiagInner, DiagStyledString, Diagnostic, EmissionGuarantee, FatalAbort, IntoDiagArg,
4242
StringPart, Subdiag, SubdiagMessageOp,
4343
};
4444
pub use diagnostic_impls::{
@@ -1134,12 +1134,12 @@ impl DiagCtxt {
11341134
}
11351135

11361136
#[track_caller]
1137-
pub fn create_bug<'a>(&'a self, bug: impl IntoDiagnostic<'a, BugAbort>) -> Diag<'a, BugAbort> {
1138-
bug.into_diagnostic(self, Bug)
1137+
pub fn create_bug<'a>(&'a self, bug: impl Diagnostic<'a, BugAbort>) -> Diag<'a, BugAbort> {
1138+
bug.into_diag(self, Bug)
11391139
}
11401140

11411141
#[track_caller]
1142-
pub fn emit_bug<'a>(&'a self, bug: impl IntoDiagnostic<'a, BugAbort>) -> ! {
1142+
pub fn emit_bug<'a>(&'a self, bug: impl Diagnostic<'a, BugAbort>) -> ! {
11431143
self.create_bug(bug).emit()
11441144
}
11451145

@@ -1174,29 +1174,26 @@ impl DiagCtxt {
11741174
#[track_caller]
11751175
pub fn create_fatal<'a>(
11761176
&'a self,
1177-
fatal: impl IntoDiagnostic<'a, FatalAbort>,
1177+
fatal: impl Diagnostic<'a, FatalAbort>,
11781178
) -> Diag<'a, FatalAbort> {
1179-
fatal.into_diagnostic(self, Fatal)
1179+
fatal.into_diag(self, Fatal)
11801180
}
11811181

11821182
#[track_caller]
1183-
pub fn emit_fatal<'a>(&'a self, fatal: impl IntoDiagnostic<'a, FatalAbort>) -> ! {
1183+
pub fn emit_fatal<'a>(&'a self, fatal: impl Diagnostic<'a, FatalAbort>) -> ! {
11841184
self.create_fatal(fatal).emit()
11851185
}
11861186

11871187
#[track_caller]
11881188
pub fn create_almost_fatal<'a>(
11891189
&'a self,
1190-
fatal: impl IntoDiagnostic<'a, FatalError>,
1190+
fatal: impl Diagnostic<'a, FatalError>,
11911191
) -> Diag<'a, FatalError> {
1192-
fatal.into_diagnostic(self, Fatal)
1192+
fatal.into_diag(self, Fatal)
11931193
}
11941194

11951195
#[track_caller]
1196-
pub fn emit_almost_fatal<'a>(
1197-
&'a self,
1198-
fatal: impl IntoDiagnostic<'a, FatalError>,
1199-
) -> FatalError {
1196+
pub fn emit_almost_fatal<'a>(&'a self, fatal: impl Diagnostic<'a, FatalError>) -> FatalError {
12001197
self.create_almost_fatal(fatal).emit()
12011198
}
12021199

@@ -1234,12 +1231,12 @@ impl DiagCtxt {
12341231
}
12351232

12361233
#[track_caller]
1237-
pub fn create_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> Diag<'a> {
1238-
err.into_diagnostic(self, Error)
1234+
pub fn create_err<'a>(&'a self, err: impl Diagnostic<'a>) -> Diag<'a> {
1235+
err.into_diag(self, Error)
12391236
}
12401237

12411238
#[track_caller]
1242-
pub fn emit_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed {
1239+
pub fn emit_err<'a>(&'a self, err: impl Diagnostic<'a>) -> ErrorGuaranteed {
12431240
self.create_err(err).emit()
12441241
}
12451242

@@ -1297,12 +1294,12 @@ impl DiagCtxt {
12971294
}
12981295

12991296
#[track_caller]
1300-
pub fn create_warn<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) -> Diag<'a, ()> {
1301-
warning.into_diagnostic(self, Warning)
1297+
pub fn create_warn<'a>(&'a self, warning: impl Diagnostic<'a, ()>) -> Diag<'a, ()> {
1298+
warning.into_diag(self, Warning)
13021299
}
13031300

13041301
#[track_caller]
1305-
pub fn emit_warn<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) {
1302+
pub fn emit_warn<'a>(&'a self, warning: impl Diagnostic<'a, ()>) {
13061303
self.create_warn(warning).emit()
13071304
}
13081305

@@ -1335,12 +1332,12 @@ impl DiagCtxt {
13351332
}
13361333

13371334
#[track_caller]
1338-
pub fn create_note<'a>(&'a self, note: impl IntoDiagnostic<'a, ()>) -> Diag<'a, ()> {
1339-
note.into_diagnostic(self, Note)
1335+
pub fn create_note<'a>(&'a self, note: impl Diagnostic<'a, ()>) -> Diag<'a, ()> {
1336+
note.into_diag(self, Note)
13401337
}
13411338

13421339
#[track_caller]
1343-
pub fn emit_note<'a>(&'a self, note: impl IntoDiagnostic<'a, ()>) {
1340+
pub fn emit_note<'a>(&'a self, note: impl Diagnostic<'a, ()>) {
13441341
self.create_note(note).emit()
13451342
}
13461343

0 commit comments

Comments
 (0)