diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 9bb1f57a52457..c2c7de9d21b28 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -168,7 +168,7 @@ struct LoweringContext<'a, 'hir: 'a> { current_hir_id_owner: Vec<(LocalDefId, u32)>, item_local_id_counters: NodeMap, - node_id_to_hir_id: IndexVec, + node_id_to_hir_id: IndexVec>, allow_try_trait: Option>, allow_gen_future: Option>, @@ -522,7 +522,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } self.lower_node_id(CRATE_NODE_ID); - debug_assert!(self.node_id_to_hir_id[CRATE_NODE_ID] == hir::CRATE_HIR_ID); + debug_assert!(self.node_id_to_hir_id[CRATE_NODE_ID] == Some(hir::CRATE_HIR_ID)); visit::walk_crate(&mut MiscCollector { lctx: &mut self, hir_id_owner: None }, c); visit::walk_crate(&mut item::ItemLowerer { lctx: &mut self }, c); @@ -530,7 +530,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let module = self.lower_mod(&c.module); let attrs = self.lower_attrs(&c.attrs); let body_ids = body_ids(&self.bodies); - let proc_macros = c.proc_macros.iter().map(|id| self.node_id_to_hir_id[*id]).collect(); + let proc_macros = + c.proc_macros.iter().map(|id| self.node_id_to_hir_id[*id].unwrap()).collect(); self.resolver.definitions().init_node_id_to_hir_id_mapping(self.node_id_to_hir_id); @@ -571,26 +572,22 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ast_node_id: NodeId, alloc_hir_id: impl FnOnce(&mut Self) -> hir::HirId, ) -> hir::HirId { - if ast_node_id == DUMMY_NODE_ID { - return hir::DUMMY_HIR_ID; - } + assert_ne!(ast_node_id, DUMMY_NODE_ID); let min_size = ast_node_id.as_usize() + 1; if min_size > self.node_id_to_hir_id.len() { - self.node_id_to_hir_id.resize(min_size, hir::DUMMY_HIR_ID); + self.node_id_to_hir_id.resize(min_size, None); } - let existing_hir_id = self.node_id_to_hir_id[ast_node_id]; - - if existing_hir_id == hir::DUMMY_HIR_ID { + if let Some(existing_hir_id) = self.node_id_to_hir_id[ast_node_id] { + existing_hir_id + } else { // Generate a new `HirId`. let hir_id = alloc_hir_id(self); - self.node_id_to_hir_id[ast_node_id] = hir_id; + self.node_id_to_hir_id[ast_node_id] = Some(hir_id); hir_id - } else { - existing_hir_id } } diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 20e64f0c48851..d58d9b91c73ac 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -12,7 +12,7 @@ use rustc_session::search_paths::PathKind; /// need out of the shared crate context before we get rid of it. use rustc_session::{filesearch, Session}; use rustc_span::symbol::Symbol; -use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel}; +use rustc_target::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelroLevel}; use super::archive::ArchiveBuilder; use super::command::Command; @@ -182,7 +182,9 @@ fn get_linker(sess: &Session, linker: &Path, flavor: LinkerFlavor) -> Command { // To comply with the Windows App Certification Kit, // MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc). let t = &sess.target.target; - if flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" { + if (flavor == LinkerFlavor::Msvc || flavor == LinkerFlavor::Lld(LldFlavor::Link)) + && t.target_vendor == "uwp" + { if let Some(ref tool) = msvc_tool { let original_path = tool.path(); if let Some(ref root_lib_path) = original_path.ancestors().nth(4) { @@ -1530,13 +1532,8 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>( cmd.debuginfo(); // OBJECT-FILES-NO, AUDIT-ORDER - // We want to, by default, prevent the compiler from accidentally leaking in - // any system libraries, so we may explicitly ask linkers to not link to any - // libraries by default. Note that this does not happen for windows because - // windows pulls in some large number of libraries and I couldn't quite - // figure out which subset we wanted. - // - // This is all naturally configurable via the standard methods as well. + // We want to prevent the compiler from accidentally leaking in any system libraries, + // so by default we tell linkers not to link to any default libraries. if !sess.opts.cg.default_linker_libraries.unwrap_or(false) && sess.target.target.options.no_default_libraries { diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 0baa37ae9f1ab..d8c5ddf586f45 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -631,15 +631,7 @@ impl<'a> Linker for MsvcLinker<'a> { } fn no_default_libraries(&mut self) { - // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC - // as there's been trouble in the past of linking the C++ standard - // library required by LLVM. This likely needs to happen one day, but - // in general Windows is also a more controlled environment than - // Unix, so it's not necessarily as critical that this be implemented. - // - // Note that there are also some licensing worries about statically - // linking some libraries which require a specific agreement, so it may - // not ever be possible for us to pass this flag. + self.cmd.arg("/NODEFAULTLIB"); } fn include_path(&mut self, path: &Path) { diff --git a/src/librustc_hir/definitions.rs b/src/librustc_hir/definitions.rs index 58f34787613be..1ac23677d4739 100644 --- a/src/librustc_hir/definitions.rs +++ b/src/librustc_hir/definitions.rs @@ -7,7 +7,6 @@ pub use crate::def_id::DefPathHash; use crate::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir; -use crate::hir_id::DUMMY_HIR_ID; use rustc_ast::ast; use rustc_ast::crate_disambiguator::CrateDisambiguator; @@ -87,7 +86,7 @@ pub struct Definitions { node_id_to_def_id: FxHashMap, def_id_to_node_id: IndexVec, - pub(super) node_id_to_hir_id: IndexVec, + pub(super) node_id_to_hir_id: IndexVec>, /// The reverse mapping of `node_id_to_hir_id`. pub(super) hir_id_to_node_id: FxHashMap, @@ -345,8 +344,7 @@ impl Definitions { #[inline] pub fn as_local_hir_id(&self, def_id: DefId) -> Option { if let Some(def_id) = def_id.as_local() { - let hir_id = self.local_def_id_to_hir_id(def_id); - if hir_id != DUMMY_HIR_ID { Some(hir_id) } else { None } + Some(self.local_def_id_to_hir_id(def_id)) } else { None } @@ -359,11 +357,22 @@ impl Definitions { #[inline] pub fn node_id_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId { + self.node_id_to_hir_id[node_id].unwrap() + } + + #[inline] + pub fn opt_node_id_to_hir_id(&self, node_id: ast::NodeId) -> Option { self.node_id_to_hir_id[node_id] } #[inline] pub fn local_def_id_to_hir_id(&self, id: LocalDefId) -> hir::HirId { + let node_id = self.def_id_to_node_id[id]; + self.node_id_to_hir_id[node_id].unwrap() + } + + #[inline] + pub fn opt_local_def_id_to_hir_id(&self, id: LocalDefId) -> Option { let node_id = self.def_id_to_node_id[id]; self.node_id_to_hir_id[node_id] } @@ -470,7 +479,10 @@ impl Definitions { /// Initializes the `ast::NodeId` to `HirId` mapping once it has been generated during /// AST to HIR lowering. - pub fn init_node_id_to_hir_id_mapping(&mut self, mapping: IndexVec) { + pub fn init_node_id_to_hir_id_mapping( + &mut self, + mapping: IndexVec>, + ) { assert!( self.node_id_to_hir_id.is_empty(), "trying to initialize `NodeId` -> `HirId` mapping twice" @@ -481,7 +493,7 @@ impl Definitions { self.hir_id_to_node_id = self .node_id_to_hir_id .iter_enumerated() - .map(|(node_id, &hir_id)| (hir_id, node_id)) + .filter_map(|(node_id, &hir_id)| hir_id.map(|hir_id| (hir_id, node_id))) .collect(); } diff --git a/src/librustc_hir/hir_id.rs b/src/librustc_hir/hir_id.rs index 1c7987e965f85..d782c3dd70a2c 100644 --- a/src/librustc_hir/hir_id.rs +++ b/src/librustc_hir/hir_id.rs @@ -45,7 +45,4 @@ pub const CRATE_HIR_ID: HirId = HirId { local_id: ItemLocalId::from_u32(0), }; -pub const DUMMY_HIR_ID: HirId = - HirId { owner: LocalDefId { local_def_index: CRATE_DEF_INDEX }, local_id: DUMMY_ITEM_LOCAL_ID }; - pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX; diff --git a/src/librustc_middle/hir/map/collector.rs b/src/librustc_middle/hir/map/collector.rs index 70ea856498de4..2906da437abac 100644 --- a/src/librustc_middle/hir/map/collector.rs +++ b/src/librustc_middle/hir/map/collector.rs @@ -250,23 +250,16 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { None => format!("{:?}", node), }; - let forgot_str = if hir_id == hir::DUMMY_HIR_ID { - format!("\nMaybe you forgot to lower the node id {:?}?", node_id) - } else { - String::new() - }; - span_bug!( span, "inconsistent DepNode at `{:?}` for `{}`: \ - current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}", + current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?})", self.source_map.span_to_string(span), node_str, self.definitions.def_path(self.current_dep_node_owner).to_string_no_crate(), self.current_dep_node_owner, self.definitions.def_path(hir_id.owner).to_string_no_crate(), hir_id.owner, - forgot_str, ) } } diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index 3eaacb54d5b42..ead8529fad8be 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -214,11 +214,21 @@ impl<'hir> Map<'hir> { self.tcx.definitions.node_id_to_hir_id(node_id) } + #[inline] + pub fn opt_node_id_to_hir_id(&self, node_id: NodeId) -> Option { + self.tcx.definitions.opt_node_id_to_hir_id(node_id) + } + #[inline] pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId { self.tcx.definitions.local_def_id_to_hir_id(def_id) } + #[inline] + pub fn opt_local_def_id_to_hir_id(&self, def_id: LocalDefId) -> Option { + self.tcx.definitions.opt_local_def_id_to_hir_id(def_id) + } + pub fn def_kind(&self, hir_id: HirId) -> Option { let node = self.find(hir_id)?; diff --git a/src/librustc_middle/middle/stability.rs b/src/librustc_middle/middle/stability.rs index 46525bdedad35..1dd14b7c4ffda 100644 --- a/src/librustc_middle/middle/stability.rs +++ b/src/librustc_middle/middle/stability.rs @@ -215,7 +215,6 @@ fn late_report_deprecation( suggestion: Option, lint: &'static Lint, span: Span, - def_id: DefId, hir_id: HirId, ) { if span.in_derive_expansion() { @@ -229,9 +228,6 @@ fn late_report_deprecation( } diag.emit() }); - if hir_id == hir::DUMMY_HIR_ID { - span_bug!(span, "emitted a {} lint with dummy HIR id: {:?}", lint.name, def_id); - } } /// Result of `TyCtxt::eval_stability`. @@ -296,7 +292,7 @@ impl<'tcx> TyCtxt<'tcx> { if !skip { let (message, lint) = deprecation_message(&depr_entry.attr, &self.def_path_str(def_id)); - late_report_deprecation(self, &message, None, lint, span, def_id, id); + late_report_deprecation(self, &message, None, lint, span, id); } }; } @@ -319,15 +315,7 @@ impl<'tcx> TyCtxt<'tcx> { if let Some(depr) = &stability.rustc_depr { let (message, lint) = rustc_deprecation_message(depr, &self.def_path_str(def_id)); - late_report_deprecation( - self, - &message, - depr.suggestion, - lint, - span, - def_id, - id, - ); + late_report_deprecation(self, &message, depr.suggestion, lint, span, id); } } } diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index 9fa25a4363789..a49dc105498ed 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -1126,13 +1126,16 @@ impl<'tcx> TyCtxt<'tcx> { let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default(); for (k, v) in resolutions.trait_map { - let hir_id = definitions.node_id_to_hir_id(k); - let map = trait_map.entry(hir_id.owner).or_default(); - let v = v - .into_iter() - .map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id))) - .collect(); - map.insert(hir_id.local_id, StableVec::new(v)); + // FIXME(#71104) Should really be using just `node_id_to_hir_id` but + // some `NodeId` do not seem to have a corresponding HirId. + if let Some(hir_id) = definitions.opt_node_id_to_hir_id(k) { + let map = trait_map.entry(hir_id.owner).or_default(); + let v = v + .into_iter() + .map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id))) + .collect(); + map.insert(hir_id.local_id, StableVec::new(v)); + } } GlobalCtxt { diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index 97cdb32e2cdf7..3f0774767fd7a 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -1,7 +1,7 @@ use super::{error_to_const_error, CompileTimeEvalContext, CompileTimeInterpreter, MemoryExtra}; use crate::interpret::eval_nullary_intrinsic; use crate::interpret::{ - intern_const_alloc_recursive, Allocation, ConstValue, GlobalId, ImmTy, Immediate, InternKind, + intern_const_alloc_recursive, Allocation, ConstValue, GlobalId, Immediate, InternKind, InterpCx, InterpResult, MPlaceTy, MemoryKind, OpTy, RawConst, RefTracking, Scalar, ScalarMaybeUndef, StackPopCleanup, }; @@ -147,25 +147,28 @@ pub(super) fn op_to_const<'tcx>( match immediate { Ok(mplace) => to_const_value(mplace), // see comment on `let try_as_immediate` above - Err(ImmTy { imm: Immediate::Scalar(x), .. }) => match x { - ScalarMaybeUndef::Scalar(s) => ConstValue::Scalar(s), - ScalarMaybeUndef::Undef => to_const_value(op.assert_mem_place(ecx)), + Err(imm) => match *imm { + Immediate::Scalar(x) => match x { + ScalarMaybeUndef::Scalar(s) => ConstValue::Scalar(s), + ScalarMaybeUndef::Undef => to_const_value(op.assert_mem_place(ecx)), + }, + Immediate::ScalarPair(a, b) => { + let (data, start) = match a.not_undef().unwrap() { + Scalar::Ptr(ptr) => { + (ecx.tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id), ptr.offset.bytes()) + } + Scalar::Raw { .. } => ( + ecx.tcx + .intern_const_alloc(Allocation::from_byte_aligned_bytes(b"" as &[u8])), + 0, + ), + }; + let len = b.to_machine_usize(&ecx.tcx.tcx).unwrap(); + let start = start.try_into().unwrap(); + let len: usize = len.try_into().unwrap(); + ConstValue::Slice { data, start, end: start + len } + } }, - Err(ImmTy { imm: Immediate::ScalarPair(a, b), .. }) => { - let (data, start) = match a.not_undef().unwrap() { - Scalar::Ptr(ptr) => { - (ecx.tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id), ptr.offset.bytes()) - } - Scalar::Raw { .. } => ( - ecx.tcx.intern_const_alloc(Allocation::from_byte_aligned_bytes(b"" as &[u8])), - 0, - ), - }; - let len = b.to_machine_usize(&ecx.tcx.tcx).unwrap(); - let start = start.try_into().unwrap(); - let len: usize = len.try_into().unwrap(); - ConstValue::Slice { data, start, end: start + len } - } } } diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs index a1ab9a1c342c1..e53ca6b31bb67 100644 --- a/src/librustc_mir/const_eval/machine.rs +++ b/src/librustc_mir/const_eval/machine.rs @@ -13,8 +13,8 @@ use rustc_middle::mir::AssertMessage; use rustc_span::symbol::Symbol; use crate::interpret::{ - self, AllocId, Allocation, GlobalId, ImmTy, InterpCx, InterpResult, Memory, MemoryKind, OpTy, - PlaceTy, Pointer, Scalar, + self, AllocId, Allocation, Frame, GlobalId, ImmTy, InterpCx, InterpResult, Memory, MemoryKind, + OpTy, PlaceTy, Pointer, Scalar, }; use super::error::*; @@ -342,8 +342,11 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter { } #[inline(always)] - fn stack_push(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { - Ok(()) + fn init_frame_extra( + _ecx: &mut InterpCx<'mir, 'tcx, Self>, + frame: Frame<'mir, 'tcx>, + ) -> InterpResult<'tcx, Frame<'mir, 'tcx>> { + Ok(frame) } fn before_access_global( diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index e0b5f634bf3df..f111eecb9450e 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -159,6 +159,21 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { } } +impl<'mir, 'tcx, Tag> Frame<'mir, 'tcx, Tag> { + pub fn with_extra(self, extra: Extra) -> Frame<'mir, 'tcx, Tag, Extra> { + Frame { + body: self.body, + instance: self.instance, + return_to_block: self.return_to_block, + return_place: self.return_place, + locals: self.locals, + block: self.block, + stmt: self.stmt, + extra, + } + } +} + impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> { /// Return the `SourceInfo` of the current instruction. pub fn current_source_info(&self) -> Option { @@ -586,8 +601,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ::log_settings::settings().indentation += 1; // first push a stack frame so we have access to the local substs - let extra = M::stack_push(self)?; - self.stack.push(Frame { + let pre_frame = Frame { body, block: Some(mir::START_BLOCK), return_to_block, @@ -597,8 +611,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { locals: IndexVec::new(), instance, stmt: 0, - extra, - }); + extra: (), + }; + let frame = M::init_frame_extra(self, pre_frame)?; + self.stack.push(frame); // don't allocate at all for trivial constants if body.local_decls.len() > 1 { @@ -630,6 +646,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { self.frame_mut().locals = locals; } + M::after_stack_push(self)?; info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance); if self.stack.len() > *self.tcx.sess.recursion_limit.get() { @@ -725,16 +742,17 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } // Cleanup: deallocate all locals that are backed by an allocation. - for local in frame.locals { + for local in &frame.locals { self.deallocate_local(local.value)?; } - if M::stack_pop(self, frame.extra, unwinding)? == StackPopJump::NoJump { + let return_place = frame.return_place; + if M::after_stack_pop(self, frame, unwinding)? == StackPopJump::NoJump { // The hook already did everything. // We want to skip the `info!` below, hence early return. return Ok(()); } - // Normal return. + // Normal return, figure out where to jump. if unwinding { // Follow the unwind edge. let unwind = next_block.expect("Encountered StackPopCleanup::None when unwinding!"); @@ -743,7 +761,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // Follow the normal return edge. // Validate the return value. Do this after deallocating so that we catch dangling // references. - if let Some(return_place) = frame.return_place { + if let Some(return_place) = return_place { if M::enforce_validity(self) { // Data got changed, better make sure it matches the type! // It is still possible that the return place held invalid data while diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index dd3803eb96255..8bf8d904cb29e 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -279,13 +279,21 @@ pub trait Machine<'mir, 'tcx>: Sized { Ok(()) } - /// Called immediately before a new stack frame got pushed. - fn stack_push(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx, Self::FrameExtra>; + /// Called immediately before a new stack frame gets pushed. + fn init_frame_extra( + ecx: &mut InterpCx<'mir, 'tcx, Self>, + frame: Frame<'mir, 'tcx, Self::PointerTag>, + ) -> InterpResult<'tcx, Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>>; + + /// Called immediately after a stack frame got pushed and its locals got initialized. + fn after_stack_push(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { + Ok(()) + } - /// Called immediately after a stack frame gets popped - fn stack_pop( + /// Called immediately after a stack frame got popped, but before jumping back to the caller. + fn after_stack_pop( _ecx: &mut InterpCx<'mir, 'tcx, Self>, - _extra: Self::FrameExtra, + _frame: Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>, _unwinding: bool, ) -> InterpResult<'tcx, StackPopJump> { // By default, we do not support unwinding from panics diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 3741f31927e94..893f4c1db7e0a 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -87,7 +87,7 @@ impl<'tcx, Tag> Immediate { // as input for binary and cast operations. #[derive(Copy, Clone, Debug)] pub struct ImmTy<'tcx, Tag = ()> { - pub(crate) imm: Immediate, + imm: Immediate, pub layout: TyAndLayout<'tcx>, } @@ -183,6 +183,11 @@ impl<'tcx, Tag: Copy> ImmTy<'tcx, Tag> { ImmTy { imm: val.into(), layout } } + #[inline] + pub fn from_immediate(imm: Immediate, layout: TyAndLayout<'tcx>) -> Self { + ImmTy { imm, layout } + } + #[inline] pub fn try_from_uint(i: impl Into, layout: TyAndLayout<'tcx>) -> Option { Some(Self::from_scalar(Scalar::try_from_uint(i, layout.size)?, layout)) @@ -424,7 +429,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(OpTy { op, layout }) } - /// Every place can be read from, so we can turn them into an operand + /// Every place can be read from, so we can turn them into an operand. + /// This will definitely return `Indirect` if the place is a `Ptr`, i.e., this + /// will never actually read from memory. #[inline(always)] pub fn place_to_op( &self, diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 828df9a0930f5..9ac4b3551fc43 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -247,7 +247,7 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> { Operand::Immediate(_) if self.layout.is_zst() => { Ok(MPlaceTy::dangling(self.layout, cx)) } - Operand::Immediate(imm) => Err(ImmTy { imm, layout: self.layout }), + Operand::Immediate(imm) => Err(ImmTy::from_immediate(imm, self.layout)), } } diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 2d8551b2bbf1e..49fee1bddcb6d 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -407,7 +407,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let this_receiver_ptr = self.layout_of(receiver_ptr_ty)?.field(self, 0)?; // Adjust receiver argument. args[0] = - OpTy::from(ImmTy { layout: this_receiver_ptr, imm: receiver_place.ptr.into() }); + OpTy::from(ImmTy::from_immediate(receiver_place.ptr.into(), this_receiver_ptr)); trace!("Patched self operand to {:#?}", args[0]); // recurse with concrete function self.eval_fn_call(drop_fn, caller_abi, &args, ret, unwind) @@ -436,10 +436,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { _ => (instance, place), }; - let arg = ImmTy { - imm: place.to_ref(), - layout: self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?, - }; + let arg = ImmTy::from_immediate( + place.to_ref(), + self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?, + ); let ty = self.tcx.mk_unit(); // return type is () let dest = MPlaceTy::dangling(self.layout_of(ty)?, self); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 9a6d5ab34a5ac..80c12a30135ff 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -290,8 +290,11 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine { } #[inline(always)] - fn stack_push(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { - Ok(()) + fn init_frame_extra( + _ecx: &mut InterpCx<'mir, 'tcx, Self>, + frame: Frame<'mir, 'tcx>, + ) -> InterpResult<'tcx, Frame<'mir, 'tcx>> { + Ok(frame) } } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 9579fe1f405ba..71c2e3bf06095 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -835,7 +835,11 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { if self.keep_original { rhs.clone() } else { - let unit = Rvalue::Aggregate(box AggregateKind::Tuple, vec![]); + let unit = Rvalue::Use(Operand::Constant(box Constant { + span: statement.source_info.span, + user_ty: None, + literal: ty::Const::zero_sized(self.tcx, self.tcx.types.unit), + })); mem::replace(rhs, unit) }, statement.source_info, diff --git a/src/librustc_mir_build/build/block.rs b/src/librustc_mir_build/build/block.rs index 8c41554bc85f9..4e8d5e04a6350 100644 --- a/src/librustc_mir_build/build/block.rs +++ b/src/librustc_mir_build/build/block.rs @@ -187,7 +187,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { if destination_ty.is_unit() { // We only want to assign an implicit `()` as the return value of the block if the // block does not diverge. (Otherwise, we may try to assign a unit to a `!`-type.) - this.cfg.push_assign_unit(block, source_info, destination); + this.cfg.push_assign_unit(block, source_info, destination, this.hir.tcx()); } } // Finally, we pop all the let scopes before exiting out from the scope of block diff --git a/src/librustc_mir_build/build/cfg.rs b/src/librustc_mir_build/build/cfg.rs index f5828c4ac1fa1..42e2b242d7726 100644 --- a/src/librustc_mir_build/build/cfg.rs +++ b/src/librustc_mir_build/build/cfg.rs @@ -2,6 +2,7 @@ use crate::build::CFG; use rustc_middle::mir::*; +use rustc_middle::ty::{self, TyCtxt}; impl<'tcx> CFG<'tcx> { crate fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> { @@ -58,12 +59,17 @@ impl<'tcx> CFG<'tcx> { block: BasicBlock, source_info: SourceInfo, place: Place<'tcx>, + tcx: TyCtxt<'tcx>, ) { self.push_assign( block, source_info, place, - Rvalue::Aggregate(box AggregateKind::Tuple, vec![]), + Rvalue::Use(Operand::Constant(box Constant { + span: source_info.span, + user_ty: None, + literal: ty::Const::zero_sized(tcx, tcx.types.unit), + })), ); } diff --git a/src/librustc_mir_build/build/expr/as_rvalue.rs b/src/librustc_mir_build/build/expr/as_rvalue.rs index 20ef763e90cb4..b6f46aab41612 100644 --- a/src/librustc_mir_build/build/expr/as_rvalue.rs +++ b/src/librustc_mir_build/build/expr/as_rvalue.rs @@ -225,7 +225,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => { block = unpack!(this.stmt_expr(block, expr, None)); - block.and(this.unit_rvalue()) + block.and(Rvalue::Use(Operand::Constant(box Constant { + span: expr_span, + user_ty: None, + literal: ty::Const::zero_sized(this.hir.tcx(), this.hir.tcx().types.unit), + }))) } ExprKind::Yield { .. } | ExprKind::Literal { .. } diff --git a/src/librustc_mir_build/build/expr/into.rs b/src/librustc_mir_build/build/expr/into.rs index 6b93755e9da7c..cd5bb738aedf8 100644 --- a/src/librustc_mir_build/build/expr/into.rs +++ b/src/librustc_mir_build/build/expr/into.rs @@ -331,7 +331,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ExprKind::LlvmInlineAsm { .. } | ExprKind::Return { .. } => { unpack!(block = this.stmt_expr(block, expr, None)); - this.cfg.push_assign_unit(block, source_info, destination); + this.cfg.push_assign_unit(block, source_info, destination, this.hir.tcx()); block.unit() } diff --git a/src/librustc_mir_build/build/misc.rs b/src/librustc_mir_build/build/misc.rs index 8f98dd9b70e80..578b862b90543 100644 --- a/src/librustc_mir_build/build/misc.rs +++ b/src/librustc_mir_build/build/misc.rs @@ -32,10 +32,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Operand::Constant(constant) } - crate fn unit_rvalue(&mut self) -> Rvalue<'tcx> { - Rvalue::Aggregate(box AggregateKind::Tuple, vec![]) - } - // Returns a zero literal operand for the appropriate type, works for // bool, char and integers. crate fn zero_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> { diff --git a/src/librustc_mir_build/build/scope.rs b/src/librustc_mir_build/build/scope.rs index 3689e5cb9d8a2..d88cbf9451305 100644 --- a/src/librustc_mir_build/build/scope.rs +++ b/src/librustc_mir_build/build/scope.rs @@ -523,7 +523,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { unpack!(block = self.into(destination, block, value)); self.block_context.pop(); } else { - self.cfg.push_assign_unit(block, source_info, destination) + self.cfg.push_assign_unit(block, source_info, destination, self.hir.tcx()) } } else { assert!(value.is_none(), "`return` and `break` should have a destination"); diff --git a/src/librustc_passes/hir_id_validator.rs b/src/librustc_passes/hir_id_validator.rs index f5611654fc061..1e31b7c74b6f0 100644 --- a/src/librustc_passes/hir_id_validator.rs +++ b/src/librustc_passes/hir_id_validator.rs @@ -143,16 +143,6 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { fn visit_id(&mut self, hir_id: HirId) { let owner = self.owner.expect("no owner"); - if hir_id == hir::DUMMY_HIR_ID { - self.error(|| { - format!( - "HirIdValidator: HirId {:?} is invalid", - self.hir_map.node_to_string(hir_id) - ) - }); - return; - } - if owner != hir_id.owner { self.error(|| { format!( diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 84f041ee9f87c..51e1588c71c42 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -928,7 +928,12 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> { let macro_module_def_id = ty::DefIdTree::parent(self.tcx, self.tcx.hir().local_def_id(md.hir_id)).unwrap(); - let mut module_id = match self.tcx.hir().as_local_hir_id(macro_module_def_id) { + // FIXME(#71104) Should really be using just `as_local_hir_id` but + // some `DefId` do not seem to have a corresponding HirId. + let hir_id = macro_module_def_id + .as_local() + .and_then(|def_id| self.tcx.hir().opt_local_def_id_to_hir_id(def_id)); + let mut module_id = match hir_id { Some(module_id) if self.tcx.hir().is_hir_id_module(module_id) => module_id, // `module_id` doesn't correspond to a `mod`, return early (#63164, #65252). _ => return, diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index f230eeb8fad57..5bfb5aa2440b7 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -2704,14 +2704,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } fn insert_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime, def: Region) { - if lifetime_ref.hir_id == hir::DUMMY_HIR_ID { - span_bug!( - lifetime_ref.span, - "lifetime reference not renumbered, \ - probably a bug in rustc_ast::fold" - ); - } - debug!( "insert_lifetime: {} resolved to {:?} span={:?}", self.tcx.hir().node_to_string(lifetime_ref.hir_id), diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 5b93c73e07ce2..ba2541bc6c3d9 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -225,11 +225,14 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { collector.visit_pat(&arg.pat); for (id, ident, ..) in collector.collected_idents { - let hir_id = self.tcx.hir().node_id_to_hir_id(id); - let typ = match self.save_ctxt.tables.node_type_opt(hir_id) { - Some(s) => s.to_string(), - None => continue, - }; + // FIXME(#71104) Should really be using just `node_id_to_hir_id` but + // some `NodeId` do not seem to have a corresponding HirId. + let hir_id = self.tcx.hir().opt_node_id_to_hir_id(id); + let typ = + match hir_id.and_then(|hir_id| self.save_ctxt.tables.node_type_opt(hir_id)) { + Some(s) => s.to_string(), + None => continue, + }; if !self.span.filter_generated(ident.span) { let id = id_from_node_id(id, &self.save_ctxt); let span = self.span_from_span(ident.span); diff --git a/src/librustc_target/spec/armebv7r_none_eabi.rs b/src/librustc_target/spec/armebv7r_none_eabi.rs index 3a5957892b59c..ebe901e4f274d 100644 --- a/src/librustc_target/spec/armebv7r_none_eabi.rs +++ b/src/librustc_target/spec/armebv7r_none_eabi.rs @@ -1,7 +1,6 @@ // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; -use std::default::Default; pub fn target() -> TargetResult { Ok(Target { diff --git a/src/librustc_target/spec/armebv7r_none_eabihf.rs b/src/librustc_target/spec/armebv7r_none_eabihf.rs index 9f95a1a6f44fc..8652d1051ad05 100644 --- a/src/librustc_target/spec/armebv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armebv7r_none_eabihf.rs @@ -1,7 +1,6 @@ // Targets the Cortex-R4F/R5F processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; -use std::default::Default; pub fn target() -> TargetResult { Ok(Target { diff --git a/src/librustc_target/spec/armv7r_none_eabi.rs b/src/librustc_target/spec/armv7r_none_eabi.rs index 517368e6a23e9..b7fcda63db00b 100644 --- a/src/librustc_target/spec/armv7r_none_eabi.rs +++ b/src/librustc_target/spec/armv7r_none_eabi.rs @@ -1,7 +1,6 @@ // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; -use std::default::Default; pub fn target() -> TargetResult { Ok(Target { diff --git a/src/librustc_target/spec/armv7r_none_eabihf.rs b/src/librustc_target/spec/armv7r_none_eabihf.rs index 6363469d92925..340090fd43b7c 100644 --- a/src/librustc_target/spec/armv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armv7r_none_eabihf.rs @@ -1,7 +1,6 @@ // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; -use std::default::Default; pub fn target() -> TargetResult { Ok(Target { diff --git a/src/librustc_target/spec/dragonfly_base.rs b/src/librustc_target/spec/dragonfly_base.rs index e26d0ae50b26d..c7062e1ca5196 100644 --- a/src/librustc_target/spec/dragonfly_base.rs +++ b/src/librustc_target/spec/dragonfly_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/freebsd_base.rs b/src/librustc_target/spec/freebsd_base.rs index fc252b6d43d26..d2a087ab62f9f 100644 --- a/src/librustc_target/spec/freebsd_base.rs +++ b/src/librustc_target/spec/freebsd_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/fuchsia_base.rs b/src/librustc_target/spec/fuchsia_base.rs index 046388e9be8f4..4060b126cddb7 100644 --- a/src/librustc_target/spec/fuchsia_base.rs +++ b/src/librustc_target/spec/fuchsia_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/src/librustc_target/spec/haiku_base.rs b/src/librustc_target/spec/haiku_base.rs index 1ddab7be180e0..3d7ae6c302d9c 100644 --- a/src/librustc_target/spec/haiku_base.rs +++ b/src/librustc_target/spec/haiku_base.rs @@ -1,5 +1,4 @@ use crate::spec::{RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/src/librustc_target/spec/hermit_base.rs b/src/librustc_target/spec/hermit_base.rs index 3f9dad689fd59..b9f94023e7a79 100644 --- a/src/librustc_target/spec/hermit_base.rs +++ b/src/librustc_target/spec/hermit_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/src/librustc_target/spec/hermit_kernel_base.rs b/src/librustc_target/spec/hermit_kernel_base.rs index 650219c21ac40..1f9b195e2e698 100644 --- a/src/librustc_target/spec/hermit_kernel_base.rs +++ b/src/librustc_target/spec/hermit_kernel_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/src/librustc_target/spec/i686_pc_windows_gnu.rs b/src/librustc_target/spec/i686_pc_windows_gnu.rs index 2091902d7ce21..d12afe5a40bcc 100644 --- a/src/librustc_target/spec/i686_pc_windows_gnu.rs +++ b/src/librustc_target/spec/i686_pc_windows_gnu.rs @@ -1,7 +1,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::windows_base::opts(); + let mut base = super::windows_gnu_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.eliminate_frame_pointer = false; // Required for backtraces diff --git a/src/librustc_target/spec/i686_pc_windows_msvc.rs b/src/librustc_target/spec/i686_pc_windows_msvc.rs index ffb66afc76182..9d0922b8ce5a9 100644 --- a/src/librustc_target/spec/i686_pc_windows_msvc.rs +++ b/src/librustc_target/spec/i686_pc_windows_msvc.rs @@ -1,18 +1,24 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; pub fn target() -> TargetResult { let mut base = super::windows_msvc_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); - // Mark all dynamic libraries and executables as compatible with the larger 4GiB address - // space available to x86 Windows binaries on x86_64. - base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/LARGEADDRESSAWARE".to_string()); - - // Ensure the linker will only produce an image if it can also produce a table of - // the image's safe exception handlers. - // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers - base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/SAFESEH".to_string()); + let pre_link_args_msvc = vec![ + // Mark all dynamic libraries and executables as compatible with the larger 4GiB address + // space available to x86 Windows binaries on x86_64. + "/LARGEADDRESSAWARE".to_string(), + // Ensure the linker will only produce an image if it can also produce a table of + // the image's safe exception handlers. + // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers + "/SAFESEH".to_string(), + ]; + base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend(pre_link_args_msvc.clone()); + base.pre_link_args + .get_mut(&LinkerFlavor::Lld(LldFlavor::Link)) + .unwrap() + .extend(pre_link_args_msvc); Ok(Target { llvm_target: "i686-pc-windows-msvc".to_string(), diff --git a/src/librustc_target/spec/i686_unknown_uefi.rs b/src/librustc_target/spec/i686_unknown_uefi.rs index e299f92fdeb63..221d5f0785cd2 100644 --- a/src/librustc_target/spec/i686_unknown_uefi.rs +++ b/src/librustc_target/spec/i686_unknown_uefi.rs @@ -8,7 +8,7 @@ use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::uefi_base::opts(); + let mut base = super::uefi_msvc_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -23,11 +23,6 @@ pub fn target() -> TargetResult { // arguments, thus giving you access to full MMX/SSE acceleration. base.features = "-mmx,-sse,+soft-float".to_string(); - // UEFI mirrors the calling-conventions used on windows. In case of i686 this means small - // structs will be returned as int. This shouldn't matter much, since the restrictions placed - // by the UEFI specifications forbid any ABI to return structures. - base.abi_return_struct_as_int = true; - // Use -GNU here, because of the reason below: // Background and Problem: // If we use i686-unknown-windows, the LLVM IA32 MSVC generates compiler intrinsic diff --git a/src/librustc_target/spec/i686_uwp_windows_gnu.rs b/src/librustc_target/spec/i686_uwp_windows_gnu.rs index 93f396de0a051..4e582fb8c63ab 100644 --- a/src/librustc_target/spec/i686_uwp_windows_gnu.rs +++ b/src/librustc_target/spec/i686_uwp_windows_gnu.rs @@ -1,7 +1,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::windows_uwp_base::opts(); + let mut base = super::windows_uwp_gnu_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.eliminate_frame_pointer = false; // Required for backtraces diff --git a/src/librustc_target/spec/l4re_base.rs b/src/librustc_target/spec/l4re_base.rs index b712dcae89970..5caad10161d8e 100644 --- a/src/librustc_target/spec/l4re_base.rs +++ b/src/librustc_target/spec/l4re_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; -use std::default::Default; //use std::process::Command; // Use GCC to locate code for crt* libraries from the host, not from L4Re. Note diff --git a/src/librustc_target/spec/linux_base.rs b/src/librustc_target/spec/linux_base.rs index a5d7f8e07c443..52892fc35924e 100644 --- a/src/librustc_target/spec/linux_base.rs +++ b/src/librustc_target/spec/linux_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/linux_kernel_base.rs b/src/librustc_target/spec/linux_kernel_base.rs index fae44836fa821..4a900d1b02cbf 100644 --- a/src/librustc_target/spec/linux_kernel_base.rs +++ b/src/librustc_target/spec/linux_kernel_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 1bc2bf12fad9e..6ff812754aa7d 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -37,7 +37,6 @@ use crate::spec::abi::{lookup as lookup_abi, Abi}; use rustc_serialize::json::{Json, ToJson}; use std::collections::BTreeMap; -use std::default::Default; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::{fmt, io}; @@ -60,18 +59,19 @@ mod l4re_base; mod linux_base; mod linux_kernel_base; mod linux_musl_base; +mod msvc_base; mod netbsd_base; mod openbsd_base; mod redox_base; mod riscv_base; mod solaris_base; mod thumb_base; -mod uefi_base; +mod uefi_msvc_base; mod vxworks_base; mod wasm32_base; -mod windows_base; +mod windows_gnu_base; mod windows_msvc_base; -mod windows_uwp_base; +mod windows_uwp_gnu_base; mod windows_uwp_msvc_base; #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] @@ -309,23 +309,14 @@ macro_rules! supported_targets { } #[cfg(test)] - mod test_json_encode_decode { - use rustc_serialize::json::ToJson; - use super::Target; - $(use super::$module;)+ + mod tests { + mod tests_impl; + // Cannot put this into a separate file without duplication, make an exception. $( - #[test] // `#[test]` - this is hard to put into a separate file, make an exception + #[test] // `#[test]` fn $module() { - // Grab the TargetResult struct. If we successfully retrieved - // a Target, then the test JSON encoding/decoding can run for this - // Target on this testing platform (i.e., checking the iOS targets - // only on a Mac test platform). - let _ = $module::target().map(|original| { - let as_json = original.to_json(); - let parsed = Target::from_json(as_json).unwrap(); - assert_eq!(original, parsed); - }); + tests_impl::test_target(super::$module::target()); } )+ } @@ -538,7 +529,8 @@ pub struct Target { pub arch: String, /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. pub data_layout: String, - /// Linker flavor + /// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed + /// on the command line. pub linker_flavor: LinkerFlavor, /// Optional settings with defaults. pub options: TargetOptions, @@ -566,7 +558,8 @@ pub struct TargetOptions { /// Linker to invoke pub linker: Option, - /// LLD flavor + /// LLD flavor used if `lld` (or `rust-lld`) is specified as a linker + /// without clarifying its flavor in any way. pub lld_flavor: LldFlavor, /// Linker arguments that are passed *before* any user-defined libraries. diff --git a/src/librustc_target/spec/msvc_base.rs b/src/librustc_target/spec/msvc_base.rs new file mode 100644 index 0000000000000..817a322a9e4da --- /dev/null +++ b/src/librustc_target/spec/msvc_base.rs @@ -0,0 +1,35 @@ +use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; + +pub fn opts() -> TargetOptions { + let pre_link_args_msvc = vec![ + // Suppress the verbose logo and authorship debugging output, which would needlessly + // clog any log files. + "/NOLOGO".to_string(), + // Tell the compiler that non-code sections can be marked as non-executable, + // including stack pages. + // UEFI is fully compatible to non-executable data pages. + // In fact, firmware might enforce this, so we better let the linker know about this, + // so it will fail if the compiler ever tries placing code on the stack + // (e.g., trampoline constructs and alike). + "/NXCOMPAT".to_string(), + ]; + let mut pre_link_args = LinkArgs::new(); + pre_link_args.insert(LinkerFlavor::Msvc, pre_link_args_msvc.clone()); + pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc); + + TargetOptions { + executables: true, + is_like_windows: true, + is_like_msvc: true, + // set VSLANG to 1033 can prevent link.exe from using + // language packs, and avoid generating Non-UTF-8 error + // messages if a link error occurred. + link_env: vec![("VSLANG".to_string(), "1033".to_string())], + lld_flavor: LldFlavor::Link, + pre_link_args, + abi_return_struct_as_int: true, + emit_debug_gdb_scripts: false, + + ..Default::default() + } +} diff --git a/src/librustc_target/spec/netbsd_base.rs b/src/librustc_target/spec/netbsd_base.rs index eb359b920463b..95c4749f9c74c 100644 --- a/src/librustc_target/spec/netbsd_base.rs +++ b/src/librustc_target/spec/netbsd_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/openbsd_base.rs b/src/librustc_target/spec/openbsd_base.rs index b66c56e1a7aea..cadd14df69352 100644 --- a/src/librustc_target/spec/openbsd_base.rs +++ b/src/librustc_target/spec/openbsd_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/redox_base.rs b/src/librustc_target/spec/redox_base.rs index 6398fa91f0253..18cafe654d17f 100644 --- a/src/librustc_target/spec/redox_base.rs +++ b/src/librustc_target/spec/redox_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args = LinkArgs::new(); diff --git a/src/librustc_target/spec/solaris_base.rs b/src/librustc_target/spec/solaris_base.rs index 98a2a0fbc9cc1..8d3a3563f4164 100644 --- a/src/librustc_target/spec/solaris_base.rs +++ b/src/librustc_target/spec/solaris_base.rs @@ -1,5 +1,4 @@ use crate::spec::TargetOptions; -use std::default::Default; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/src/librustc_target/spec/tests/tests_impl.rs b/src/librustc_target/spec/tests/tests_impl.rs new file mode 100644 index 0000000000000..4cf186bdd7c1a --- /dev/null +++ b/src/librustc_target/spec/tests/tests_impl.rs @@ -0,0 +1,43 @@ +use super::super::*; + +pub(super) fn test_target(target: TargetResult) { + // Grab the TargetResult struct. If we successfully retrieved + // a Target, then the test JSON encoding/decoding can run for this + // Target on this testing platform (i.e., checking the iOS targets + // only on a Mac test platform). + if let Ok(original) = target { + original.check_consistency(); + let as_json = original.to_json(); + let parsed = Target::from_json(as_json).unwrap(); + assert_eq!(original, parsed); + } +} + +impl Target { + fn check_consistency(&self) { + // Check that LLD with the given flavor is treated identically to the linker it emulates. + // If you target really needs to deviate from the rules below, whitelist it + // and document the reasons. + assert_eq!( + self.linker_flavor == LinkerFlavor::Msvc + || self.linker_flavor == LinkerFlavor::Lld(LldFlavor::Link), + self.options.lld_flavor == LldFlavor::Link, + ); + for args in &[ + &self.options.pre_link_args, + &self.options.pre_link_args_crt, + &self.options.late_link_args, + &self.options.late_link_args_dynamic, + &self.options.late_link_args_static, + &self.options.post_link_args, + ] { + assert_eq!( + args.get(&LinkerFlavor::Msvc), + args.get(&LinkerFlavor::Lld(LldFlavor::Link)), + ); + if args.contains_key(&LinkerFlavor::Msvc) { + assert_eq!(self.options.lld_flavor, LldFlavor::Link); + } + } + } +} diff --git a/src/librustc_target/spec/thumb_base.rs b/src/librustc_target/spec/thumb_base.rs index 99ab996be959d..eca095b594289 100644 --- a/src/librustc_target/spec/thumb_base.rs +++ b/src/librustc_target/spec/thumb_base.rs @@ -28,7 +28,6 @@ // build scripts / gcc flags. use crate::spec::{PanicStrategy, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { // See rust-lang/rfcs#1645 for a discussion about these defaults diff --git a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs index ab0f7791e2cda..21d62d252e09a 100644 --- a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs +++ b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { let mut base = super::windows_msvc_base::opts(); @@ -10,7 +10,12 @@ pub fn target() -> TargetResult { // should be smart enough to insert branch islands only // where necessary, but this is not the observed behavior. // Disabling the LBR optimization works around the issue. - base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/OPT:NOLBR".to_string()); + let pre_link_args_msvc = "/OPT:NOLBR".to_string(); + base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push(pre_link_args_msvc.clone()); + base.pre_link_args + .get_mut(&LinkerFlavor::Lld(LldFlavor::Link)) + .unwrap() + .push(pre_link_args_msvc); // FIXME(jordanrh): use PanicStrategy::Unwind when SEH is // implemented for windows/arm in LLVM diff --git a/src/librustc_target/spec/uefi_base.rs b/src/librustc_target/spec/uefi_base.rs deleted file mode 100644 index d09da9478fb2b..0000000000000 --- a/src/librustc_target/spec/uefi_base.rs +++ /dev/null @@ -1,67 +0,0 @@ -// This defines a base target-configuration for native UEFI systems. The UEFI specification has -// quite detailed sections on the ABI of all the supported target architectures. In almost all -// cases it simply follows what Microsoft Windows does. Hence, whenever in doubt, see the MSDN -// documentation. -// UEFI uses COFF/PE32+ format for binaries. All binaries must be statically linked. No dynamic -// linker is supported. As native to COFF, binaries are position-dependent, but will be relocated -// by the loader if the pre-chosen memory location is already in use. -// UEFI forbids running code on anything but the boot-CPU. No interrupts are allowed other than -// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all -// code runs in the same environment, no process separation is supported. - -use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; -use std::default::Default; - -pub fn opts() -> TargetOptions { - let mut pre_link_args = LinkArgs::new(); - - pre_link_args.insert( - LinkerFlavor::Lld(LldFlavor::Link), - vec![ - // Suppress the verbose logo and authorship debugging output, which would needlessly - // clog any log files. - "/NOLOGO".to_string(), - // UEFI is fully compatible to non-executable data pages. Tell the compiler that - // non-code sections can be marked as non-executable, including stack pages. In fact, - // firmware might enforce this, so we better let the linker know about this, so it - // will fail if the compiler ever tries placing code on the stack (e.g., trampoline - // constructs and alike). - "/NXCOMPAT".to_string(), - // There is no runtime for UEFI targets, prevent them from being linked. UEFI targets - // must be freestanding. - "/nodefaultlib".to_string(), - // Non-standard subsystems have no default entry-point in PE+ files. We have to define - // one. "efi_main" seems to be a common choice amongst other implementations and the - // spec. - "/entry:efi_main".to_string(), - // COFF images have a "Subsystem" field in their header, which defines what kind of - // program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION, - // EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION, - // which is very likely the most common option. Individual projects can override this - // with custom linker flags. - // The subsystem-type only has minor effects on the application. It defines the memory - // regions the application is loaded into (runtime-drivers need to be put into - // reserved areas), as well as whether a return from the entry-point is treated as - // exit (default for applications). - "/subsystem:efi_application".to_string(), - ], - ); - - TargetOptions { - dynamic_linking: false, - executables: true, - disable_redzone: true, - exe_suffix: ".efi".to_string(), - allows_weak_linkage: false, - panic_strategy: PanicStrategy::Abort, - stack_probes: true, - singlethread: true, - emit_debug_gdb_scripts: false, - - linker: Some("rust-lld".to_string()), - lld_flavor: LldFlavor::Link, - pre_link_args, - - ..Default::default() - } -} diff --git a/src/librustc_target/spec/uefi_msvc_base.rs b/src/librustc_target/spec/uefi_msvc_base.rs new file mode 100644 index 0000000000000..3f7c78c8e7d47 --- /dev/null +++ b/src/librustc_target/spec/uefi_msvc_base.rs @@ -0,0 +1,58 @@ +// This defines a base target-configuration for native UEFI systems. The UEFI specification has +// quite detailed sections on the ABI of all the supported target architectures. In almost all +// cases it simply follows what Microsoft Windows does. Hence, whenever in doubt, see the MSDN +// documentation. +// UEFI uses COFF/PE32+ format for binaries. All binaries must be statically linked. No dynamic +// linker is supported. As native to COFF, binaries are position-dependent, but will be relocated +// by the loader if the pre-chosen memory location is already in use. +// UEFI forbids running code on anything but the boot-CPU. No interrupts are allowed other than +// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all +// code runs in the same environment, no process separation is supported. + +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; + +pub fn opts() -> TargetOptions { + let mut base = super::msvc_base::opts(); + + let pre_link_args_msvc = vec![ + // Non-standard subsystems have no default entry-point in PE+ files. We have to define + // one. "efi_main" seems to be a common choice amongst other implementations and the + // spec. + "/entry:efi_main".to_string(), + // COFF images have a "Subsystem" field in their header, which defines what kind of + // program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION, + // EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION, + // which is very likely the most common option. Individual projects can override this + // with custom linker flags. + // The subsystem-type only has minor effects on the application. It defines the memory + // regions the application is loaded into (runtime-drivers need to be put into + // reserved areas), as well as whether a return from the entry-point is treated as + // exit (default for applications). + "/subsystem:efi_application".to_string(), + ]; + base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend(pre_link_args_msvc.clone()); + base.pre_link_args + .get_mut(&LinkerFlavor::Lld(LldFlavor::Link)) + .unwrap() + .extend(pre_link_args_msvc); + + TargetOptions { + disable_redzone: true, + exe_suffix: ".efi".to_string(), + allows_weak_linkage: false, + panic_strategy: PanicStrategy::Abort, + stack_probes: true, + singlethread: true, + linker: Some("rust-lld".to_string()), + // FIXME: This should likely be `true` inherited from `msvc_base` + // because UEFI follows Windows ABI and uses PE/COFF. + // The `false` is probably causing ABI bugs right now. + is_like_windows: false, + // FIXME: This should likely be `true` inherited from `msvc_base` + // because UEFI follows Windows ABI and uses PE/COFF. + // The `false` is probably causing ABI bugs right now. + is_like_msvc: false, + + ..base + } +} diff --git a/src/librustc_target/spec/vxworks_base.rs b/src/librustc_target/spec/vxworks_base.rs index 1763c9139b1bf..1b25c51278d4a 100644 --- a/src/librustc_target/spec/vxworks_base.rs +++ b/src/librustc_target/spec/vxworks_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut args_crt = LinkArgs::new(); diff --git a/src/librustc_target/spec/windows_base.rs b/src/librustc_target/spec/windows_gnu_base.rs similarity index 99% rename from src/librustc_target/spec/windows_base.rs rename to src/librustc_target/spec/windows_gnu_base.rs index 097ee09f1ea8c..33ecb1d0d48ce 100644 --- a/src/librustc_target/spec/windows_base.rs +++ b/src/librustc_target/spec/windows_gnu_base.rs @@ -1,5 +1,4 @@ use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/src/librustc_target/spec/windows_msvc_base.rs b/src/librustc_target/spec/windows_msvc_base.rs index 52b166df93996..77171f8672e8a 100644 --- a/src/librustc_target/spec/windows_msvc_base.rs +++ b/src/librustc_target/spec/windows_msvc_base.rs @@ -1,36 +1,30 @@ -use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; -use std::default::Default; +use crate::spec::TargetOptions; pub fn opts() -> TargetOptions { - let pre_args = vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()]; - let mut args = LinkArgs::new(); - args.insert(LinkerFlavor::Msvc, pre_args.clone()); - args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_args); + let base = super::msvc_base::opts(); TargetOptions { - function_sections: true, dynamic_linking: true, - executables: true, dll_prefix: String::new(), dll_suffix: ".dll".to_string(), exe_suffix: ".exe".to_string(), staticlib_prefix: String::new(), staticlib_suffix: ".lib".to_string(), target_family: Some("windows".to_string()), - is_like_windows: true, - is_like_msvc: true, - // set VSLANG to 1033 can prevent link.exe from using - // language packs, and avoid generating Non-UTF-8 error - // messages if a link error occurred. - link_env: vec![("VSLANG".to_string(), "1033".to_string())], - lld_flavor: LldFlavor::Link, - pre_link_args: args, crt_static_allows_dylibs: true, crt_static_respected: true, - abi_return_struct_as_int: true, - emit_debug_gdb_scripts: false, requires_uwtable: true, + // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC + // as there's been trouble in the past of linking the C++ standard + // library required by LLVM. This likely needs to happen one day, but + // in general Windows is also a more controlled environment than + // Unix, so it's not necessarily as critical that this be implemented. + // + // Note that there are also some licensing worries about statically + // linking some libraries which require a specific agreement, so it may + // not ever be possible for us to pass this flag. + no_default_libraries: false, - ..Default::default() + ..base } } diff --git a/src/librustc_target/spec/windows_uwp_base.rs b/src/librustc_target/spec/windows_uwp_gnu_base.rs similarity index 60% rename from src/librustc_target/spec/windows_uwp_base.rs rename to src/librustc_target/spec/windows_uwp_gnu_base.rs index f19bd10dc0bbd..dd3b60344be22 100644 --- a/src/librustc_target/spec/windows_uwp_base.rs +++ b/src/librustc_target/spec/windows_uwp_gnu_base.rs @@ -1,7 +1,9 @@ use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; pub fn opts() -> TargetOptions { + let base = super::windows_gnu_base::opts(); + + // FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`. let mut pre_link_args = LinkArgs::new(); pre_link_args.insert( LinkerFlavor::Gcc, @@ -14,7 +16,10 @@ pub fn opts() -> TargetOptions { ], ); + // FIXME: This should be updated for the exception machinery changes from #67502. let mut late_link_args = LinkArgs::new(); + let late_link_args_dynamic = LinkArgs::new(); + let late_link_args_static = LinkArgs::new(); late_link_args.insert( LinkerFlavor::Gcc, vec![ @@ -33,31 +38,17 @@ pub fn opts() -> TargetOptions { ); TargetOptions { - // FIXME(#13846) this should be enabled for windows - function_sections: false, - linker: Some("gcc".to_string()), - dynamic_linking: true, executables: false, - dll_prefix: String::new(), - dll_suffix: ".dll".to_string(), - exe_suffix: ".exe".to_string(), - staticlib_prefix: "lib".to_string(), - staticlib_suffix: ".a".to_string(), - target_family: Some("windows".to_string()), - is_like_windows: true, - allows_weak_linkage: false, + limit_rdylib_exports: false, pre_link_args, - pre_link_objects_exe: vec![ - "rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs - ], + // FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`. + pre_link_objects_exe: vec!["rsbegin.o".to_string()], + // FIXME: Consider adding `-nostdlib` and inheriting from `windows_gnu_base`. pre_link_objects_dll: vec!["rsbegin.o".to_string()], late_link_args, - post_link_objects: vec!["rsend.o".to_string()], - abi_return_struct_as_int: true, - emit_debug_gdb_scripts: false, - requires_uwtable: true, - limit_rdylib_exports: false, + late_link_args_dynamic, + late_link_args_static, - ..Default::default() + ..base } } diff --git a/src/librustc_target/spec/windows_uwp_msvc_base.rs b/src/librustc_target/spec/windows_uwp_msvc_base.rs index 3d639b6b628b3..04ffa1a0addbe 100644 --- a/src/librustc_target/spec/windows_uwp_msvc_base.rs +++ b/src/librustc_target/spec/windows_uwp_msvc_base.rs @@ -1,37 +1,14 @@ -use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; +use crate::spec::{LinkerFlavor, LldFlavor, TargetOptions}; pub fn opts() -> TargetOptions { - let mut args = LinkArgs::new(); - args.insert( - LinkerFlavor::Msvc, - vec![ - "/NOLOGO".to_string(), - "/NXCOMPAT".to_string(), - "/APPCONTAINER".to_string(), - "mincore.lib".to_string(), - ], - ); + let mut opts = super::windows_msvc_base::opts(); - TargetOptions { - function_sections: true, - dynamic_linking: true, - executables: true, - dll_prefix: String::new(), - dll_suffix: ".dll".to_string(), - exe_suffix: ".exe".to_string(), - staticlib_prefix: String::new(), - staticlib_suffix: ".lib".to_string(), - target_family: Some("windows".to_string()), - is_like_windows: true, - is_like_msvc: true, - pre_link_args: args, - crt_static_allows_dylibs: true, - crt_static_respected: true, - abi_return_struct_as_int: true, - emit_debug_gdb_scripts: false, - requires_uwtable: true, + let pre_link_args_msvc = vec!["/APPCONTAINER".to_string(), "mincore.lib".to_string()]; + opts.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().extend(pre_link_args_msvc.clone()); + opts.pre_link_args + .get_mut(&LinkerFlavor::Lld(LldFlavor::Link)) + .unwrap() + .extend(pre_link_args_msvc); - ..Default::default() - } + opts } diff --git a/src/librustc_target/spec/x86_64_pc_windows_gnu.rs b/src/librustc_target/spec/x86_64_pc_windows_gnu.rs index 3d3acc682dea4..eb97fa56814d8 100644 --- a/src/librustc_target/spec/x86_64_pc_windows_gnu.rs +++ b/src/librustc_target/spec/x86_64_pc_windows_gnu.rs @@ -1,7 +1,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::windows_base::opts(); + let mut base = super::windows_gnu_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); diff --git a/src/librustc_target/spec/x86_64_unknown_uefi.rs b/src/librustc_target/spec/x86_64_unknown_uefi.rs index 7660b68aae62e..12edc29330a49 100644 --- a/src/librustc_target/spec/x86_64_unknown_uefi.rs +++ b/src/librustc_target/spec/x86_64_unknown_uefi.rs @@ -8,7 +8,7 @@ use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::uefi_base::opts(); + let mut base = super::uefi_msvc_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -28,11 +28,6 @@ pub fn target() -> TargetResult { // places no locality-restrictions, so it fits well here. base.code_model = Some("large".to_string()); - // UEFI mirrors the calling-conventions used on windows. In case of x86-64 this means small - // structs will be returned as int. This shouldn't matter much, since the restrictions placed - // by the UEFI specifications forbid any ABI to return structures. - base.abi_return_struct_as_int = true; - Ok(Target { llvm_target: "x86_64-unknown-windows".to_string(), target_endian: "little".to_string(), diff --git a/src/librustc_target/spec/x86_64_uwp_windows_gnu.rs b/src/librustc_target/spec/x86_64_uwp_windows_gnu.rs index 48366e24a39e4..ad6002f6b89e4 100644 --- a/src/librustc_target/spec/x86_64_uwp_windows_gnu.rs +++ b/src/librustc_target/spec/x86_64_uwp_windows_gnu.rs @@ -1,7 +1,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { - let mut base = super::windows_uwp_base::opts(); + let mut base = super::windows_uwp_gnu_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 9b1c8b9a9c83e..3f159fe5e3029 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -865,9 +865,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { &mut self, expr_hir_id: hir::HirId, ) -> Result<(), MethodError<'tcx>> { - if expr_hir_id == hir::DUMMY_HIR_ID { - return Ok(()); - } let mut duplicates = FxHashSet::default(); let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id); if let Some(applicable_traits) = opt_applicable_traits { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3aff70390fadc..ca6bd21fefd39 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -838,7 +838,11 @@ fn has_typeck_tables(tcx: TyCtxt<'_>, def_id: DefId) -> bool { return tcx.has_typeck_tables(outer_def_id); } - if let Some(id) = tcx.hir().as_local_hir_id(def_id) { + // FIXME(#71104) Should really be using just `as_local_hir_id` but + // some `LocalDefId` do not seem to have a corresponding HirId. + if let Some(id) = + def_id.as_local().and_then(|def_id| tcx.hir().opt_local_def_id_to_hir_id(def_id)) + { primary_body_of(tcx, id).is_some() } else { false diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0f52feda2a303..6e50264c098b6 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -375,18 +375,16 @@ impl<'tcx> Clean>> for InternalSubsts<'tcx> { impl Clean for hir::Lifetime { fn clean(&self, cx: &DocContext<'_>) -> Lifetime { - if self.hir_id != hir::DUMMY_HIR_ID { - let def = cx.tcx.named_region(self.hir_id); - match def { - Some(rl::Region::EarlyBound(_, node_id, _)) - | Some(rl::Region::LateBound(_, node_id, _)) - | Some(rl::Region::Free(_, node_id)) => { - if let Some(lt) = cx.lt_substs.borrow().get(&node_id).cloned() { - return lt; - } + let def = cx.tcx.named_region(self.hir_id); + match def { + Some(rl::Region::EarlyBound(_, node_id, _)) + | Some(rl::Region::LateBound(_, node_id, _)) + | Some(rl::Region::Free(_, node_id)) => { + if let Some(lt) = cx.lt_substs.borrow().get(&node_id).cloned() { + return lt; } - _ => {} } + _ => {} } Lifetime(self.name.ident().to_string()) } diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 9e96015d306e4..316cf84152842 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -580,11 +580,7 @@ pub fn print_const_expr(cx: &DocContext<'_>, body: hir::BodyId) -> String { /// Given a type Path, resolve it to a Type using the TyCtxt pub fn resolve_type(cx: &DocContext<'_>, path: Path, id: hir::HirId) -> Type { - if id == hir::DUMMY_HIR_ID { - debug!("resolve_type({:?})", path); - } else { - debug!("resolve_type({:?},{:?})", path, id); - } + debug!("resolve_type({:?},{:?})", path, id); let is_generic = match path.res { Res::PrimTy(p) => return Primitive(PrimitiveType::from(p)), diff --git a/src/test/mir-opt/address-of/rustc.address_of_reborrow.SimplifyCfg-initial.after.mir b/src/test/mir-opt/address-of/rustc.address_of_reborrow.SimplifyCfg-initial.after.mir index af07da4cfe0a8..d0b5c401beaba 100644 --- a/src/test/mir-opt/address-of/rustc.address_of_reborrow.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/address-of/rustc.address_of_reborrow.SimplifyCfg-initial.after.mir @@ -298,7 +298,13 @@ fn address_of_reborrow() -> () { StorageDead(_48); // bb0[157]: scope 13 at $DIR/address-of.rs:36:25: 36:26 FakeRead(ForLet, _47); // bb0[158]: scope 13 at $DIR/address-of.rs:36:9: 36:10 AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] }); // bb0[159]: scope 13 at $DIR/address-of.rs:36:12: 36:22 - _0 = (); // bb0[160]: scope 0 at $DIR/address-of.rs:3:26: 37:2 + _0 = const (); // bb0[160]: scope 0 at $DIR/address-of.rs:3:26: 37:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/address-of.rs:3:26: 37:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_47); // bb0[161]: scope 13 at $DIR/address-of.rs:37:1: 37:2 StorageDead(_45); // bb0[162]: scope 12 at $DIR/address-of.rs:37:1: 37:2 StorageDead(_44); // bb0[163]: scope 11 at $DIR/address-of.rs:37:1: 37:2 diff --git a/src/test/mir-opt/address-of/rustc.borrow_and_cast.SimplifyCfg-initial.after.mir b/src/test/mir-opt/address-of/rustc.borrow_and_cast.SimplifyCfg-initial.after.mir index 29ccff492027a..0ed76f230fda2 100644 --- a/src/test/mir-opt/address-of/rustc.borrow_and_cast.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/address-of/rustc.borrow_and_cast.SimplifyCfg-initial.after.mir @@ -38,7 +38,13 @@ fn borrow_and_cast(_1: i32) -> () { _6 = &raw mut (*_7); // bb0[15]: scope 2 at $DIR/address-of.rs:44:13: 44:19 FakeRead(ForLet, _6); // bb0[16]: scope 2 at $DIR/address-of.rs:44:9: 44:10 StorageDead(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:44:31: 44:32 - _0 = (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2 + _0 = const (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/address-of.rs:41:32: 45:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_6); // bb0[19]: scope 2 at $DIR/address-of.rs:45:1: 45:2 StorageDead(_4); // bb0[20]: scope 1 at $DIR/address-of.rs:45:1: 45:2 StorageDead(_2); // bb0[21]: scope 0 at $DIR/address-of.rs:45:1: 45:2 diff --git a/src/test/mir-opt/array-index-is-temporary/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/array-index-is-temporary/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir index 0016cebbb4c06..217d080be4fd9 100644 --- a/src/test/mir-opt/array-index-is-temporary/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/array-index-is-temporary/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -82,7 +82,13 @@ fn main() -> () { _1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29 StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29 StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30 - _0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2 + _0 = const (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/array-index-is-temporary.rs:12:11: 17:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2 StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2 StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2 diff --git a/src/test/mir-opt/array-index-is-temporary/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/array-index-is-temporary/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir index a004ab4a06aed..c75acef2a27b0 100644 --- a/src/test/mir-opt/array-index-is-temporary/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/array-index-is-temporary/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -82,7 +82,13 @@ fn main() -> () { _1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29 StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29 StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30 - _0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2 + _0 = const (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/array-index-is-temporary.rs:12:11: 17:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2 StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2 StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2 diff --git a/src/test/mir-opt/basic_assignment/rustc.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/basic_assignment/rustc.main.SimplifyCfg-initial.after.mir index a3f4573964c3d..86ee1be6f7404 100644 --- a/src/test/mir-opt/basic_assignment/rustc.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/basic_assignment/rustc.main.SimplifyCfg-initial.after.mir @@ -72,7 +72,13 @@ fn main() -> () { bb6: { StorageDead(_6); // bb6[0]: scope 4 at $DIR/basic_assignment.rs:23:19: 23:20 - _0 = (); // bb6[1]: scope 0 at $DIR/basic_assignment.rs:10:11: 24:2 + _0 = const (); // bb6[1]: scope 0 at $DIR/basic_assignment.rs:10:11: 24:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/basic_assignment.rs:10:11: 24:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_5) -> [return: bb7, unwind: bb3]; // bb6[2]: scope 3 at $DIR/basic_assignment.rs:24:1: 24:2 } diff --git a/src/test/mir-opt/box_expr/rustc.main.ElaborateDrops.before.mir b/src/test/mir-opt/box_expr/rustc.main.ElaborateDrops.before.mir index 61986535dd3f9..aef0da9d6f098 100644 --- a/src/test/mir-opt/box_expr/rustc.main.ElaborateDrops.before.mir +++ b/src/test/mir-opt/box_expr/rustc.main.ElaborateDrops.before.mir @@ -53,7 +53,13 @@ fn main() -> () { bb5: { StorageDead(_4); // bb5[0]: scope 1 at $DIR/box_expr.rs:8:11: 8:12 StorageDead(_3); // bb5[1]: scope 1 at $DIR/box_expr.rs:8:12: 8:13 - _0 = (); // bb5[2]: scope 0 at $DIR/box_expr.rs:6:11: 9:2 + _0 = const (); // bb5[2]: scope 0 at $DIR/box_expr.rs:6:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/box_expr.rs:6:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_1) -> bb8; // bb5[3]: scope 0 at $DIR/box_expr.rs:9:1: 9:2 } diff --git a/src/test/mir-opt/byte_slice/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/byte_slice/rustc.main.SimplifyCfg-elaborate-drops.after.mir index 14be9c990bd50..84f4e5bfd633e 100644 --- a/src/test/mir-opt/byte_slice/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/byte_slice/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -34,7 +34,13 @@ fn main() -> () { // mir::Constant // + span: $DIR/byte_slice.rs:6:19: 6:23 // + literal: Const { ty: u8, val: Value(Scalar(0x78)) } - _0 = (); // bb0[4]: scope 0 at $DIR/byte_slice.rs:4:11: 7:2 + _0 = const (); // bb0[4]: scope 0 at $DIR/byte_slice.rs:4:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/byte_slice.rs:4:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb0[5]: scope 1 at $DIR/byte_slice.rs:7:1: 7:2 StorageDead(_1); // bb0[6]: scope 0 at $DIR/byte_slice.rs:7:1: 7:2 return; // bb0[7]: scope 0 at $DIR/byte_slice.rs:7:2: 7:2 diff --git a/src/test/mir-opt/const_allocation/32bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation/32bit/rustc.main.ConstProp.after.mir index 5880672450878..2247b8e155a4b 100644 --- a/src/test/mir-opt/const_allocation/32bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation/32bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation.rs:7:11: 9:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation.rs:7:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation.rs:7:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/const_allocation/64bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation/64bit/rustc.main.ConstProp.after.mir index b60d23aa3f117..d6cca185ab0f7 100644 --- a/src/test/mir-opt/const_allocation/64bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation/64bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation.rs:7:11: 9:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation.rs:7:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation.rs:7:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/const_allocation2/32bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation2/32bit/rustc.main.ConstProp.after.mir index 6caecf1eceac0..4105d673218a0 100644 --- a/src/test/mir-opt/const_allocation2/32bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation2/32bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation2.rs:4:11: 6:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation2.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation2.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation2.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir index 52e7c2aec2b12..e61f0a8b69fa7 100644 --- a/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation2/64bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation2.rs:4:11: 6:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation2.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation2.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation2.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_allocation3/32bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation3/32bit/rustc.main.ConstProp.after.mir index 4fc2c4c3fb3dd..323134553c195 100644 --- a/src/test/mir-opt/const_allocation3/32bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation3/32bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation3.rs:4:11: 6:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation3.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation3.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation3.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_allocation3/64bit/rustc.main.ConstProp.after.mir b/src/test/mir-opt/const_allocation3/64bit/rustc.main.ConstProp.after.mir index ae5ebe7043706..952fe8336cd0e 100644 --- a/src/test/mir-opt/const_allocation3/64bit/rustc.main.ConstProp.after.mir +++ b/src/test/mir-opt/const_allocation3/64bit/rustc.main.ConstProp.after.mir @@ -18,7 +18,13 @@ fn main() -> () { _1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9 StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9 - _0 = (); // bb0[6]: scope 0 at $DIR/const_allocation3.rs:4:11: 6:2 + _0 = const (); // bb0[6]: scope 0 at $DIR/const_allocation3.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_allocation3.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[7]: scope 0 at $DIR/const_allocation3.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/aggregate/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/aggregate/rustc.main.ConstProp.diff index d20019287b08c..50e6cfc37eea3 100644 --- a/src/test/mir-opt/const_prop/aggregate/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/aggregate/rustc.main.ConstProp.diff @@ -54,7 +54,13 @@ + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageDead(_2); // bb0[6]: scope 0 at $DIR/aggregate.rs:5:27: 5:28 StorageDead(_3); // bb0[7]: scope 0 at $DIR/aggregate.rs:5:28: 5:29 - _0 = (); // bb0[8]: scope 0 at $DIR/aggregate.rs:4:11: 6:2 + _0 = const (); // bb0[8]: scope 0 at $DIR/aggregate.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/aggregate.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb0[9]: scope 0 at $DIR/aggregate.rs:6:1: 6:2 return; // bb0[10]: scope 0 at $DIR/aggregate.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/const_prop/array_index/32bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/array_index/32bit/rustc.main.ConstProp.diff index 99d79b23e9e60..474d50100b03a 100644 --- a/src/test/mir-opt/const_prop/array_index/32bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/array_index/32bit/rustc.main.ConstProp.diff @@ -84,7 +84,13 @@ + // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34 StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34 - _0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2 + _0 = const (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/array_index.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2 return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/const_prop/array_index/64bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/array_index/64bit/rustc.main.ConstProp.diff index 629ca226f2ad6..b3d353bd48780 100644 --- a/src/test/mir-opt/const_prop/array_index/64bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/array_index/64bit/rustc.main.ConstProp.diff @@ -84,7 +84,13 @@ + // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34 StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34 - _0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2 + _0 = const (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/array_index.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2 return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff index 50ee2abecfe45..bf5aff0cf4699 100644 --- a/src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff @@ -44,7 +44,13 @@ bb2: { StorageDead(_3); // bb2[0]: scope 0 at $DIR/boxes.rs:12:26: 12:27 - _0 = (); // bb2[1]: scope 0 at $DIR/boxes.rs:11:11: 13:2 + _0 = const (); // bb2[1]: scope 0 at $DIR/boxes.rs:11:11: 13:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/boxes.rs:11:11: 13:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb2[2]: scope 0 at $DIR/boxes.rs:13:1: 13:2 return; // bb2[3]: scope 0 at $DIR/boxes.rs:13:2: 13:2 } diff --git a/src/test/mir-opt/const_prop/cast/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/cast/rustc.main.ConstProp.diff index ee6a0e87b12fc..ca0a309b1b5df 100644 --- a/src/test/mir-opt/const_prop/cast/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/cast/rustc.main.ConstProp.diff @@ -39,7 +39,13 @@ + // mir::Constant + // + span: $DIR/cast.rs:6:13: 6:24 + // + literal: Const { ty: u8, val: Value(Scalar(0x2a)) } - _0 = (); // bb0[4]: scope 0 at $DIR/cast.rs:3:11: 7:2 + _0 = const (); // bb0[4]: scope 0 at $DIR/cast.rs:3:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/cast.rs:3:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb0[5]: scope 1 at $DIR/cast.rs:7:1: 7:2 StorageDead(_1); // bb0[6]: scope 0 at $DIR/cast.rs:7:1: 7:2 return; // bb0[7]: scope 0 at $DIR/cast.rs:7:2: 7:2 diff --git a/src/test/mir-opt/const_prop/checked_add/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/checked_add/rustc.main.ConstProp.diff index 0a0a4ff852f0f..762927575f0f3 100644 --- a/src/test/mir-opt/const_prop/checked_add/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/checked_add/rustc.main.ConstProp.diff @@ -51,7 +51,13 @@ + // mir::Constant + // + span: $DIR/checked_add.rs:5:18: 5:23 + // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } - _0 = (); // bb1[1]: scope 0 at $DIR/checked_add.rs:4:11: 6:2 + _0 = const (); // bb1[1]: scope 0 at $DIR/checked_add.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/checked_add.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[2]: scope 0 at $DIR/checked_add.rs:6:1: 6:2 return; // bb1[3]: scope 0 at $DIR/checked_add.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/const_prop_fails_gracefully/rustc.main.ConstProp.diff index f4a5b64f0d932..d3a6105a85225 100644 --- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/const_prop_fails_gracefully/rustc.main.ConstProp.diff @@ -42,7 +42,13 @@ bb1: { StorageDead(_5); // bb1[0]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:11: 8:12 StorageDead(_4); // bb1[1]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:12: 8:13 - _0 = (); // bb1[2]: scope 0 at $DIR/const_prop_fails_gracefully.rs:5:11: 9:2 + _0 = const (); // bb1[2]: scope 0 at $DIR/const_prop_fails_gracefully.rs:5:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/const_prop_fails_gracefully.rs:5:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[3]: scope 0 at $DIR/const_prop_fails_gracefully.rs:9:1: 9:2 return; // bb1[4]: scope 0 at $DIR/const_prop_fails_gracefully.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.ConstProp.diff index c551bd77d4078..cbda5e4ef864a 100644 --- a/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.ConstProp.diff @@ -29,7 +29,13 @@ } bb1: { - _0 = (); // bb1[0]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 + _0 = const (); // bb1[0]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/control-flow-simplification.rs:12:5: 14:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[1]: scope 0 at $DIR/control-flow-simplification.rs:15:1: 15:2 return; // bb1[2]: scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 } diff --git a/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.PreCodegen.before.mir b/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.PreCodegen.before.mir index 53296f8714b08..73922b5666905 100644 --- a/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.PreCodegen.before.mir +++ b/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.PreCodegen.before.mir @@ -4,6 +4,13 @@ fn hello() -> () { let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 bb0: { - return; // bb0[0]: scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 + _0 = const (); // bb0[0]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/control-flow-simplification.rs:12:5: 14:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + return; // bb0[1]: scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 } } diff --git a/src/test/mir-opt/const_prop/discriminant/32bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/discriminant/32bit/rustc.main.ConstProp.diff index 7423a3cd38d35..f89d869cab504 100644 --- a/src/test/mir-opt/const_prop/discriminant/32bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/discriminant/32bit/rustc.main.ConstProp.diff @@ -87,7 +87,13 @@ // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68 StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69 - _0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2 + _0 = const (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/discriminant.rs:5:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2 return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2 } diff --git a/src/test/mir-opt/const_prop/discriminant/64bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/discriminant/64bit/rustc.main.ConstProp.diff index 60d18cdc9421f..06f43db50f486 100644 --- a/src/test/mir-opt/const_prop/discriminant/64bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/discriminant/64bit/rustc.main.ConstProp.diff @@ -87,7 +87,13 @@ // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68 StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69 - _0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2 + _0 = const (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/discriminant.rs:5:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2 return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2 } diff --git a/src/test/mir-opt/const_prop/indirect/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/indirect/rustc.main.ConstProp.diff index ca3e3bb5d2de0..4c80d0d127844 100644 --- a/src/test/mir-opt/const_prop/indirect/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/indirect/rustc.main.ConstProp.diff @@ -62,7 +62,13 @@ + // + span: $DIR/indirect.rs:5:13: 5:29 + // + literal: Const { ty: u8, val: Value(Scalar(0x03)) } StorageDead(_2); // bb1[1]: scope 0 at $DIR/indirect.rs:5:28: 5:29 - _0 = (); // bb1[2]: scope 0 at $DIR/indirect.rs:4:11: 6:2 + _0 = const (); // bb1[2]: scope 0 at $DIR/indirect.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/indirect.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[3]: scope 0 at $DIR/indirect.rs:6:1: 6:2 return; // bb1[4]: scope 0 at $DIR/indirect.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/const_prop/issue-66971/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/issue-66971/rustc.main.ConstProp.diff index d3ebaa0a6329f..76c6759f700ad 100644 --- a/src/test/mir-opt/const_prop/issue-66971/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/issue-66971/rustc.main.ConstProp.diff @@ -45,7 +45,13 @@ bb1: { StorageDead(_2); // bb1[0]: scope 0 at $DIR/issue-66971.rs:16:22: 16:23 StorageDead(_1); // bb1[1]: scope 0 at $DIR/issue-66971.rs:16:23: 16:24 - _0 = (); // bb1[2]: scope 0 at $DIR/issue-66971.rs:15:11: 17:2 + _0 = const (); // bb1[2]: scope 0 at $DIR/issue-66971.rs:15:11: 17:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-66971.rs:15:11: 17:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[3]: scope 0 at $DIR/issue-66971.rs:17:2: 17:2 } } diff --git a/src/test/mir-opt/const_prop/issue-67019/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/issue-67019/rustc.main.ConstProp.diff index 96a20edd91aaa..05e1a615953ae 100644 --- a/src/test/mir-opt/const_prop/issue-67019/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/issue-67019/rustc.main.ConstProp.diff @@ -40,7 +40,13 @@ bb1: { StorageDead(_2); // bb1[0]: scope 0 at $DIR/issue-67019.rs:11:19: 11:20 StorageDead(_1); // bb1[1]: scope 0 at $DIR/issue-67019.rs:11:20: 11:21 - _0 = (); // bb1[2]: scope 0 at $DIR/issue-67019.rs:10:11: 12:2 + _0 = const (); // bb1[2]: scope 0 at $DIR/issue-67019.rs:10:11: 12:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-67019.rs:10:11: 12:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[3]: scope 0 at $DIR/issue-67019.rs:12:2: 12:2 } } diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.ConstProp.diff index 41ffedf06bc98..2868365e9ac8e 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.ConstProp.diff @@ -171,7 +171,13 @@ + // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38 + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39 - _0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + _0 = const (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.SimplifyLocals.after.mir b/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.SimplifyLocals.after.mir index db4d2d137927c..5e2a8af060be8 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.SimplifyLocals.after.mir +++ b/src/test/mir-opt/const_prop/optimizes_into_variable/32bit/rustc.main.SimplifyLocals.after.mir @@ -80,9 +80,16 @@ fn main() -> () { // mir::Constant // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38 // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } - StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2 + _0 = const (); // bb0[9]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_4); // bb0[10]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + StorageDead(_2); // bb0[11]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + StorageDead(_1); // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + return; // bb0[13]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2 } } diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.ConstProp.diff index fd3281f527372..0097d9448c81f 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.ConstProp.diff @@ -171,7 +171,13 @@ + // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38 + // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39 - _0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + _0 = const (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.SimplifyLocals.after.mir b/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.SimplifyLocals.after.mir index db4d2d137927c..5e2a8af060be8 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.SimplifyLocals.after.mir +++ b/src/test/mir-opt/const_prop/optimizes_into_variable/64bit/rustc.main.SimplifyLocals.after.mir @@ -80,9 +80,16 @@ fn main() -> () { // mir::Constant // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38 // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } - StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 - return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2 + _0 = const (); // bb0[9]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/optimizes_into_variable.rs:11:11: 15:2 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_4); // bb0[10]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + StorageDead(_2); // bb0[11]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + StorageDead(_1); // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 + return; // bb0[13]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2 } } diff --git a/src/test/mir-opt/const_prop/read_immutable_static/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/read_immutable_static/rustc.main.ConstProp.diff index 6183b22a95fce..d9852539844c9 100644 --- a/src/test/mir-opt/const_prop/read_immutable_static/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/read_immutable_static/rustc.main.ConstProp.diff @@ -60,7 +60,13 @@ StorageDead(_2); // bb0[11]: scope 0 at $DIR/read_immutable_static.rs:7:21: 7:22 StorageDead(_5); // bb0[12]: scope 0 at $DIR/read_immutable_static.rs:7:22: 7:23 StorageDead(_3); // bb0[13]: scope 0 at $DIR/read_immutable_static.rs:7:22: 7:23 - _0 = (); // bb0[14]: scope 0 at $DIR/read_immutable_static.rs:6:11: 8:2 + _0 = const (); // bb0[14]: scope 0 at $DIR/read_immutable_static.rs:6:11: 8:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/read_immutable_static.rs:6:11: 8:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb0[15]: scope 0 at $DIR/read_immutable_static.rs:8:1: 8:2 return; // bb0[16]: scope 0 at $DIR/read_immutable_static.rs:8:2: 8:2 } diff --git a/src/test/mir-opt/const_prop/ref_deref/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref/rustc.main.ConstProp.diff index 0f8563daba5d0..591fdaddfccd5 100644 --- a/src/test/mir-opt/const_prop/ref_deref/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref/rustc.main.ConstProp.diff @@ -29,7 +29,13 @@ + // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 - _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 + _0 = const (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/ref_deref.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[8]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/ref_deref/rustc.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref/rustc.main.PromoteTemps.diff index ea1baa40f7ef8..5cd9f43a5c684 100644 --- a/src/test/mir-opt/const_prop/ref_deref/rustc.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref/rustc.main.PromoteTemps.diff @@ -27,15 +27,21 @@ - StorageDead(_3); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 - StorageDead(_2); // bb0[7]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 - StorageDead(_1); // bb0[8]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 -- _0 = (); // bb0[9]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 -- return; // bb0[10]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2 +- _0 = const (); // bb0[9]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 + // + span: $DIR/ref_deref.rs:5:6: 5:10 + // + literal: Const { ty: &i32, val: Unevaluated(DefId(0:3 ~ ref_deref[317d]::main[0]), [], Some(promoted[0])) } + _2 = &(*_4); // bb0[3]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10 + _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10 + StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 + StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11 -+ _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 ++ _0 = const (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/ref_deref.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } +- return; // bb0[10]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2 + return; // bb0[8]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.ConstProp.diff index c4b3d6b6c27ec..6393bad2993d5 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.ConstProp.diff @@ -22,7 +22,13 @@ _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 - _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 + _0 = const (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/ref_deref_project.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.PromoteTemps.diff index 852436e13b618..020ad7278c038 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project/rustc.main.PromoteTemps.diff @@ -22,7 +22,14 @@ // mir::Constant - // + span: $DIR/ref_deref_project.rs:5:9: 5:10 - // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } -- // ty::Const ++ // + span: $DIR/ref_deref_project.rs:5:6: 5:17 ++ // + literal: Const { ty: &(i32, i32), val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0])) } ++ _2 = &((*_4).1: i32); // bb0[3]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 ++ _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 ++ StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 ++ StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 ++ _0 = const (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 + // ty::Const - // + ty: i32 - // + val: Value(Scalar(0x00000005)) - // mir::Constant @@ -33,15 +40,14 @@ - StorageDead(_3); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 - StorageDead(_2); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 - StorageDead(_1); // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 -- _0 = (); // bb0[9]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 +- _0 = const (); // bb0[9]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 +- // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/ref_deref_project.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } - return; // bb0[10]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2 -+ // + span: $DIR/ref_deref_project.rs:5:6: 5:17 -+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0])) } -+ _2 = &((*_4).1: i32); // bb0[3]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 -+ _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 -+ StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 -+ StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 -+ _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2 + return; // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/reify_fn_ptr/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/reify_fn_ptr/rustc.main.ConstProp.diff index 7a41a8ad74ed4..388ebe08689c2 100644 --- a/src/test/mir-opt/const_prop/reify_fn_ptr/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/reify_fn_ptr/rustc.main.ConstProp.diff @@ -25,7 +25,13 @@ _1 = move _2 as *const fn() (Misc); // bb0[6]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41 StorageDead(_2); // bb0[7]: scope 0 at $DIR/reify_fn_ptr.rs:4:40: 4:41 StorageDead(_1); // bb0[8]: scope 0 at $DIR/reify_fn_ptr.rs:4:41: 4:42 - _0 = (); // bb0[9]: scope 0 at $DIR/reify_fn_ptr.rs:3:11: 5:2 + _0 = const (); // bb0[9]: scope 0 at $DIR/reify_fn_ptr.rs:3:11: 5:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/reify_fn_ptr.rs:3:11: 5:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[10]: scope 0 at $DIR/reify_fn_ptr.rs:5:2: 5:2 } } diff --git a/src/test/mir-opt/const_prop/repeat/32bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/repeat/32bit/rustc.main.ConstProp.diff index 9d62fa31a4565..921de79472253 100644 --- a/src/test/mir-opt/const_prop/repeat/32bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/repeat/32bit/rustc.main.ConstProp.diff @@ -80,7 +80,13 @@ StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32 StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33 StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33 - _0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2 + _0 = const (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/repeat.rs:5:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2 return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2 } diff --git a/src/test/mir-opt/const_prop/repeat/64bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/repeat/64bit/rustc.main.ConstProp.diff index cb84ee82cfea8..361ee4933788e 100644 --- a/src/test/mir-opt/const_prop/repeat/64bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/repeat/64bit/rustc.main.ConstProp.diff @@ -80,7 +80,13 @@ StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32 StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33 StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33 - _0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2 + _0 = const (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/repeat.rs:5:11: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2 return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2 } diff --git a/src/test/mir-opt/const_prop/slice_len/32bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/slice_len/32bit/rustc.main.ConstProp.diff index dbb4171e7f0ed..018180954553d 100644 --- a/src/test/mir-opt/const_prop/slice_len/32bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/slice_len/32bit/rustc.main.ConstProp.diff @@ -76,7 +76,13 @@ StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 - _0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2 + _0 = const (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/slice_len.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/const_prop/slice_len/64bit/rustc.main.ConstProp.diff b/src/test/mir-opt/const_prop/slice_len/64bit/rustc.main.ConstProp.diff index 3c4415e055838..f1379446d7ad7 100644 --- a/src/test/mir-opt/const_prop/slice_len/64bit/rustc.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/slice_len/64bit/rustc.main.ConstProp.diff @@ -76,7 +76,13 @@ StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34 - _0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2 + _0 = const (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/slice_len.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/copy_propagation_arg/rustc.bar.CopyPropagation.diff b/src/test/mir-opt/copy_propagation_arg/rustc.bar.CopyPropagation.diff index 8bdc91109b30f..16bdb7d0a9921 100644 --- a/src/test/mir-opt/copy_propagation_arg/rustc.bar.CopyPropagation.diff +++ b/src/test/mir-opt/copy_propagation_arg/rustc.bar.CopyPropagation.diff @@ -30,7 +30,13 @@ // mir::Constant // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 // + literal: Const { ty: u8, val: Value(Scalar(0x05)) } - nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2 + _0 = const (); // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:15:19: 18:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2 } } diff --git a/src/test/mir-opt/copy_propagation_arg/rustc.baz.CopyPropagation.diff b/src/test/mir-opt/copy_propagation_arg/rustc.baz.CopyPropagation.diff index 10f2a98b20618..7df995c990a30 100644 --- a/src/test/mir-opt/copy_propagation_arg/rustc.baz.CopyPropagation.diff +++ b/src/test/mir-opt/copy_propagation_arg/rustc.baz.CopyPropagation.diff @@ -11,7 +11,13 @@ _2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 _1 = move _2; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10 StorageDead(_2); // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 - nop; // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2 + _0 = const (); // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:21:20: 24:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb0[5]: scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2 } } diff --git a/src/test/mir-opt/copy_propagation_arg/rustc.foo.CopyPropagation.diff b/src/test/mir-opt/copy_propagation_arg/rustc.foo.CopyPropagation.diff index a47880c540e2e..67b58c30f054a 100644 --- a/src/test/mir-opt/copy_propagation_arg/rustc.foo.CopyPropagation.diff +++ b/src/test/mir-opt/copy_propagation_arg/rustc.foo.CopyPropagation.diff @@ -24,7 +24,13 @@ StorageDead(_3); // bb1[0]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 _1 = move _2; // bb1[1]: scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17 StorageDead(_2); // bb1[2]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 - nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2 + _0 = const (); // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:9:19: 12:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2 } } diff --git a/src/test/mir-opt/generator-storage-dead-unwind/rustc.main-{{closure}}.StateTransform.before.mir b/src/test/mir-opt/generator-storage-dead-unwind/rustc.main-{{closure}}.StateTransform.before.mir index cc22982a5155f..50a48f2eee414 100644 --- a/src/test/mir-opt/generator-storage-dead-unwind/rustc.main-{{closure}}.StateTransform.before.mir +++ b/src/test/mir-opt/generator-storage-dead-unwind/rustc.main-{{closure}}.StateTransform.before.mir @@ -112,7 +112,13 @@ yields () bb10: { StorageDead(_10); // bb10[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16 StorageDead(_9); // bb10[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17 - _0 = (); // bb10[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 28:6 + _0 = const (); // bb10[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 28:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/generator-storage-dead-unwind.rs:22:19: 28:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_4); // bb10[3]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6 StorageDead(_3); // bb10[4]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6 drop(_1) -> [return: bb12, unwind: bb1]; // bb10[5]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6 diff --git a/src/test/mir-opt/generator-tiny/rustc.main-{{closure}}.generator_resume.0.mir b/src/test/mir-opt/generator-tiny/rustc.main-{{closure}}.generator_resume.0.mir index a79f0d53f3c6d..2e3354699fbaa 100644 --- a/src/test/mir-opt/generator-tiny/rustc.main-{{closure}}.generator_resume.0.mir +++ b/src/test/mir-opt/generator-tiny/rustc.main-{{closure}}.generator_resume.0.mir @@ -54,7 +54,13 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs: bb4: { StorageDead(_8); // bb4[0]: scope 1 at $DIR/generator-tiny.rs:22:21: 22:22 - _5 = (); // bb4[1]: scope 1 at $DIR/generator-tiny.rs:20:14: 23:10 + _5 = const (); // bb4[1]: scope 1 at $DIR/generator-tiny.rs:20:14: 23:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/generator-tiny.rs:20:14: 23:10 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb2; // bb4[2]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10 } diff --git a/src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot b/src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot index 2caef3459b85d..f5d8b84812a3e 100644 --- a/src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot +++ b/src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot @@ -3,7 +3,7 @@ digraph Mir_0_3 { node [fontname="monospace"]; edge [fontname="monospace"]; label=>; - bb0__0_3 [shape="none", label=<
0
_0 = ()
goto
>]; + bb0__0_3 [shape="none", label=<
0
_0 = const ()
goto
>]; bb1__0_3 [shape="none", label=<
1
resume
>]; bb2__0_3 [shape="none", label=<
2
return
>]; bb0__0_3 -> bb2__0_3 [label=""]; diff --git a/src/test/mir-opt/inline/inline-into-box-place/32bit/rustc.main.Inline.diff b/src/test/mir-opt/inline/inline-into-box-place/32bit/rustc.main.Inline.diff index 721b37778accc..6983e94ff8d77 100644 --- a/src/test/mir-opt/inline/inline-into-box-place/32bit/rustc.main.Inline.diff +++ b/src/test/mir-opt/inline/inline-into-box-place/32bit/rustc.main.Inline.diff @@ -29,11 +29,21 @@ - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 - // + user_ty: UserType(1) - // + literal: Const { ty: fn() -> std::vec::Vec {std::vec::Vec::::new}, val: Value(Scalar()) } +- } +- +- bb1 (cleanup): { +- resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 +- } +- +- bb2: { +- _1 = move _2; // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 +- StorageDead(_2); // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- _0 = const (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 + // + span: $SRC_DIR/liballoc/vec.rs:LL:COL + // + user_ty: UserType(0) + // + literal: Const { ty: alloc::raw_vec::RawVec, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + ((*_4).1: usize) = const 0usize; // bb0[5]: scope 2 at $SRC_DIR/liballoc/vec.rs:LL:COL -+ // ty::Const + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant @@ -41,26 +51,24 @@ + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + _1 = move _2; // bb0[6]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 + StorageDead(_2); // bb0[7]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -+ _0 = (); // bb0[8]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 ++ _0 = const (); // bb0[8]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 ++ // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/inline-into-box-place.rs:7:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } +- drop(_1) -> [return: bb3, unwind: bb1]; // bb2[3]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + drop(_1) -> [return: bb2, unwind: bb1]; // bb0[9]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 } - bb1 (cleanup): { - resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 - } - - bb2: { -- _1 = move _2; // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 -- StorageDead(_2); // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -- _0 = (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 -- drop(_1) -> [return: bb3, unwind: bb1]; // bb2[3]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 -- } -- - bb3: { - StorageDead(_1); // bb3[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 - return; // bb3[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2 -- } -- ++ bb1 (cleanup): { ++ resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 + } + - bb4 (cleanup): { - _3 = const alloc::alloc::box_free::>(move (_2.0: std::ptr::Unique>)) -> bb1; // bb4[0]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // ty::Const @@ -69,6 +77,7 @@ - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 - // + literal: Const { ty: unsafe fn(std::ptr::Unique>) {alloc::alloc::box_free::>}, val: Value(Scalar()) } ++ bb2: { + StorageDead(_1); // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + return; // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff b/src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff index a0db20cbb743b..38ab9ce9926c0 100644 --- a/src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff +++ b/src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff @@ -29,11 +29,21 @@ - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 - // + user_ty: UserType(1) - // + literal: Const { ty: fn() -> std::vec::Vec {std::vec::Vec::::new}, val: Value(Scalar()) } +- } +- +- bb1 (cleanup): { +- resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 +- } +- +- bb2: { +- _1 = move _2; // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 +- StorageDead(_2); // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- _0 = const (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 + // + span: $SRC_DIR/liballoc/vec.rs:LL:COL + // + user_ty: UserType(0) + // + literal: Const { ty: alloc::raw_vec::RawVec, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + ((*_4).1: usize) = const 0usize; // bb0[5]: scope 2 at $SRC_DIR/liballoc/vec.rs:LL:COL -+ // ty::Const + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant @@ -41,26 +51,24 @@ + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + _1 = move _2; // bb0[6]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 + StorageDead(_2); // bb0[7]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -+ _0 = (); // bb0[8]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 ++ _0 = const (); // bb0[8]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 ++ // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/inline-into-box-place.rs:7:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } +- drop(_1) -> [return: bb3, unwind: bb1]; // bb2[3]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + drop(_1) -> [return: bb2, unwind: bb1]; // bb0[9]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 } - bb1 (cleanup): { - resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 - } - - bb2: { -- _1 = move _2; // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 -- StorageDead(_2); // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 -- _0 = (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2 -- drop(_1) -> [return: bb3, unwind: bb1]; // bb2[3]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 -- } -- - bb3: { - StorageDead(_1); // bb3[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 - return; // bb3[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2 -- } -- ++ bb1 (cleanup): { ++ resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2 + } + - bb4 (cleanup): { - _3 = const alloc::alloc::box_free::>(move (_2.0: std::ptr::Unique>)) -> bb1; // bb4[0]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // ty::Const @@ -69,6 +77,7 @@ - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 - // + literal: Const { ty: unsafe fn(std::ptr::Unique>) {alloc::alloc::box_free::>}, val: Value(Scalar()) } ++ bb2: { + StorageDead(_1); // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2 + return; // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/inline/inline-specialization/rustc.main.Inline.diff b/src/test/mir-opt/inline/inline-specialization/rustc.main.Inline.diff index 98d03b19977bb..35c400035a6ab 100644 --- a/src/test/mir-opt/inline/inline-specialization/rustc.main.Inline.diff +++ b/src/test/mir-opt/inline/inline-specialization/rustc.main.Inline.diff @@ -25,12 +25,18 @@ - } - - bb1: { -- _0 = (); // bb1[0]: scope 0 at $DIR/inline-specialization.rs:4:11: 6:2 -- StorageDead(_1); // bb1[1]: scope 0 at $DIR/inline-specialization.rs:6:1: 6:2 -- return; // bb1[2]: scope 0 at $DIR/inline-specialization.rs:6:2: 6:2 +- _0 = const (); // bb1[0]: scope 0 at $DIR/inline-specialization.rs:4:11: 6:2 + // + span: $DIR/inline-specialization.rs:14:31: 14:34 + // + literal: Const { ty: u32, val: Value(Scalar(0x0000007b)) } -+ _0 = (); // bb0[2]: scope 0 at $DIR/inline-specialization.rs:4:11: 6:2 ++ _0 = const (); // bb0[2]: scope 0 at $DIR/inline-specialization.rs:4:11: 6:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/inline-specialization.rs:4:11: 6:2 + // + literal: Const { ty: (), val: Value(Scalar()) } +- StorageDead(_1); // bb1[1]: scope 0 at $DIR/inline-specialization.rs:6:1: 6:2 +- return; // bb1[2]: scope 0 at $DIR/inline-specialization.rs:6:2: 6:2 + StorageDead(_1); // bb0[3]: scope 0 at $DIR/inline-specialization.rs:6:1: 6:2 + return; // bb0[4]: scope 0 at $DIR/inline-specialization.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/issue-38669/rustc.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue-38669/rustc.main.SimplifyCfg-initial.after.mir index 5144cdd3dabf3..62d2f8db7a43f 100644 --- a/src/test/mir-opt/issue-38669/rustc.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue-38669/rustc.main.SimplifyCfg-initial.after.mir @@ -45,7 +45,13 @@ fn main() -> () { } bb5: { - _3 = (); // bb5[0]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10 + _3 = const (); // bb5[0]: scope 1 at $DIR/issue-38669.rs:7:9: 9:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-38669.rs:7:9: 9:10 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_4); // bb5[1]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_3); // bb5[2]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10 _1 = const true; // bb5[3]: scope 1 at $DIR/issue-38669.rs:10:9: 10:28 @@ -55,12 +61,24 @@ fn main() -> () { // mir::Constant // + span: $DIR/issue-38669.rs:10:24: 10:28 // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } - _2 = (); // bb5[4]: scope 1 at $DIR/issue-38669.rs:6:10: 11:6 + _2 = const (); // bb5[4]: scope 1 at $DIR/issue-38669.rs:6:10: 11:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-38669.rs:6:10: 11:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb2; // bb5[5]: scope 1 at $DIR/issue-38669.rs:6:5: 11:6 } bb6: { - _0 = (); // bb6[0]: scope 1 at $DIR/issue-38669.rs:8:13: 8:18 + _0 = const (); // bb6[0]: scope 1 at $DIR/issue-38669.rs:8:13: 8:18 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-38669.rs:8:13: 8:18 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_4); // bb6[1]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_3); // bb6[2]: scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_1); // bb6[3]: scope 0 at $DIR/issue-38669.rs:12:1: 12:2 diff --git a/src/test/mir-opt/issue-41110/rustc.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue-41110/rustc.main.ElaborateDrops.after.mir index 0499054c329b2..55849b2773290 100644 --- a/src/test/mir-opt/issue-41110/rustc.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue-41110/rustc.main.ElaborateDrops.after.mir @@ -85,7 +85,13 @@ fn main() -> () { // + span: $DIR/issue-41110.rs:8:27: 8:28 // + literal: Const { ty: bool, val: Value(Scalar(0x00)) } StorageDead(_2); // bb6[2]: scope 0 at $DIR/issue-41110.rs:8:27: 8:28 - _0 = (); // bb6[3]: scope 0 at $DIR/issue-41110.rs:7:11: 9:2 + _0 = const (); // bb6[3]: scope 0 at $DIR/issue-41110.rs:7:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-41110.rs:7:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb6[4]: scope 0 at $DIR/issue-41110.rs:9:1: 9:2 return; // bb6[5]: scope 0 at $DIR/issue-41110.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/issue-41110/rustc.test.ElaborateDrops.after.mir b/src/test/mir-opt/issue-41110/rustc.test.ElaborateDrops.after.mir index b6623fcd4d949..cc1a49dd24524 100644 --- a/src/test/mir-opt/issue-41110/rustc.test.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue-41110/rustc.test.ElaborateDrops.after.mir @@ -87,7 +87,13 @@ fn test() -> () { bb8: { StorageDead(_5); // bb8[0]: scope 2 at $DIR/issue-41110.rs:18:9: 18:10 - _0 = (); // bb8[1]: scope 0 at $DIR/issue-41110.rs:14:15: 19:2 + _0 = const (); // bb8[1]: scope 0 at $DIR/issue-41110.rs:14:15: 19:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-41110.rs:14:15: 19:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_2) -> [return: bb9, unwind: bb3]; // bb8[2]: scope 1 at $DIR/issue-41110.rs:19:1: 19:2 } diff --git a/src/test/mir-opt/issue-41888/rustc.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue-41888/rustc.main.ElaborateDrops.after.mir index 6cd3e2dec838c..ee05bf48d6273 100644 --- a/src/test/mir-opt/issue-41888/rustc.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue-41888/rustc.main.ElaborateDrops.after.mir @@ -66,7 +66,13 @@ fn main() -> () { } bb4: { - _0 = (); // bb4[0]: scope 1 at $DIR/issue-41888.rs:8:5: 14:6 + _0 = const (); // bb4[0]: scope 1 at $DIR/issue-41888.rs:8:5: 14:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-41888.rs:8:5: 14:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb11; // bb4[1]: scope 1 at $DIR/issue-41888.rs:8:5: 14:6 } @@ -94,7 +100,13 @@ fn main() -> () { } bb9: { - _0 = (); // bb9[0]: scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + _0 = const (); // bb9[0]: scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-41888.rs:10:9: 13:10 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb11; // bb9[1]: scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } @@ -108,7 +120,13 @@ fn main() -> () { // + span: $DIR/issue-41888.rs:10:21: 10:23 // + literal: Const { ty: bool, val: Value(Scalar(0x00)) } _6 = move ((_1 as F).0: K); // bb10[2]: scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = (); // bb10[3]: scope 2 at $DIR/issue-41888.rs:10:29: 13:10 + _0 = const (); // bb10[3]: scope 2 at $DIR/issue-41888.rs:10:29: 13:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-41888.rs:10:29: 13:10 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_6); // bb10[4]: scope 1 at $DIR/issue-41888.rs:13:9: 13:10 goto -> bb11; // bb10[5]: scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } diff --git a/src/test/mir-opt/issue-49232/rustc.main.mir_map.0.mir b/src/test/mir-opt/issue-49232/rustc.main.mir_map.0.mir index 03815d58bbc75..5440d4488bb97 100644 --- a/src/test/mir-opt/issue-49232/rustc.main.mir_map.0.mir +++ b/src/test/mir-opt/issue-49232/rustc.main.mir_map.0.mir @@ -47,7 +47,13 @@ fn main() -> () { } bb6: { - _0 = (); // bb6[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 + _0 = const (); // bb6[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-49232.rs:10:25: 10:30 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb8; // bb6[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 } @@ -73,7 +79,13 @@ fn main() -> () { } bb10: { - _4 = (); // bb10[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 + _4 = const (); // bb10[0]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-49232.rs:10:25: 10:30 + // + literal: Const { ty: (), val: Value(Scalar()) } unreachable; // bb10[1]: scope 0 at $DIR/issue-49232.rs:10:25: 10:30 } @@ -99,7 +111,13 @@ fn main() -> () { bb13: { StorageDead(_6); // bb13[0]: scope 1 at $DIR/issue-49232.rs:13:21: 13:22 StorageDead(_5); // bb13[1]: scope 1 at $DIR/issue-49232.rs:13:22: 13:23 - _1 = (); // bb13[2]: scope 0 at $DIR/issue-49232.rs:6:10: 14:6 + _1 = const (); // bb13[2]: scope 0 at $DIR/issue-49232.rs:6:10: 14:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/issue-49232.rs:6:10: 14:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb13[3]: scope 0 at $DIR/issue-49232.rs:14:5: 14:6 goto -> bb1; // bb13[4]: scope 0 at $DIR/issue-49232.rs:6:5: 14:6 } diff --git a/src/test/mir-opt/loop_test/rustc.main.SimplifyCfg-qualify-consts.after.mir b/src/test/mir-opt/loop_test/rustc.main.SimplifyCfg-qualify-consts.after.mir index c458592e920b0..df05dbabc770d 100644 --- a/src/test/mir-opt/loop_test/rustc.main.SimplifyCfg-qualify-consts.after.mir +++ b/src/test/mir-opt/loop_test/rustc.main.SimplifyCfg-qualify-consts.after.mir @@ -35,7 +35,13 @@ fn main() -> () { } bb3: { - _1 = (); // bb3[0]: scope 0 at $DIR/loop_test.rs:10:5: 12:6 + _1 = const (); // bb3[0]: scope 0 at $DIR/loop_test.rs:10:5: 12:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/loop_test.rs:10:5: 12:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb3[1]: scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageDead(_1); // bb3[2]: scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageLive(_4); // bb3[3]: scope 0 at $DIR/loop_test.rs:13:5: 16:6 @@ -43,7 +49,13 @@ fn main() -> () { } bb4: { - _0 = (); // bb4[0]: scope 0 at $DIR/loop_test.rs:11:9: 11:15 + _0 = const (); // bb4[0]: scope 0 at $DIR/loop_test.rs:11:9: 11:15 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/loop_test.rs:11:9: 11:15 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb4[1]: scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageDead(_1); // bb4[2]: scope 0 at $DIR/loop_test.rs:12:5: 12:6 return; // bb4[3]: scope 0 at $DIR/loop_test.rs:17:2: 17:2 diff --git a/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir b/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir index acc03cce46eb2..a296bd053121c 100644 --- a/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir +++ b/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir @@ -143,7 +143,13 @@ fn full_tested_match() -> () { bb11: { StorageDead(_2); // bb11[0]: scope 0 at $DIR/match_false_edges.rs:19:6: 19:7 StorageDead(_1); // bb11[1]: scope 0 at $DIR/match_false_edges.rs:19:6: 19:7 - _0 = (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:14:28: 20:2 + _0 = const (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:14:28: 20:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/match_false_edges.rs:14:28: 20:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb11[3]: scope 0 at $DIR/match_false_edges.rs:20:2: 20:2 } } diff --git a/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir index cc1fa56264570..567e3ebdd9310 100644 --- a/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir @@ -135,7 +135,13 @@ fn full_tested_match2() -> () { bb11: { StorageDead(_2); // bb11[0]: scope 0 at $DIR/match_false_edges.rs:30:6: 30:7 StorageDead(_1); // bb11[1]: scope 0 at $DIR/match_false_edges.rs:30:6: 30:7 - _0 = (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:25:29: 31:2 + _0 = const (); // bb11[2]: scope 0 at $DIR/match_false_edges.rs:25:29: 31:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/match_false_edges.rs:25:29: 31:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb11[3]: scope 0 at $DIR/match_false_edges.rs:31:2: 31:2 } } diff --git a/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir index fce497df982a8..a24fa9dedb39f 100644 --- a/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir @@ -182,7 +182,13 @@ fn main() -> () { bb15: { StorageDead(_2); // bb15[0]: scope 0 at $DIR/match_false_edges.rs:40:6: 40:7 StorageDead(_1); // bb15[1]: scope 0 at $DIR/match_false_edges.rs:40:6: 40:7 - _0 = (); // bb15[2]: scope 0 at $DIR/match_false_edges.rs:34:11: 41:2 + _0 = const (); // bb15[2]: scope 0 at $DIR/match_false_edges.rs:34:11: 41:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/match_false_edges.rs:34:11: 41:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb15[3]: scope 0 at $DIR/match_false_edges.rs:41:2: 41:2 } } diff --git a/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir index ef5feb79beca9..3236b3bcc738f 100644 --- a/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir @@ -158,7 +158,13 @@ fn main() -> () { bb14: { StorageDead(_3); // bb14[0]: scope 2 at $DIR/match_test.rs:17:6: 17:7 - _0 = (); // bb14[1]: scope 0 at $DIR/match_test.rs:6:11: 18:2 + _0 = const (); // bb14[1]: scope 0 at $DIR/match_test.rs:6:11: 18:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/match_test.rs:6:11: 18:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_2); // bb14[2]: scope 1 at $DIR/match_test.rs:18:1: 18:2 StorageDead(_1); // bb14[3]: scope 0 at $DIR/match_test.rs:18:1: 18:2 return; // bb14[4]: scope 0 at $DIR/match_test.rs:18:2: 18:2 diff --git a/src/test/mir-opt/nll/region-subtyping-basic/32bit/rustc.main.nll.0.mir b/src/test/mir-opt/nll/region-subtyping-basic/32bit/rustc.main.nll.0.mir index 1f75658aa265a..7d396c3f1fbd3 100644 --- a/src/test/mir-opt/nll/region-subtyping-basic/32bit/rustc.main.nll.0.mir +++ b/src/test/mir-opt/nll/region-subtyping-basic/32bit/rustc.main.nll.0.mir @@ -137,13 +137,25 @@ fn main() -> () { bb6: { StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:17: 19:18 StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:18: 19:19 - _0 = (); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6 + _0 = const Const(Value(Scalar()): ()); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:18:13: 20:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6 } bb7: { StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = (); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6 + _0 = const Const(Value(Scalar()): ()); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:20:12: 22:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6 } diff --git a/src/test/mir-opt/nll/region-subtyping-basic/64bit/rustc.main.nll.0.mir b/src/test/mir-opt/nll/region-subtyping-basic/64bit/rustc.main.nll.0.mir index 8305c3fe7c493..4a285d035be53 100644 --- a/src/test/mir-opt/nll/region-subtyping-basic/64bit/rustc.main.nll.0.mir +++ b/src/test/mir-opt/nll/region-subtyping-basic/64bit/rustc.main.nll.0.mir @@ -137,13 +137,25 @@ fn main() -> () { bb6: { StorageDead(_9); // bb6[0]: scope 3 at $DIR/region-subtyping-basic.rs:19:17: 19:18 StorageDead(_8); // bb6[1]: scope 3 at $DIR/region-subtyping-basic.rs:19:18: 19:19 - _0 = (); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6 + _0 = const Const(Value(Scalar()): ()); // bb6[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:13: 20:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:18:13: 20:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb8; // bb6[3]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6 } bb7: { StorageDead(_10); // bb7[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = (); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6 + _0 = const Const(Value(Scalar()): ()); // bb7[1]: scope 3 at $DIR/region-subtyping-basic.rs:20:12: 22:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:20:12: 22:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb8; // bb7[2]: scope 3 at $DIR/region-subtyping-basic.rs:18:5: 22:6 } diff --git a/src/test/mir-opt/no-spurious-drop-after-call/rustc.main.ElaborateDrops.before.mir b/src/test/mir-opt/no-spurious-drop-after-call/rustc.main.ElaborateDrops.before.mir index b65bc76033003..e43e37feba743 100644 --- a/src/test/mir-opt/no-spurious-drop-after-call/rustc.main.ElaborateDrops.before.mir +++ b/src/test/mir-opt/no-spurious-drop-after-call/rustc.main.ElaborateDrops.before.mir @@ -48,7 +48,13 @@ fn main() -> () { StorageDead(_2); // bb3[0]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:34: 9:35 StorageDead(_4); // bb3[1]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:35: 9:36 StorageDead(_1); // bb3[2]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:35: 9:36 - _0 = (); // bb3[3]: scope 0 at $DIR/no-spurious-drop-after-call.rs:8:11: 10:2 + _0 = const (); // bb3[3]: scope 0 at $DIR/no-spurious-drop-after-call.rs:8:11: 10:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/no-spurious-drop-after-call.rs:8:11: 10:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb3[4]: scope 0 at $DIR/no-spurious-drop-after-call.rs:10:2: 10:2 } diff --git a/src/test/mir-opt/packed-struct-drop-aligned/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/packed-struct-drop-aligned/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir index 03265c613bc79..cea1087294298 100644 --- a/src/test/mir-opt/packed-struct-drop-aligned/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/packed-struct-drop-aligned/32bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -61,7 +61,13 @@ fn main() -> () { StorageDead(_6); // bb4[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8 (_1.0: Aligned) = move _4; // bb4[1]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8 StorageDead(_4); // bb4[2]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29 - _0 = (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + _0 = const (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_1) -> [return: bb2, unwind: bb1]; // bb4[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2 } } diff --git a/src/test/mir-opt/packed-struct-drop-aligned/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/packed-struct-drop-aligned/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir index a1424d0bf5922..432f91d91e576 100644 --- a/src/test/mir-opt/packed-struct-drop-aligned/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/packed-struct-drop-aligned/64bit/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -61,7 +61,13 @@ fn main() -> () { StorageDead(_6); // bb4[0]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8 (_1.0: Aligned) = move _4; // bb4[1]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:5: 7:8 StorageDead(_4); // bb4[2]: scope 1 at $DIR/packed-struct-drop-aligned.rs:7:28: 7:29 - _0 = (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + _0 = const (); // bb4[3]: scope 0 at $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/packed-struct-drop-aligned.rs:5:11: 8:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_1) -> [return: bb2, unwind: bb1]; // bb4[4]: scope 0 at $DIR/packed-struct-drop-aligned.rs:8:1: 8:2 } } diff --git a/src/test/mir-opt/retag/rustc.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag/rustc.main.SimplifyCfg-elaborate-drops.after.mir index 780cb9d4ad51a..727c271a47832 100644 --- a/src/test/mir-opt/retag/rustc.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag/rustc.main.SimplifyCfg-elaborate-drops.after.mir @@ -125,7 +125,13 @@ fn main() -> () { Retag([raw] _12); // bb4[14]: scope 4 at $DIR/retag.rs:36:18: 36:19 _11 = _12; // bb4[15]: scope 4 at $DIR/retag.rs:36:18: 36:29 StorageDead(_12); // bb4[16]: scope 4 at $DIR/retag.rs:36:29: 36:30 - _2 = (); // bb4[17]: scope 1 at $DIR/retag.rs:31:5: 37:6 + _2 = const (); // bb4[17]: scope 1 at $DIR/retag.rs:31:5: 37:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/retag.rs:31:5: 37:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_11); // bb4[18]: scope 4 at $DIR/retag.rs:37:5: 37:6 StorageDead(_10); // bb4[19]: scope 3 at $DIR/retag.rs:37:5: 37:6 StorageDead(_8); // bb4[20]: scope 2 at $DIR/retag.rs:37:5: 37:6 @@ -217,7 +223,13 @@ fn main() -> () { Retag([raw] _26); // bb8[5]: scope 7 at $DIR/retag.rs:50:14: 50:16 _25 = _26; // bb8[6]: scope 7 at $DIR/retag.rs:50:14: 50:28 StorageDead(_26); // bb8[7]: scope 7 at $DIR/retag.rs:50:28: 50:29 - _0 = (); // bb8[8]: scope 0 at $DIR/retag.rs:29:11: 51:2 + _0 = const (); // bb8[8]: scope 0 at $DIR/retag.rs:29:11: 51:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/retag.rs:29:11: 51:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_25); // bb8[9]: scope 7 at $DIR/retag.rs:51:1: 51:2 StorageDead(_15); // bb8[10]: scope 6 at $DIR/retag.rs:51:1: 51:2 StorageDead(_13); // bb8[11]: scope 1 at $DIR/retag.rs:51:1: 51:2 diff --git a/src/test/mir-opt/simplify-arm-identity/rustc.main.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify-arm-identity/rustc.main.SimplifyArmIdentity.diff index 32338127923fa..2caa6235d54c0 100644 --- a/src/test/mir-opt/simplify-arm-identity/rustc.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify-arm-identity/rustc.main.SimplifyArmIdentity.diff @@ -57,8 +57,15 @@ bb4: { StorageDead(_2); // bb4[0]: scope 1 at $DIR/simplify-arm-identity.rs:21:6: 21:7 - StorageDead(_1); // bb4[1]: scope 0 at $DIR/simplify-arm-identity.rs:22:1: 22:2 - return; // bb4[2]: scope 0 at $DIR/simplify-arm-identity.rs:22:2: 22:2 + _0 = const (); // bb4[1]: scope 0 at $DIR/simplify-arm-identity.rs:16:11: 22:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify-arm-identity.rs:16:11: 22:2 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_1); // bb4[2]: scope 0 at $DIR/simplify-arm-identity.rs:22:1: 22:2 + return; // bb4[3]: scope 0 at $DIR/simplify-arm-identity.rs:22:2: 22:2 } } diff --git a/src/test/mir-opt/simplify-locals-removes-unused-consts/rustc.main.SimplifyLocals.diff b/src/test/mir-opt/simplify-locals-removes-unused-consts/rustc.main.SimplifyLocals.diff index 15deb3e31bd5b..8613a812a834b 100644 --- a/src/test/mir-opt/simplify-locals-removes-unused-consts/rustc.main.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify-locals-removes-unused-consts/rustc.main.SimplifyLocals.diff @@ -124,9 +124,17 @@ bb2: { - StorageDead(_11); // bb2[0]: scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36 - StorageDead(_8); // bb2[1]: scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36 -- return; // bb2[2]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:17:2: 17:2 +- _0 = const (); // bb2[2]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:12:11: 17:2 + StorageDead(_2); // bb2[0]: scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36 -+ return; // bb2[1]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:17:2: 17:2 ++ _0 = const (); // bb2[1]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:12:11: 17:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify-locals-removes-unused-consts.rs:12:11: 17:2 + // + literal: Const { ty: (), val: Value(Scalar()) } +- return; // bb2[3]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:17:2: 17:2 ++ return; // bb2[2]: scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:17:2: 17:2 } } diff --git a/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-early-opt.diff index 9225bcd0b6520..ecac835fb87ef 100644 --- a/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-early-opt.diff @@ -33,28 +33,40 @@ - bb3: { - nop; // bb3[0]: scope 0 at $DIR/simplify_cfg.rs:7:12: 7:17 - switchInt(_2) -> [false: bb5, otherwise: bb4]; // bb3[1]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 -+ bb2: { -+ _1 = (); // bb2[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 -+ StorageDead(_2); // bb2[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 -+ goto -> bb0; // bb2[2]: scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 - } - +- } +- - bb4: { - goto -> bb6; // bb4[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 - } - - bb5: { -- _1 = (); // bb5[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 +- _1 = const (); // bb5[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 ++ bb2: { ++ _1 = const (); // bb2[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_cfg.rs:7:9: 9:10 + // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_2); // bb5[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 - goto -> bb0; // bb5[2]: scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 -- } -- ++ StorageDead(_2); // bb2[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 ++ goto -> bb0; // bb2[2]: scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 + } + - bb6: { -- _0 = (); // bb6[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 +- _0 = const (); // bb6[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 ++ bb3: { ++ _0 = const (); // bb3[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_cfg.rs:8:13: 8:18 + // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_2); // bb6[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 - return; // bb6[2]: scope 0 at $DIR/simplify_cfg.rs:11:2: 11:2 -+ bb3: { -+ _0 = (); // bb3[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 + StorageDead(_2); // bb3[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 + return; // bb3[2]: scope 0 at $DIR/simplify_cfg.rs:11:2: 11:2 } diff --git a/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-initial.diff index 856ee3508cbea..7c8bdde5418c2 100644 --- a/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg/rustc.main.SimplifyCfg-initial.diff @@ -54,16 +54,30 @@ } - bb7: { -- _1 = (); // bb7[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 -- goto -> bb12; // bb7[1]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 +- _1 = const (); // bb7[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + bb5: { -+ _1 = (); // bb5[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 ++ _1 = const (); // bb5[0]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_cfg.rs:7:9: 9:10 + // + literal: Const { ty: (), val: Value(Scalar()) } +- goto -> bb12; // bb7[1]: scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + StorageDead(_2); // bb5[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 + goto -> bb0; // bb5[2]: scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 } - bb8: { -- _0 = (); // bb8[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 +- _0 = const (); // bb8[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 ++ bb6: { ++ _0 = const (); // bb6[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_cfg.rs:8:13: 8:18 + // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb9; // bb8[1]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 - } - @@ -87,8 +101,6 @@ - - bb13: { - return; // bb13[0]: scope 0 at $DIR/simplify_cfg.rs:11:2: 11:2 -+ bb6: { -+ _0 = (); // bb6[0]: scope 0 at $DIR/simplify_cfg.rs:8:13: 8:18 + StorageDead(_2); // bb6[1]: scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 + return; // bb6[2]: scope 0 at $DIR/simplify_cfg.rs:11:2: 11:2 } diff --git a/src/test/mir-opt/simplify_if/rustc.main.SimplifyBranches-after-const-prop.diff b/src/test/mir-opt/simplify_if/rustc.main.SimplifyBranches-after-const-prop.diff index 9e53a0f18af35..2946eb1cc44e1 100644 --- a/src/test/mir-opt/simplify_if/rustc.main.SimplifyBranches-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if/rustc.main.SimplifyBranches-after-const-prop.diff @@ -26,7 +26,13 @@ } bb1: { - _0 = (); // bb1[0]: scope 0 at $DIR/simplify_if.rs:6:5: 8:6 + _0 = const (); // bb1[0]: scope 0 at $DIR/simplify_if.rs:6:5: 8:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_if.rs:6:5: 8:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb4; // bb1[1]: scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } @@ -43,7 +49,13 @@ bb3: { StorageDead(_2); // bb3[0]: scope 0 at $DIR/simplify_if.rs:7:15: 7:16 - _0 = (); // bb3[1]: scope 0 at $DIR/simplify_if.rs:6:14: 8:6 + _0 = const (); // bb3[1]: scope 0 at $DIR/simplify_if.rs:6:14: 8:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_if.rs:6:14: 8:6 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb4; // bb3[2]: scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } diff --git a/src/test/mir-opt/simplify_match/rustc.main.SimplifyBranches-after-copy-prop.diff b/src/test/mir-opt/simplify_match/rustc.main.SimplifyBranches-after-copy-prop.diff index 5429032b099c2..1c83bb13425de 100644 --- a/src/test/mir-opt/simplify_match/rustc.main.SimplifyBranches-after-copy-prop.diff +++ b/src/test/mir-opt/simplify_match/rustc.main.SimplifyBranches-after-copy-prop.diff @@ -26,7 +26,13 @@ } bb1: { - nop; // bb1[0]: scope 0 at $DIR/simplify_match.rs:8:18: 8:20 + _0 = const (); // bb1[0]: scope 0 at $DIR/simplify_match.rs:8:18: 8:20 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/simplify_match.rs:8:18: 8:20 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb3; // bb1[1]: scope 0 at $DIR/simplify_match.rs:6:5: 9:6 } diff --git a/src/test/mir-opt/storage_ranges/rustc.main.nll.0.mir b/src/test/mir-opt/storage_ranges/rustc.main.nll.0.mir index 57ec47346e8cc..e455a27642d36 100644 --- a/src/test/mir-opt/storage_ranges/rustc.main.nll.0.mir +++ b/src/test/mir-opt/storage_ranges/rustc.main.nll.0.mir @@ -54,7 +54,13 @@ fn main() -> () { StorageDead(_5); // bb0[9]: scope 1 at $DIR/storage_ranges.rs:6:24: 6:25 _3 = &_4; // bb0[10]: scope 1 at $DIR/storage_ranges.rs:6:17: 6:25 FakeRead(ForLet, _3); // bb0[11]: scope 1 at $DIR/storage_ranges.rs:6:13: 6:14 - _2 = (); // bb0[12]: scope 1 at $DIR/storage_ranges.rs:5:5: 7:6 + _2 = const (); // bb0[12]: scope 1 at $DIR/storage_ranges.rs:5:5: 7:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/storage_ranges.rs:5:5: 7:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_4); // bb0[13]: scope 1 at $DIR/storage_ranges.rs:7:5: 7:6 StorageDead(_3); // bb0[14]: scope 1 at $DIR/storage_ranges.rs:7:5: 7:6 StorageDead(_2); // bb0[15]: scope 1 at $DIR/storage_ranges.rs:7:5: 7:6 @@ -67,7 +73,13 @@ fn main() -> () { // + span: $DIR/storage_ranges.rs:8:13: 8:14 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } FakeRead(ForLet, _6); // bb0[18]: scope 1 at $DIR/storage_ranges.rs:8:9: 8:10 - _0 = (); // bb0[19]: scope 0 at $DIR/storage_ranges.rs:3:11: 9:2 + _0 = const (); // bb0[19]: scope 0 at $DIR/storage_ranges.rs:3:11: 9:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/storage_ranges.rs:3:11: 9:2 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_6); // bb0[20]: scope 1 at $DIR/storage_ranges.rs:9:1: 9:2 StorageDead(_1); // bb0[21]: scope 0 at $DIR/storage_ranges.rs:9:1: 9:2 return; // bb0[22]: scope 0 at $DIR/storage_ranges.rs:9:2: 9:2 diff --git a/src/test/mir-opt/uniform_array_move_out/rustc.move_out_by_subslice.mir_map.0.mir b/src/test/mir-opt/uniform_array_move_out/rustc.move_out_by_subslice.mir_map.0.mir index 5dbee8f7b3dda..b46adadf1016a 100644 --- a/src/test/mir-opt/uniform_array_move_out/rustc.move_out_by_subslice.mir_map.0.mir +++ b/src/test/mir-opt/uniform_array_move_out/rustc.move_out_by_subslice.mir_map.0.mir @@ -83,7 +83,13 @@ fn move_out_by_subslice() -> () { FakeRead(ForLet, _1); // bb9[1]: scope 0 at $DIR/uniform_array_move_out.rs:11:9: 11:10 StorageLive(_6); // bb9[2]: scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17 _6 = move _1[0..2]; // bb9[3]: scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17 - _0 = (); // bb9[4]: scope 0 at $DIR/uniform_array_move_out.rs:10:27: 13:2 + _0 = const (); // bb9[4]: scope 0 at $DIR/uniform_array_move_out.rs:10:27: 13:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/uniform_array_move_out.rs:10:27: 13:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_6) -> [return: bb12, unwind: bb10]; // bb9[5]: scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2 } diff --git a/src/test/mir-opt/uniform_array_move_out/rustc.move_out_from_end.mir_map.0.mir b/src/test/mir-opt/uniform_array_move_out/rustc.move_out_from_end.mir_map.0.mir index 4a5cd625c9d39..851107efe11f2 100644 --- a/src/test/mir-opt/uniform_array_move_out/rustc.move_out_from_end.mir_map.0.mir +++ b/src/test/mir-opt/uniform_array_move_out/rustc.move_out_from_end.mir_map.0.mir @@ -83,7 +83,13 @@ fn move_out_from_end() -> () { FakeRead(ForLet, _1); // bb9[1]: scope 0 at $DIR/uniform_array_move_out.rs:5:9: 5:10 StorageLive(_6); // bb9[2]: scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16 _6 = move _1[1 of 2]; // bb9[3]: scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16 - _0 = (); // bb9[4]: scope 0 at $DIR/uniform_array_move_out.rs:4:24: 7:2 + _0 = const (); // bb9[4]: scope 0 at $DIR/uniform_array_move_out.rs:4:24: 7:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/uniform_array_move_out.rs:4:24: 7:2 + // + literal: Const { ty: (), val: Value(Scalar()) } drop(_6) -> [return: bb12, unwind: bb10]; // bb9[5]: scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2 } diff --git a/src/test/mir-opt/uninhabited-enum/rustc.process_void.SimplifyLocals.after.mir b/src/test/mir-opt/uninhabited-enum/rustc.process_void.SimplifyLocals.after.mir index 2eb820bbdc3c5..1ee2297daaca4 100644 --- a/src/test/mir-opt/uninhabited-enum/rustc.process_void.SimplifyLocals.after.mir +++ b/src/test/mir-opt/uninhabited-enum/rustc.process_void.SimplifyLocals.after.mir @@ -13,7 +13,14 @@ fn process_void(_1: *const Void) -> () { bb0: { StorageLive(_2); // bb0[0]: scope 0 at $DIR/uninhabited-enum.rs:14:8: 14:14 _2 = &(*_1); // bb0[1]: scope 2 at $DIR/uninhabited-enum.rs:14:26: 14:33 - StorageDead(_2); // bb0[2]: scope 0 at $DIR/uninhabited-enum.rs:17:1: 17:2 - return; // bb0[3]: scope 0 at $DIR/uninhabited-enum.rs:17:2: 17:2 + _0 = const (); // bb0[2]: scope 0 at $DIR/uninhabited-enum.rs:13:41: 17:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/uninhabited-enum.rs:13:41: 17:2 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_2); // bb0[3]: scope 0 at $DIR/uninhabited-enum.rs:17:1: 17:2 + return; // bb0[4]: scope 0 at $DIR/uninhabited-enum.rs:17:2: 17:2 } } diff --git a/src/test/mir-opt/uninhabited_enum_branching/rustc.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching/rustc.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index c8dde4d360cc0..fba77dfe239ef 100644 --- a/src/test/mir-opt/uninhabited_enum_branching/rustc.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/src/test/mir-opt/uninhabited_enum_branching/rustc.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -64,7 +64,13 @@ fn main() -> () { bb3: { StorageDead(_7); // bb3[0]: scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7 StorageDead(_6); // bb3[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7 - _0 = (); // bb3[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + _0 = const (); // bb3[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb3[3]: scope 0 at $DIR/uninhabited_enum_branching.rs:30:2: 30:2 } } diff --git a/src/test/mir-opt/uninhabited_enum_branching/rustc.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching/rustc.main.UninhabitedEnumBranching.diff index cccd6aa323006..35842fdaa4e7e 100644 --- a/src/test/mir-opt/uninhabited_enum_branching/rustc.main.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_enum_branching/rustc.main.UninhabitedEnumBranching.diff @@ -99,7 +99,13 @@ bb7: { StorageDead(_7); // bb7[0]: scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7 StorageDead(_6); // bb7[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:29:6: 29:7 - _0 = (); // bb7[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + _0 = const (); // bb7[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching.rs:19:11: 30:2 + // + literal: Const { ty: (), val: Value(Scalar()) } return; // bb7[3]: scope 0 at $DIR/uninhabited_enum_branching.rs:30:2: 30:2 } } diff --git a/src/test/mir-opt/unreachable/rustc.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable/rustc.main.UnreachablePropagation.diff index 3a239c6e3b05f..d530a99940983 100644 --- a/src/test/mir-opt/unreachable/rustc.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable/rustc.main.UnreachablePropagation.diff @@ -35,7 +35,13 @@ } bb2: { - _0 = (); // bb2[0]: scope 0 at $DIR/unreachable.rs:9:5: 19:6 + _0 = const (); // bb2[0]: scope 0 at $DIR/unreachable.rs:9:5: 19:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable.rs:9:5: 19:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb2[1]: scope 0 at $DIR/unreachable.rs:20:1: 20:2 return; // bb2[2]: scope 0 at $DIR/unreachable.rs:20:2: 20:2 - } @@ -64,7 +70,13 @@ - // mir::Constant - // + span: $DIR/unreachable.rs:15:18: 15:20 - // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } -- _5 = (); // bb4[1]: scope 2 at $DIR/unreachable.rs:14:16: 16:10 +- _5 = const (); // bb4[1]: scope 2 at $DIR/unreachable.rs:14:16: 16:10 +- // ty::Const +- // + ty: () +- // + val: Value(Scalar()) +- // mir::Constant +- // + span: $DIR/unreachable.rs:14:16: 16:10 +- // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb6; // bb4[2]: scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - @@ -76,7 +88,13 @@ - // mir::Constant - // + span: $DIR/unreachable.rs:13:18: 13:20 - // + literal: Const { ty: i32, val: Value(Scalar(0x00000015)) } -- _5 = (); // bb5[1]: scope 2 at $DIR/unreachable.rs:12:17: 14:10 +- _5 = const (); // bb5[1]: scope 2 at $DIR/unreachable.rs:12:17: 14:10 +- // ty::Const +- // + ty: () +- // + val: Value(Scalar()) +- // mir::Constant +- // + span: $DIR/unreachable.rs:12:17: 14:10 +- // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb6; // bb5[2]: scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - diff --git a/src/test/mir-opt/unreachable_asm/rustc.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm/rustc.main.UnreachablePropagation.diff index c32165a3893c7..2b3ab80fa0f81 100644 --- a/src/test/mir-opt/unreachable_asm/rustc.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm/rustc.main.UnreachablePropagation.diff @@ -37,7 +37,13 @@ } bb2: { - _0 = (); // bb2[0]: scope 0 at $DIR/unreachable_asm.rs:11:5: 23:6 + _0 = const (); // bb2[0]: scope 0 at $DIR/unreachable_asm.rs:11:5: 23:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm.rs:11:5: 23:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb2[1]: scope 0 at $DIR/unreachable_asm.rs:24:1: 24:2 return; // bb2[2]: scope 0 at $DIR/unreachable_asm.rs:24:2: 24:2 } @@ -66,7 +72,13 @@ // mir::Constant // + span: $DIR/unreachable_asm.rs:17:18: 17:20 // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } - _5 = (); // bb4[1]: scope 2 at $DIR/unreachable_asm.rs:16:16: 18:10 + _5 = const (); // bb4[1]: scope 2 at $DIR/unreachable_asm.rs:16:16: 18:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm.rs:16:16: 18:10 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb6; // bb4[2]: scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 } @@ -78,7 +90,13 @@ // mir::Constant // + span: $DIR/unreachable_asm.rs:15:18: 15:20 // + literal: Const { ty: i32, val: Value(Scalar(0x00000015)) } - _5 = (); // bb5[1]: scope 2 at $DIR/unreachable_asm.rs:14:17: 16:10 + _5 = const (); // bb5[1]: scope 2 at $DIR/unreachable_asm.rs:14:17: 16:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm.rs:14:17: 16:10 + // + literal: Const { ty: (), val: Value(Scalar()) } goto -> bb6; // bb5[2]: scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 } @@ -87,7 +105,13 @@ StorageDead(_5); // bb6[1]: scope 2 at $DIR/unreachable_asm.rs:18:9: 18:10 StorageLive(_7); // bb6[2]: scope 2 at $DIR/unreachable_asm.rs:21:9: 21:37 llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // bb6[3]: scope 3 at $DIR/unreachable_asm.rs:21:18: 21:35 - _7 = (); // bb6[4]: scope 3 at $DIR/unreachable_asm.rs:21:9: 21:37 + _7 = const (); // bb6[4]: scope 3 at $DIR/unreachable_asm.rs:21:9: 21:37 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm.rs:21:9: 21:37 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_7); // bb6[5]: scope 2 at $DIR/unreachable_asm.rs:21:36: 21:37 StorageLive(_8); // bb6[6]: scope 2 at $DIR/unreachable_asm.rs:22:9: 22:21 unreachable; // bb6[7]: scope 2 at $DIR/unreachable_asm.rs:22:15: 22:17 diff --git a/src/test/mir-opt/unreachable_asm_2/rustc.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm_2/rustc.main.UnreachablePropagation.diff index a374178756658..c3760f6a7fccf 100644 --- a/src/test/mir-opt/unreachable_asm_2/rustc.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm_2/rustc.main.UnreachablePropagation.diff @@ -40,7 +40,13 @@ } bb2: { - _0 = (); // bb2[0]: scope 0 at $DIR/unreachable_asm_2.rs:11:5: 25:6 + _0 = const (); // bb2[0]: scope 0 at $DIR/unreachable_asm_2.rs:11:5: 25:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm_2.rs:11:5: 25:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb2[1]: scope 0 at $DIR/unreachable_asm_2.rs:26:1: 26:2 return; // bb2[2]: scope 0 at $DIR/unreachable_asm_2.rs:26:2: 26:2 } @@ -64,7 +70,13 @@ bb4: { StorageLive(_8); // bb4[0]: scope 2 at $DIR/unreachable_asm_2.rs:20:13: 20:41 llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // bb4[1]: scope 4 at $DIR/unreachable_asm_2.rs:20:22: 20:39 - _8 = (); // bb4[2]: scope 4 at $DIR/unreachable_asm_2.rs:20:13: 20:41 + _8 = const (); // bb4[2]: scope 4 at $DIR/unreachable_asm_2.rs:20:13: 20:41 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm_2.rs:20:13: 20:41 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_8); // bb4[3]: scope 2 at $DIR/unreachable_asm_2.rs:20:40: 20:41 _4 = const 42i32; // bb4[4]: scope 2 at $DIR/unreachable_asm_2.rs:21:13: 21:20 // ty::Const @@ -73,7 +85,13 @@ // mir::Constant // + span: $DIR/unreachable_asm_2.rs:21:18: 21:20 // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } - _5 = (); // bb4[5]: scope 2 at $DIR/unreachable_asm_2.rs:18:16: 22:10 + _5 = const (); // bb4[5]: scope 2 at $DIR/unreachable_asm_2.rs:18:16: 22:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm_2.rs:18:16: 22:10 + // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb6; // bb4[6]: scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 + unreachable; // bb4[6]: scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 } @@ -81,7 +99,13 @@ bb5: { StorageLive(_7); // bb5[0]: scope 2 at $DIR/unreachable_asm_2.rs:16:13: 16:41 llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // bb5[1]: scope 3 at $DIR/unreachable_asm_2.rs:16:22: 16:39 - _7 = (); // bb5[2]: scope 3 at $DIR/unreachable_asm_2.rs:16:13: 16:41 + _7 = const (); // bb5[2]: scope 3 at $DIR/unreachable_asm_2.rs:16:13: 16:41 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm_2.rs:16:13: 16:41 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_7); // bb5[3]: scope 2 at $DIR/unreachable_asm_2.rs:16:40: 16:41 _4 = const 21i32; // bb5[4]: scope 2 at $DIR/unreachable_asm_2.rs:17:13: 17:20 // ty::Const @@ -90,7 +114,13 @@ // mir::Constant // + span: $DIR/unreachable_asm_2.rs:17:18: 17:20 // + literal: Const { ty: i32, val: Value(Scalar(0x00000015)) } - _5 = (); // bb5[5]: scope 2 at $DIR/unreachable_asm_2.rs:14:17: 18:10 + _5 = const (); // bb5[5]: scope 2 at $DIR/unreachable_asm_2.rs:14:17: 18:10 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_asm_2.rs:14:17: 18:10 + // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb6; // bb5[6]: scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 - } - diff --git a/src/test/mir-opt/unreachable_diverging/rustc.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging/rustc.main.UnreachablePropagation.diff index 8d1d137f192ec..2fe0c8dc1e785 100644 --- a/src/test/mir-opt/unreachable_diverging/rustc.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging/rustc.main.UnreachablePropagation.diff @@ -42,7 +42,13 @@ } bb2: { - _0 = (); // bb2[0]: scope 1 at $DIR/unreachable_diverging.rs:14:5: 19:6 + _0 = const (); // bb2[0]: scope 1 at $DIR/unreachable_diverging.rs:14:5: 19:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/unreachable_diverging.rs:14:5: 19:6 + // + literal: Const { ty: (), val: Value(Scalar()) } StorageDead(_1); // bb2[1]: scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 StorageDead(_2); // bb2[2]: scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 return; // bb2[3]: scope 0 at $DIR/unreachable_diverging.rs:20:2: 20:2 @@ -59,14 +65,20 @@ } bb4: { -- _5 = (); // bb4[0]: scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // bb4[0]: scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 ++ _5 = const loop_forever() -> bb5; // bb4[0]: scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 + // ty::Const +- // + ty: () +- // + val: Value(Scalar()) +- // mir::Constant +- // + span: $DIR/unreachable_diverging.rs:15:9: 17:10 +- // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb6; // bb4[1]: scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - - bb5: { - _5 = const loop_forever() -> bb6; // bb5[0]: scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = const loop_forever() -> bb5; // bb4[0]: scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 - // ty::Const +- // ty::Const // + ty: fn() {loop_forever} // + val: Value(Scalar()) // mir::Constant diff --git a/src/test/mir-opt/while-storage/rustc.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while-storage/rustc.while_loop.PreCodegen.after.mir index 8fadcb8c12f30..0ac7989166ee0 100644 --- a/src/test/mir-opt/while-storage/rustc.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while-storage/rustc.while_loop.PreCodegen.after.mir @@ -23,40 +23,58 @@ fn while_loop(_1: bool) -> () { bb1: { StorageDead(_3); // bb1[0]: scope 0 at $DIR/while-storage.rs:10:21: 10:22 - switchInt(_2) -> [false: bb6, otherwise: bb2]; // bb1[1]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 + switchInt(_2) -> [false: bb2, otherwise: bb3]; // bb1[1]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 } bb2: { - StorageLive(_4); // bb2[0]: scope 0 at $DIR/while-storage.rs:11:12: 11:23 - StorageLive(_5); // bb2[1]: scope 0 at $DIR/while-storage.rs:11:21: 11:22 - _5 = _1; // bb2[2]: scope 0 at $DIR/while-storage.rs:11:21: 11:22 - _4 = const get_bool(move _5) -> bb3; // bb2[3]: scope 0 at $DIR/while-storage.rs:11:12: 11:23 + _0 = const (); // bb2[0]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 // ty::Const - // + ty: fn(bool) -> bool {get_bool} + // + ty: () // + val: Value(Scalar()) // mir::Constant - // + span: $DIR/while-storage.rs:11:12: 11:20 - // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } + // + span: $DIR/while-storage.rs:10:5: 14:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb7; // bb2[1]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 } bb3: { - StorageDead(_5); // bb3[0]: scope 0 at $DIR/while-storage.rs:11:22: 11:23 - switchInt(_4) -> [false: bb4, otherwise: bb5]; // bb3[1]: scope 0 at $DIR/while-storage.rs:11:9: 13:10 + StorageLive(_4); // bb3[0]: scope 0 at $DIR/while-storage.rs:11:12: 11:23 + StorageLive(_5); // bb3[1]: scope 0 at $DIR/while-storage.rs:11:21: 11:22 + _5 = _1; // bb3[2]: scope 0 at $DIR/while-storage.rs:11:21: 11:22 + _4 = const get_bool(move _5) -> bb4; // bb3[3]: scope 0 at $DIR/while-storage.rs:11:12: 11:23 + // ty::Const + // + ty: fn(bool) -> bool {get_bool} + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while-storage.rs:11:12: 11:20 + // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } } bb4: { - StorageDead(_4); // bb4[0]: scope 0 at $DIR/while-storage.rs:14:5: 14:6 - StorageDead(_2); // bb4[1]: scope 0 at $DIR/while-storage.rs:10:21: 10:22 - goto -> bb0; // bb4[2]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 + StorageDead(_5); // bb4[0]: scope 0 at $DIR/while-storage.rs:11:22: 11:23 + switchInt(_4) -> [false: bb5, otherwise: bb6]; // bb4[1]: scope 0 at $DIR/while-storage.rs:11:9: 13:10 } bb5: { StorageDead(_4); // bb5[0]: scope 0 at $DIR/while-storage.rs:14:5: 14:6 - goto -> bb6; // bb5[1]: scope 0 at $DIR/while-storage.rs:12:13: 12:18 + StorageDead(_2); // bb5[1]: scope 0 at $DIR/while-storage.rs:10:21: 10:22 + goto -> bb0; // bb5[2]: scope 0 at $DIR/while-storage.rs:10:5: 14:6 } bb6: { - StorageDead(_2); // bb6[0]: scope 0 at $DIR/while-storage.rs:10:21: 10:22 - return; // bb6[1]: scope 0 at $DIR/while-storage.rs:15:2: 15:2 + _0 = const (); // bb6[0]: scope 0 at $DIR/while-storage.rs:12:13: 12:18 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while-storage.rs:12:13: 12:18 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_4); // bb6[1]: scope 0 at $DIR/while-storage.rs:14:5: 14:6 + goto -> bb7; // bb6[2]: scope 0 at $DIR/while-storage.rs:12:13: 12:18 + } + + bb7: { + StorageDead(_2); // bb7[0]: scope 0 at $DIR/while-storage.rs:10:21: 10:22 + return; // bb7[1]: scope 0 at $DIR/while-storage.rs:15:2: 15:2 } }