Disable visible path calculation for PrettyPrinter in Ok path of compiler
This commit is contained in:
parent
db1fb85cff
commit
9da27f0429
10 changed files with 54 additions and 29 deletions
|
@ -15,7 +15,7 @@ use rustc_index::vec::Idx;
|
|||
use rustc_middle::mir::AssertKind;
|
||||
use rustc_middle::mir::{self, SwitchTargets};
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TypeFoldable};
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_span::{sym, Symbol};
|
||||
|
@ -476,15 +476,20 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false),
|
||||
};
|
||||
if do_panic {
|
||||
let msg_str = with_no_trimmed_paths(|| {
|
||||
if layout.abi.is_uninhabited() {
|
||||
// Use this error even for the other intrinsics as it is more precise.
|
||||
format!("attempted to instantiate uninhabited type `{}`", ty)
|
||||
} else if intrinsic == ZeroValid {
|
||||
format!("attempted to zero-initialize type `{}`, which is invalid", ty)
|
||||
} else {
|
||||
format!("attempted to leave type `{}` uninitialized, which is invalid", ty)
|
||||
}
|
||||
let msg_str = with_no_visible_paths(|| {
|
||||
with_no_trimmed_paths(|| {
|
||||
if layout.abi.is_uninhabited() {
|
||||
// Use this error even for the other intrinsics as it is more precise.
|
||||
format!("attempted to instantiate uninhabited type `{}`", ty)
|
||||
} else if intrinsic == ZeroValid {
|
||||
format!("attempted to zero-initialize type `{}`, which is invalid", ty)
|
||||
} else {
|
||||
format!(
|
||||
"attempted to leave type `{}` uninitialized, which is invalid",
|
||||
ty
|
||||
)
|
||||
}
|
||||
})
|
||||
});
|
||||
let msg = bx.const_str(Symbol::intern(&msg_str));
|
||||
let location = self.get_caller_location(bx, source_info).immediate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue