diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 10:15:45 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 16:06:22 +1100 |
| commit | f422dca3ae8b8a8c9a99b8e6ec0899e08dc072c3 (patch) | |
| tree | 246774c222d64bdac2b129eed55c8f64f2cf4b66 /compiler/rustc_errors/src | |
| parent | 4dc7fab56f224467439237dafb8b3211f1a0d165 (diff) | |
| download | rust-f422dca3ae8b8a8c9a99b8e6ec0899e08dc072c3.tar.gz rust-f422dca3ae8b8a8c9a99b8e6ec0899e08dc072c3.zip | |
Rename many `DiagCtxt` arguments.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 40 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 16 |
3 files changed, 30 insertions, 30 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 7ae90dd07be..be506806065 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -886,13 +886,13 @@ impl Diagnostic { /// interpolated variables). pub fn eager_subdiagnostic( &mut self, - handler: &crate::DiagCtxt, + dcx: &crate::DiagCtxt, subdiagnostic: impl AddToDiagnostic, ) -> &mut Self { subdiagnostic.add_to_diagnostic_with(self, |diag, msg| { let args = diag.args(); let msg = diag.subdiagnostic_message_to_diagnostic_message(msg); - handler.eagerly_translate(msg, args) + dcx.eagerly_translate(msg, args) }); self } diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index c2043d234ae..f681a64ef06 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -21,7 +21,7 @@ use std::thread::panicking; pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> { /// Write out as a diagnostic out of `DiagCtxt`. #[must_use] - fn into_diagnostic(self, handler: &'a DiagCtxt) -> DiagnosticBuilder<'a, G>; + fn into_diagnostic(self, dcx: &'a DiagCtxt) -> DiagnosticBuilder<'a, G>; } impl<'a, T, G> IntoDiagnostic<'a, G> for Spanned<T> @@ -29,8 +29,8 @@ where T: IntoDiagnostic<'a, G>, G: EmissionGuarantee, { - fn into_diagnostic(self, handler: &'a DiagCtxt) -> DiagnosticBuilder<'a, G> { - let mut diag = self.node.into_diagnostic(handler); + fn into_diagnostic(self, dcx: &'a DiagCtxt) -> DiagnosticBuilder<'a, G> { + let mut diag = self.node.into_diagnostic(dcx); diag.set_span(self.span); diag } @@ -110,7 +110,7 @@ pub trait EmissionGuarantee: Sized { /// Creates a new `DiagnosticBuilder` that will return this type of guarantee. #[track_caller] fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self>; } @@ -166,10 +166,10 @@ impl EmissionGuarantee for ErrorGuaranteed { #[track_caller] fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Error { lint: false }, msg) + DiagnosticBuilder::new(dcx, Level::Error { lint: false }, msg) } } @@ -189,10 +189,10 @@ impl EmissionGuarantee for () { } fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Warning(None), msg) + DiagnosticBuilder::new(dcx, Level::Warning(None), msg) } } @@ -217,10 +217,10 @@ impl EmissionGuarantee for Noted { } fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Note, msg) + DiagnosticBuilder::new(dcx, Level::Note, msg) } } @@ -246,10 +246,10 @@ impl EmissionGuarantee for Bug { } fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Bug, msg) + DiagnosticBuilder::new(dcx, Level::Bug, msg) } } @@ -270,10 +270,10 @@ impl EmissionGuarantee for ! { } fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Fatal, msg) + DiagnosticBuilder::new(dcx, Level::Fatal, msg) } } @@ -294,10 +294,10 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError { } fn make_diagnostic_builder( - handler: &DiagCtxt, + dcx: &DiagCtxt, msg: impl Into<DiagnosticMessage>, ) -> DiagnosticBuilder<'_, Self> { - DiagnosticBuilder::new(handler, Level::Fatal, msg) + DiagnosticBuilder::new(dcx, Level::Fatal, msg) } } @@ -343,22 +343,22 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { /// `struct_*` methods on [`DiagCtxt`]. #[track_caller] pub(crate) fn new<M: Into<DiagnosticMessage>>( - handler: &'a DiagCtxt, + dcx: &'a DiagCtxt, level: Level, message: M, ) -> Self { let diagnostic = Diagnostic::new(level, message); - Self::new_diagnostic(handler, diagnostic) + Self::new_diagnostic(dcx, diagnostic) } /// Creates a new `DiagnosticBuilder` with an already constructed /// diagnostic. #[track_caller] - pub(crate) fn new_diagnostic(handler: &'a DiagCtxt, diagnostic: Diagnostic) -> Self { + pub(crate) fn new_diagnostic(dcx: &'a DiagCtxt, diagnostic: Diagnostic) -> Self { debug!("Created new diagnostic"); Self { inner: DiagnosticBuilderInner { - state: DiagnosticBuilderState::Emittable(handler), + state: DiagnosticBuilderState::Emittable(dcx), diagnostic: Box::new(diagnostic), }, _marker: PhantomData, diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index b379d683c96..3e4b3ee758a 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -246,18 +246,18 @@ impl<Id> IntoDiagnosticArg for hir::def::Res<Id> { } impl IntoDiagnostic<'_, !> for TargetDataLayoutErrors<'_> { - fn into_diagnostic(self, handler: &DiagCtxt) -> DiagnosticBuilder<'_, !> { + fn into_diagnostic(self, dcx: &DiagCtxt) -> DiagnosticBuilder<'_, !> { let mut diag; match self { TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => { - diag = handler.struct_fatal(fluent::errors_target_invalid_address_space); + diag = dcx.struct_fatal(fluent::errors_target_invalid_address_space); diag.set_arg("addr_space", addr_space); diag.set_arg("cause", cause); diag.set_arg("err", err); diag } TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => { - diag = handler.struct_fatal(fluent::errors_target_invalid_bits); + diag = dcx.struct_fatal(fluent::errors_target_invalid_bits); diag.set_arg("kind", kind); diag.set_arg("bit", bit); diag.set_arg("cause", cause); @@ -265,31 +265,31 @@ impl IntoDiagnostic<'_, !> for TargetDataLayoutErrors<'_> { diag } TargetDataLayoutErrors::MissingAlignment { cause } => { - diag = handler.struct_fatal(fluent::errors_target_missing_alignment); + diag = dcx.struct_fatal(fluent::errors_target_missing_alignment); diag.set_arg("cause", cause); diag } TargetDataLayoutErrors::InvalidAlignment { cause, err } => { - diag = handler.struct_fatal(fluent::errors_target_invalid_alignment); + diag = dcx.struct_fatal(fluent::errors_target_invalid_alignment); diag.set_arg("cause", cause); diag.set_arg("err_kind", err.diag_ident()); diag.set_arg("align", err.align()); diag } TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => { - diag = handler.struct_fatal(fluent::errors_target_inconsistent_architecture); + diag = dcx.struct_fatal(fluent::errors_target_inconsistent_architecture); diag.set_arg("dl", dl); diag.set_arg("target", target); diag } TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => { - diag = handler.struct_fatal(fluent::errors_target_inconsistent_pointer_width); + diag = dcx.struct_fatal(fluent::errors_target_inconsistent_pointer_width); diag.set_arg("pointer_size", pointer_size); diag.set_arg("target", target); diag } TargetDataLayoutErrors::InvalidBitsSize { err } => { - diag = handler.struct_fatal(fluent::errors_target_invalid_bits_size); + diag = dcx.struct_fatal(fluent::errors_target_invalid_bits_size); diag.set_arg("err", err); diag } |
