diff options
| author | bors <bors@rust-lang.org> | 2021-09-24 05:29:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-24 05:29:49 +0000 |
| commit | 197fc8591e6b02ac1f359ee0a72616eb4a6d4f4c (patch) | |
| tree | 9383550a3c9d19bc0eed9347c6ffe526917ca5d1 /compiler/rustc_codegen_ssa/src | |
| parent | 293b8f2c11cbec03f0d4daae6b82ed7541ebbf4e (diff) | |
| parent | 9da27f04293853b42080c7ab20e84c1da11ec5d8 (diff) | |
| download | rust-197fc8591e6b02ac1f359ee0a72616eb4a6d4f4c.tar.gz rust-197fc8591e6b02ac1f359ee0a72616eb4a6d4f4c.zip | |
Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank
Disable visible path calculation for PrettyPrinter in Ok path of compiler
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 5aa2a422133..b0a5631549d 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -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(); |
