diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 10:35:56 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 15:42:11 +0000 |
| commit | 7ba82d61eb519c9c8cb8c47a3030a2bd2faaa186 (patch) | |
| tree | 552d7e4c38b78bc5f364f089383d1517a96ca608 /compiler/rustc_borrowck | |
| parent | c91edc3888073d0ddf2e0ff7741437e483a4f21e (diff) | |
| download | rust-7ba82d61eb519c9c8cb8c47a3030a2bd2faaa186.tar.gz rust-7ba82d61eb519c9c8cb8c47a3030a2bd2faaa186.zip | |
Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
Diffstat (limited to 'compiler/rustc_borrowck')
| -rw-r--r-- | compiler/rustc_borrowck/src/borrowck_errors.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/mod.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_borrowck/src/borrowck_errors.rs b/compiler/rustc_borrowck/src/borrowck_errors.rs index 622feb4e4c7..c1f75328272 100644 --- a/compiler/rustc_borrowck/src/borrowck_errors.rs +++ b/compiler/rustc_borrowck/src/borrowck_errors.rs @@ -1,13 +1,13 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] -use rustc_errors::{codes::*, struct_span_code_err, Diag, DiagCtxt}; +use rustc_errors::{codes::*, struct_span_code_err, Diag, DiagCtxtHandle}; use rustc_middle::span_bug; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_span::Span; impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> { - pub fn dcx(&self) -> &'tcx DiagCtxt { + pub fn dcx(&self) -> DiagCtxtHandle<'tcx> { self.infcx.dcx() } diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index abb0b5afbd8..2c12d25d24a 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -4,8 +4,8 @@ use crate::session_diagnostics::{ CaptureArgLabel, CaptureReasonLabel, CaptureReasonNote, CaptureReasonSuggest, CaptureVarCause, CaptureVarKind, CaptureVarPathUseCause, OnClosureNote, }; -use rustc_errors::{Applicability, Diag}; -use rustc_errors::{DiagCtxt, MultiSpan}; +use rustc_errors::MultiSpan; +use rustc_errors::{Applicability, Diag, DiagCtxtHandle}; use rustc_hir::def::{CtorKind, Namespace}; use rustc_hir::CoroutineKind; use rustc_hir::{self as hir, LangItem}; @@ -593,7 +593,7 @@ impl UseSpans<'_> { #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn args_subdiag( self, - dcx: &DiagCtxt, + dcx: DiagCtxtHandle<'_>, err: &mut Diag<'_>, f: impl FnOnce(Span) -> CaptureArgLabel, ) { @@ -607,7 +607,7 @@ impl UseSpans<'_> { #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn var_path_only_subdiag( self, - dcx: &DiagCtxt, + dcx: DiagCtxtHandle<'_>, err: &mut Diag<'_>, action: crate::InitializationRequiringAction, ) { @@ -645,7 +645,7 @@ impl UseSpans<'_> { #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn var_subdiag( self, - dcx: &DiagCtxt, + dcx: DiagCtxtHandle<'_>, err: &mut Diag<'_>, kind: Option<rustc_middle::mir::BorrowKind>, f: impl FnOnce(hir::ClosureKind, Span) -> CaptureVarCause, |
