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
This commit is contained in:
parent
c91edc3888
commit
7ba82d61eb
77 changed files with 363 additions and 328 deletions
|
@ -10,7 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
use rustc_data_structures::owned_slice::OwnedSlice;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{self, FreezeReadGuard, FreezeWriteGuard};
|
||||
use rustc_errors::DiagCtxt;
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_expand::base::SyntaxExtension;
|
||||
use rustc_fs_util::try_canonicalize;
|
||||
use rustc_hir::def_id::{CrateNum, LocalDefId, StableCrateId, LOCAL_CRATE};
|
||||
|
@ -91,7 +91,7 @@ impl<'a, 'tcx> std::ops::Deref for CrateLoader<'a, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
||||
fn dcx(&self) -> &'tcx DiagCtxt {
|
||||
fn dcx(&self) -> DiagCtxtHandle<'tcx> {
|
||||
self.tcx.dcx()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use rustc_errors::{codes::*, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
|
||||
use rustc_errors::{codes::*, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::{sym, Span, Symbol};
|
||||
use rustc_target::spec::{PanicStrategy, TargetTriple};
|
||||
|
@ -503,7 +503,7 @@ pub(crate) struct MultipleCandidates {
|
|||
}
|
||||
|
||||
impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates {
|
||||
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
let mut diag = Diag::new(dcx, level, fluent::metadata_multiple_candidates);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("flavor", self.flavor);
|
||||
|
@ -602,7 +602,7 @@ pub struct InvalidMetadataFiles {
|
|||
|
||||
impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles {
|
||||
#[track_caller]
|
||||
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
let mut diag = Diag::new(dcx, level, fluent::metadata_invalid_meta_files);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("add_info", self.add_info);
|
||||
|
@ -631,7 +631,7 @@ pub struct CannotFindCrate {
|
|||
|
||||
impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
|
||||
#[track_caller]
|
||||
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
let mut diag = Diag::new(dcx, level, fluent::metadata_cannot_find_crate);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
diag.arg("current_crate", self.current_crate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue