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
|
@ -5,7 +5,7 @@
|
|||
//! it finds operations that are invalid in a certain context.
|
||||
|
||||
use rustc_attr as attr;
|
||||
use rustc_errors::DiagCtxt;
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::bug;
|
||||
|
@ -46,7 +46,7 @@ impl<'mir, 'tcx> ConstCx<'mir, 'tcx> {
|
|||
ConstCx { body, tcx, param_env, const_kind }
|
||||
}
|
||||
|
||||
pub(crate) fn dcx(&self) -> &'tcx DiagCtxt {
|
||||
pub(crate) fn dcx(&self) -> DiagCtxtHandle<'tcx> {
|
||||
self.tcx.dcx()
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
|||
|
||||
use either::Either;
|
||||
use rustc_errors::{
|
||||
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
codes::*, Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
};
|
||||
use rustc_hir::ConstContext;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
|
@ -453,7 +453,7 @@ pub trait ReportErrorExt {
|
|||
}
|
||||
}
|
||||
|
||||
fn bad_pointer_message(msg: CheckInAllocMsg, dcx: &DiagCtxt) -> String {
|
||||
fn bad_pointer_message(msg: CheckInAllocMsg, dcx: DiagCtxtHandle<'_>) -> String {
|
||||
use crate::fluent_generated::*;
|
||||
|
||||
let msg = match msg {
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{fmt, mem};
|
|||
use either::{Either, Left, Right};
|
||||
use tracing::{debug, info, info_span, instrument, trace};
|
||||
|
||||
use rustc_errors::DiagCtxt;
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_hir::{self as hir, def_id::DefId, definitions::DefPathData};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::mir;
|
||||
|
@ -474,7 +474,7 @@ pub(super) fn from_known_layout<'tcx>(
|
|||
///
|
||||
/// This is NOT the preferred way to render an error; use `report` from `const_eval` instead.
|
||||
/// However, this is useful when error messages appear in ICEs.
|
||||
pub fn format_interp_error<'tcx>(dcx: &DiagCtxt, e: InterpErrorInfo<'tcx>) -> String {
|
||||
pub fn format_interp_error<'tcx>(dcx: DiagCtxtHandle<'_>, e: InterpErrorInfo<'tcx>) -> String {
|
||||
let (e, backtrace) = e.into_parts();
|
||||
backtrace.print_backtrace();
|
||||
// FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue