diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index aa05b211561..c2043d234ae 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -441,7 +441,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { } /// Retrieves the [`DiagCtxt`] if available - pub fn handler(&self) -> Option<&DiagCtxt> { + pub fn dcx(&self) -> Option<&DiagCtxt> { match self.inner.state { DiagnosticBuilderState::Emittable(handler) => Some(handler), DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => None, diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index 22683fcd9b3..25d73904e7c 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -184,7 +184,7 @@ pub(crate) struct UnsafeOpInUnsafeFn { impl<'a> DecorateLint<'a, ()> for UnsafeOpInUnsafeFn { #[track_caller] fn decorate_lint<'b>(self, diag: &'b mut DiagnosticBuilder<'a, ()>) { - let handler = diag.handler().expect("lint should not yet be emitted"); + let handler = diag.dcx().expect("lint should not yet be emitted"); let desc = handler.eagerly_translate_to_string(self.details.label(), [].into_iter()); diag.set_arg("details", desc); diag.span_label(self.details.span, self.details.label());