From fc2244ae5f602fb348a72303936c1e9b58c985f6 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 22 Mar 2021 16:28:37 +0000 Subject: [PATCH] Encode strings as Symbol in value tree representation --- .../rustc_codegen_cranelift/src/constant.rs | 23 +++++++++++-------- compiler/rustc_codegen_ssa/src/mir/operand.rs | 23 +++++++++++-------- .../rustc_middle/src/ty/consts/valtree.rs | 18 +++++++++++---- compiler/rustc_middle/src/ty/print/pretty.rs | 9 ++------ compiler/rustc_mir/src/const_eval/mod.rs | 20 +++++++++++++--- compiler/rustc_mir/src/interpret/operand.rs | 14 ++++------- compiler/rustc_mir_build/src/thir/constant.rs | 2 +- ...implifyCfg-elaborate-drops.after.32bit.mir | 2 +- ..._allocation.main.ConstProp.after.32bit.mir | 5 +--- ...allocation2.main.ConstProp.after.32bit.mir | 5 +--- ...allocation3.main.ConstProp.after.32bit.mir | 3 --- .../const_debuginfo.main.ConstDebugInfo.diff | 4 ++-- ...l_flow_simplification.hello.ConstProp.diff | 4 ++-- .../inline/inline_diverging.g.Inline.diff | 4 ++-- ...line_into_box_place.main.Inline.32bit.diff | 4 ++-- ...ment_coverage.main.InstrumentCoverage.diff | 2 +- .../issue_72181.main.mir_map.0.32bit.mir | 2 +- .../issue_73223.main.PreCodegen.32bit.diff | 5 +--- ..._73223.main.SimplifyArmIdentity.32bit.diff | 8 +------ ...76432.test.SimplifyComparisonIntegral.diff | 4 ++-- ...ue_59352.num_to_digit.PreCodegen.after.mir | 4 ++-- ...egion_subtyping_basic.main.nll.0.32bit.mir | 22 +++++++++--------- ...wrap.SimplifyCfg-elaborate-drops.after.mir | 4 ++-- ..._after_call.main.ElaborateDrops.before.mir | 4 ++-- ...age_live_dead_in_statics.XXX.mir_map.0.mir | 4 ++-- ...after-uninhabited-enum-branching.after.mir | 12 +++++----- ...anching.main.UninhabitedEnumBranching.diff | 20 ++++++++-------- ...2_.AddMovesForPackedDrops.before.32bit.mir | 2 +- 28 files changed, 120 insertions(+), 113 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index 34da1fbc9d5b8..b7e78052a4966 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -154,13 +154,8 @@ pub(crate) fn codegen_valtree<'tcx>( ) -> CValue<'tcx> { let layout = fx.layout_of(ty); let tcx = fx.tcx; - let mut encode_slice = |valtree: ty::ValTree<'_>| { - let s: Vec = valtree - .unwrap_branch() - .iter() - .map(|b| u8::try_from(b.unwrap_leaf()).unwrap()) - .collect(); - let alloc_id = fx.tcx.allocate_bytes(&s); + let mut encode_slice = |s| { + let alloc_id = fx.tcx.allocate_bytes(s); let ptr = pointer_for_alloc_id(fx, alloc_id, Mutability::Not).get_addr(fx); let len = fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(s.len()).unwrap()); @@ -169,8 +164,18 @@ pub(crate) fn codegen_valtree<'tcx>( match *ty.kind() { ty::Ref(_, pointee, _) => match *pointee.kind() { - ty::Str => encode_slice(valtree), - ty::Slice(elem_ty) if elem_ty == tcx.types.u8 => encode_slice(valtree), + ty::Str => { + let s = valtree.unwrap_str().as_str(); + encode_slice(s.as_bytes()) + } + ty::Slice(elem_ty) if elem_ty == tcx.types.u8 => { + let s: Vec = valtree + .unwrap_branch() + .iter() + .map(|b| u8::try_from(b.unwrap_leaf()).unwrap()) + .collect(); + encode_slice(&s) + } ty::Array(elem_ty, _) if elem_ty == tcx.types.u8 => { let s: Vec = valtree .unwrap_branch() diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index c6a86d9b135f8..83d17b3e361ab 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -79,13 +79,8 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { return OperandRef::new_zst(bx, layout); } - let encode_slice = |valtree: ValTree<'_>| { - let s: Vec = valtree - .unwrap_branch() - .iter() - .map(|b| u8::try_from(b.unwrap_leaf()).unwrap()) - .collect(); - let alloc_id = bx.tcx().allocate_bytes(&s); + let encode_slice = |s| { + let alloc_id = bx.tcx().allocate_bytes(s); let a_scalar = match layout.abi { Abi::ScalarPair(ref a, _) => a, @@ -104,8 +99,18 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { let val = match val { Err(valtree) => match ty.kind() { ty::Ref(_, pointee, _) => match *pointee.kind() { - ty::Str => encode_slice(valtree), - ty::Slice(elem_ty) if elem_ty == bx.tcx().types.u8 => encode_slice(valtree), + ty::Str => { + let s = valtree.unwrap_str().as_str(); + encode_slice(s.as_bytes()) + } + ty::Slice(elem_ty) if elem_ty == bx.tcx().types.u8 => { + let s: Vec = valtree + .unwrap_branch() + .iter() + .map(|b| u8::try_from(b.unwrap_leaf()).unwrap()) + .collect(); + encode_slice(&s) + } ty::Array(elem_ty, _) if elem_ty == bx.tcx().types.u8 => { let s: Vec = valtree .unwrap_branch() diff --git a/compiler/rustc_middle/src/ty/consts/valtree.rs b/compiler/rustc_middle/src/ty/consts/valtree.rs index 0256312ac9e0e..e9e852ae35c67 100644 --- a/compiler/rustc_middle/src/ty/consts/valtree.rs +++ b/compiler/rustc_middle/src/ty/consts/valtree.rs @@ -2,6 +2,7 @@ use crate::ty::TyCtxt; use super::ScalarInt; use rustc_macros::HashStable; +use rustc_span::Symbol; #[derive(Copy, Clone, Debug, Hash, TyEncodable, TyDecodable, Eq, PartialEq, Ord, PartialOrd)] #[derive(HashStable)] @@ -30,33 +31,42 @@ pub enum ValTree<'tcx> { /// Enums are represented by storing their discriminant as a field, followed by all /// the fields of the variant. /// - /// `&str` and `&[T]` are encoded as if they were `&[T;N]`. So there is no wide pointer + /// `&[T]` are encoded as if they were `&[T;N]`. So there is no wide pointer /// or metadata encoded, instead the length is taken directly from the number of elements /// in the branch. Branch(&'tcx [ValTree<'tcx>]), + /// `&str` could be encoded as a `Branch`, but the back and forth between valtree + /// representations and other representations of `str` is expensive. + Str(Symbol), } impl ValTree<'tcx> { pub fn zst() -> Self { Self::Branch(&[]) } + pub fn unwrap_str(self) -> Symbol { + match self { + Self::Str(s) => s, + _ => bug!("expected str, got {:?}", self), + } + } pub fn unwrap_leaf(self) -> ScalarInt { match self { Self::Leaf(s) => s, - Self::Branch(branch) => bug!("expected leaf, got {:?}", branch), + _ => bug!("expected leaf, got {:?}", self), } } pub fn unwrap_branch(self) -> &'tcx [Self] { match self { - Self::Leaf(s) => bug!("expected branch, got {:?}", s), Self::Branch(branch) => branch, + _ => bug!("expected branch, got {:?}", self), } } #[inline] pub fn try_to_scalar_int(self) -> Option { match self { Self::Leaf(s) => Some(s), - Self::Branch(_) => None, + Self::Str(_) | Self::Branch(_) => None, } } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index ceda72aecdde8..e8e07e683ea56 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1143,13 +1143,7 @@ pub trait PrettyPrinter<'tcx>: match ty.kind() { ty::Ref(_, pointee, _) => match *pointee.kind() { ty::Str => { - let s: Vec = ct - .unwrap_branch() - .iter() - .map(|b| u8::try_from(b.unwrap_leaf()).unwrap()) - .collect(); - let s = String::from_utf8(s).unwrap(); - p!(write("{:?}", s)); + p!(write("{:?}", ct.unwrap_str().as_str())); Ok(self) } // Special case byte strings @@ -1174,6 +1168,7 @@ pub trait PrettyPrinter<'tcx>: _ => match ct { ty::ValTree::Leaf(int) => self.pretty_print_const_scalar_int(int, ty, print_ty), ty::ValTree::Branch(branches) => bug!("{}: {:?}", ty, branches), + ty::ValTree::Str(s) => bug!("{}: {}", ty, s), }, } } diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_mir/src/const_eval/mod.rs index 955a574721207..2b36f1592e673 100644 --- a/compiler/rustc_mir/src/const_eval/mod.rs +++ b/compiler/rustc_mir/src/const_eval/mod.rs @@ -10,7 +10,7 @@ use rustc_middle::{ ty::{self, Ty, TyCtxt}, }; use rustc_span::{source_map::DUMMY_SP, symbol::Symbol}; -use rustc_target::abi::{LayoutOf, VariantIdx}; +use rustc_target::abi::{LayoutOf, Size, VariantIdx}; use crate::interpret::{ intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, MPlaceTy, MemPlaceMeta, Scalar, @@ -123,8 +123,22 @@ fn const_to_valtree<'tcx>( branches(ecx, n.try_into().unwrap(), None, &mplace) }; match mplace.layout.ty.kind() { - // str slices are encoded as a `u8` array. - ty::Str => array(ecx.tcx.types.u8), + ty::Str => { + let n = scalar.to_machine_usize(ecx).unwrap(); + if n > 0 { + let ptr = mplace.ptr.assert_ptr(); + let s = ecx.memory.get_raw(ptr.alloc_id).unwrap().get_bytes( + ecx, + ptr, + Size::from_bytes(n), + ).unwrap(); + let s = std::str::from_utf8(s).unwrap(); + let s = Symbol::intern(s); + Ok(Some(ty::ValTree::Str(s))) + } else { + Ok(Some(ty::ValTree::Str(Symbol::intern("")))) + } + }, // Slices are encoded as an array ty::Slice(elem_ty) => array(elem_ty), // No other unsized types are structural match. diff --git a/compiler/rustc_mir/src/interpret/operand.rs b/compiler/rustc_mir/src/interpret/operand.rs index 0596823f9aa0b..55b514a70a1b1 100644 --- a/compiler/rustc_mir/src/interpret/operand.rs +++ b/compiler/rustc_mir/src/interpret/operand.rs @@ -593,18 +593,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(OpTy { op, layout }) } ty::Str => { - let bytes: Vec = val - .unwrap_branch() - .iter() - .map(|vt| u8::try_from(vt.unwrap_leaf()).unwrap()) - .collect(); - let alloc_id = self.tcx.allocate_bytes(&bytes); + let s = val.unwrap_str().as_str(); + let alloc_id = self.tcx.allocate_bytes(s.as_bytes()); let ptr = self.global_base_pointer(alloc_id.into())?; let layout = from_known_layout(self.tcx, self.param_env, layout, || self.layout_of(ty))?; let op = Operand::Immediate(Immediate::new_slice( ptr.into(), - u64::try_from(bytes.len()).unwrap(), + u64::try_from(s.len()).unwrap(), self, )); Ok(OpTy { op, layout }) @@ -620,11 +616,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ValTree::Leaf(int) => { self.const_val_to_op(ConstValue::Scalar(int.into()), ty, layout) } - ValTree::Branch(branches) => span_bug!( + ValTree::Str(_) | ValTree::Branch(_) => span_bug!( self.cur_span(), "complex valtrees of type {} are unimplemented: {:?}", ty, - branches + val ), }, } diff --git a/compiler/rustc_mir_build/src/thir/constant.rs b/compiler/rustc_mir_build/src/thir/constant.rs index 1ace5850c6345..c0c68d53fb815 100644 --- a/compiler/rustc_mir_build/src/thir/constant.rs +++ b/compiler/rustc_mir_build/src/thir/constant.rs @@ -29,7 +29,7 @@ crate fn lit_to_const<'tcx>( }; let val = match (lit, &ty.kind()) { - (ast::LitKind::Str(s, _), ty::Ref(..)) => byte_array(s.as_str().as_bytes()), + (ast::LitKind::Str(s, _), ty::Ref(..)) => ValTree::Str(*s), (ast::LitKind::ByteStr(data), ty::Ref(..)) => byte_array(data), (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => { ValTree::Leaf(ScalarInt::from_uint(*n, Size::from_bytes(1))) diff --git a/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir b/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir index deb5dbad7de67..0f0549939c8ea 100644 --- a/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir +++ b/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir @@ -39,7 +39,7 @@ fn main() -> () { _5 = foo(move _6) -> bb1; // scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27 // mir::Constant // + span: $DIR/array-index-is-temporary.rs:16:21: 16:24 - // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar()) } + // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Leaf()) } } bb1: { diff --git a/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir index a046539665b93..0a55feecbc480 100644 --- a/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir @@ -9,12 +9,9 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 _2 = const {alloc0: &&[(Option, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 - // ty::Const - // + ty: &&[(std::option::Option, &[&str])] - // + val: Value(Scalar(alloc0)) // mir::Constant // + span: $DIR/const_allocation.rs:8:5: 8:8 - // + literal: Const { ty: &&[(std::option::Option, &[&str])], val: Value(Scalar(alloc0)) } + // + literal: Const { ty: &&[(Option, &[&str])], val: Value(Scalar(alloc0)) } _1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9 StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9 diff --git a/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir index 1e4bd4ba914d5..e5711cd582690 100644 --- a/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir @@ -9,12 +9,9 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 _2 = const {alloc0: &&[(Option, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 - // ty::Const - // + ty: &&[(std::option::Option, &[&u8])] - // + val: Value(Scalar(alloc0)) // mir::Constant // + span: $DIR/const_allocation2.rs:5:5: 5:8 - // + literal: Const { ty: &&[(std::option::Option, &[&u8])], val: Value(Scalar(alloc0)) } + // + literal: Const { ty: &&[(Option, &[&u8])], val: Value(Scalar(alloc0)) } _1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 diff --git a/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir index 5c95afb586ff2..6122d17fb3e1c 100644 --- a/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir @@ -9,9 +9,6 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 _2 = const {alloc0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 - // ty::Const - // + ty: &&Packed - // + val: Value(Scalar(alloc0)) // mir::Constant // + span: $DIR/const_allocation3.rs:5:5: 5:8 // + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0)) } diff --git a/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff index cd72b8e807d57..4c132ee9a7eca 100644 --- a/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff +++ b/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff @@ -77,10 +77,10 @@ _9 = const "hello, world!"; // scope 4 at $DIR/const_debuginfo.rs:14:13: 14:28 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x68), Leaf(0x65), Leaf(0x6c), Leaf(0x6c), Leaf(0x6f), Leaf(0x2c), Leaf(0x20), Leaf(0x77), Leaf(0x6f), Leaf(0x72), Leaf(0x6c), Leaf(0x64), Leaf(0x21)])) + // + val: Value(Str("hello, world!")) // mir::Constant // + span: $DIR/const_debuginfo.rs:14:13: 14:28 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x68), Leaf(0x65), Leaf(0x6c), Leaf(0x6c), Leaf(0x6f), Leaf(0x2c), Leaf(0x20), Leaf(0x77), Leaf(0x6f), Leaf(0x72), Leaf(0x6c), Leaf(0x64), Leaf(0x21)])) } + // + literal: Const { ty: &str, val: Value(Str("hello, world!")) } StorageLive(_10); // scope 5 at $DIR/const_debuginfo.rs:16:9: 16:10 (_10.0: bool) = const true; // scope 5 at $DIR/const_debuginfo.rs:16:13: 16:34 (_10.1: bool) = const false; // scope 5 at $DIR/const_debuginfo.rs:16:13: 16:34 diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index bd54bca114ab7..f47a0c3cafb08 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -22,10 +22,10 @@ // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Leaf()) } // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) + // + val: Value(Str("explicit panic")) // mir::Constant // + span: $SRC_DIR/std/src/panic.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) } + // + literal: Const { ty: &str, val: Value(Str("explicit panic")) } } bb2: { diff --git a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff index f93c8e239e5bd..e6ca42d657236 100644 --- a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff @@ -43,10 +43,10 @@ + // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Leaf()) } + // ty::Const + // + ty: &str -+ // + val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) ++ // + val: Value(Str("explicit panic")) + // mir::Constant + // + span: $DIR/inline-diverging.rs:16:9: 16:16 -+ // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) } ++ // + literal: Const { ty: &str, val: Value(Str("explicit panic")) } } } diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff index fdaf36f409691..be823e2d34093 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff @@ -24,7 +24,7 @@ // mir::Constant - // + 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()) } +- // + literal: Const { ty: fn() -> std::vec::Vec {std::vec::Vec::::new}, val: Value(Leaf()) } - } - - bb1: { @@ -55,7 +55,7 @@ - _3 = alloc::alloc::box_free::, std::alloc::Global>(move (_2.0: std::ptr::Unique>), move (_2.1: std::alloc::Global)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(std::ptr::Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value(Scalar()) } +- // + literal: Const { ty: unsafe fn(std::ptr::Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value(Leaf()) } } } diff --git a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 226db9558ef46..43a8d32450fa9 100644 --- a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -17,7 +17,7 @@ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 0 at /the/src/instrument_coverage.rs:12:12: 12:17 // mir::Constant // + span: /the/src/instrument_coverage.rs:12:12: 12:15 - // + literal: Const { ty: fn() -> bool {bar}, val: Value(Scalar()) } + // + literal: Const { ty: fn() -> bool {bar}, val: Value(Leaf()) } } bb2: { diff --git a/src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir b/src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir index cf66a501e35ee..a5e889cf368fe 100644 --- a/src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir +++ b/src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir @@ -25,7 +25,7 @@ fn main() -> () { _1 = std::mem::size_of::() -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-72181.rs:24:13: 24:34 // mir::Constant // + span: $DIR/issue-72181.rs:24:13: 24:32 - // + literal: Const { ty: fn() -> usize {std::mem::size_of::}, val: Value(Scalar()) } + // + literal: Const { ty: fn() -> usize {std::mem::size_of::}, val: Value(Leaf()) } } bb1: { diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 95a8ef997fa49..0b9e3ebab2c8e 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -103,10 +103,7 @@ core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } - // ty::Const - // + ty: core::panicking::AssertKind - // + val: Value(Scalar(0x00)) + // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Leaf()) } // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index 261eb3b27eafd..8dcf46a123d0c 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -117,9 +117,6 @@ StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // ty::Const - // + ty: core::panicking::AssertKind - // + val: Value(Scalar(0x00)) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } @@ -136,10 +133,7 @@ core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } - // ty::Const - // + ty: core::panicking::AssertKind - // + val: Value(Scalar(0x00)) + // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Leaf()) } // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index 74cec21e894e2..c706519d4dcbd 100644 --- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -71,10 +71,10 @@ // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Leaf()) } // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x69), Leaf(0x6e), Leaf(0x74), Leaf(0x65), Leaf(0x72), Leaf(0x6e), Leaf(0x61), Leaf(0x6c), Leaf(0x20), Leaf(0x65), Leaf(0x72), Leaf(0x72), Leaf(0x6f), Leaf(0x72), Leaf(0x3a), Leaf(0x20), Leaf(0x65), Leaf(0x6e), Leaf(0x74), Leaf(0x65), Leaf(0x72), Leaf(0x65), Leaf(0x64), Leaf(0x20), Leaf(0x75), Leaf(0x6e), Leaf(0x72), Leaf(0x65), Leaf(0x61), Leaf(0x63), Leaf(0x68), Leaf(0x61), Leaf(0x62), Leaf(0x6c), Leaf(0x65), Leaf(0x20), Leaf(0x63), Leaf(0x6f), Leaf(0x64), Leaf(0x65)])) + // + val: Value(Str("internal error: entered unreachable code")) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x69), Leaf(0x6e), Leaf(0x74), Leaf(0x65), Leaf(0x72), Leaf(0x6e), Leaf(0x61), Leaf(0x6c), Leaf(0x20), Leaf(0x65), Leaf(0x72), Leaf(0x72), Leaf(0x6f), Leaf(0x72), Leaf(0x3a), Leaf(0x20), Leaf(0x65), Leaf(0x6e), Leaf(0x74), Leaf(0x65), Leaf(0x72), Leaf(0x65), Leaf(0x64), Leaf(0x20), Leaf(0x75), Leaf(0x6e), Leaf(0x72), Leaf(0x65), Leaf(0x61), Leaf(0x63), Leaf(0x68), Leaf(0x61), Leaf(0x62), Leaf(0x6c), Leaf(0x65), Leaf(0x20), Leaf(0x63), Leaf(0x6f), Leaf(0x64), Leaf(0x65)])) } + // + literal: Const { ty: &str, val: Value(Str("internal error: entered unreachable code")) } } bb2: { diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 18f28efb0f80e..870c93f6fdd09 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -92,10 +92,10 @@ fn num_to_digit(_1: char) -> u32 { // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Leaf()) } // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x63), Leaf(0x61), Leaf(0x6c), Leaf(0x6c), Leaf(0x65), Leaf(0x64), Leaf(0x20), Leaf(0x60), Leaf(0x4f), Leaf(0x70), Leaf(0x74), Leaf(0x69), Leaf(0x6f), Leaf(0x6e), Leaf(0x3a), Leaf(0x3a), Leaf(0x75), Leaf(0x6e), Leaf(0x77), Leaf(0x72), Leaf(0x61), Leaf(0x70), Leaf(0x28), Leaf(0x29), Leaf(0x60), Leaf(0x20), Leaf(0x6f), Leaf(0x6e), Leaf(0x20), Leaf(0x61), Leaf(0x20), Leaf(0x60), Leaf(0x4e), Leaf(0x6f), Leaf(0x6e), Leaf(0x65), Leaf(0x60), Leaf(0x20), Leaf(0x76), Leaf(0x61), Leaf(0x6c), Leaf(0x75), Leaf(0x65)])) + // + val: Value(Str("called `Option::unwrap()` on a `None` value")) // mir::Constant // + span: $DIR/issue-59352.rs:14:26: 14:50 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x63), Leaf(0x61), Leaf(0x6c), Leaf(0x6c), Leaf(0x65), Leaf(0x64), Leaf(0x20), Leaf(0x60), Leaf(0x4f), Leaf(0x70), Leaf(0x74), Leaf(0x69), Leaf(0x6f), Leaf(0x6e), Leaf(0x3a), Leaf(0x3a), Leaf(0x75), Leaf(0x6e), Leaf(0x77), Leaf(0x72), Leaf(0x61), Leaf(0x70), Leaf(0x28), Leaf(0x29), Leaf(0x60), Leaf(0x20), Leaf(0x6f), Leaf(0x6e), Leaf(0x20), Leaf(0x61), Leaf(0x20), Leaf(0x60), Leaf(0x4e), Leaf(0x6f), Leaf(0x6e), Leaf(0x65), Leaf(0x60), Leaf(0x20), Leaf(0x76), Leaf(0x61), Leaf(0x6c), Leaf(0x75), Leaf(0x65)])) } + // + literal: Const { ty: &str, val: Value(Str("called `Option::unwrap()` on a `None` value")) } } bb7: { diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index 8c939d5fc3da5..4c43431a72a1a 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -23,7 +23,7 @@ | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region-subtyping-basic.rs:16:11: 16:11 - let mut _1: [usize; Const { ty: usize, val: Value(Scalar(0x00000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14 + let mut _1: [usize; Const { ty: usize, val: Value(Leaf(0x00000003)) }]; // in scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14 let _3: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:18:16: 18:17 let mut _4: usize; // in scope 0 at $DIR/region-subtyping-basic.rs:18:14: 18:18 let mut _5: bool; // in scope 0 at $DIR/region-subtyping-basic.rs:18:14: 18:18 @@ -45,11 +45,11 @@ fn main() -> () { bb0: { StorageLive(_1); // bb0[0]: scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14 - _1 = [const Const(Value(Scalar(0x00000001)): usize), const Const(Value(Scalar(0x00000002)): usize), const Const(Value(Scalar(0x00000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:17:17: 17:26 + _1 = [const Const(Value(Leaf(0x00000001)): usize), const Const(Value(Leaf(0x00000002)): usize), const Const(Value(Leaf(0x00000003)): usize)]; // bb0[1]: scope 0 at $DIR/region-subtyping-basic.rs:17:17: 17:26 FakeRead(ForLet, _1); // bb0[2]: scope 0 at $DIR/region-subtyping-basic.rs:17:9: 17:14 StorageLive(_2); // bb0[3]: scope 1 at $DIR/region-subtyping-basic.rs:18:9: 18:10 StorageLive(_3); // bb0[4]: scope 1 at $DIR/region-subtyping-basic.rs:18:16: 18:17 - _3 = const Const(Value(Scalar(0x00000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:18:16: 18:17 + _3 = const Const(Value(Leaf(0x00000000)): usize); // bb0[5]: scope 1 at $DIR/region-subtyping-basic.rs:18:16: 18:17 _4 = Len(_1); // bb0[6]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18 _5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18 assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7]; // bb0[8]: scope 1 at $DIR/region-subtyping-basic.rs:18:14: 18:18 @@ -62,38 +62,38 @@ fn main() -> () { _6 = _2; // bb1[3]: scope 2 at $DIR/region-subtyping-basic.rs:19:13: 19:14 FakeRead(ForLet, _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - _7 = const Const(Value(Scalar(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb3, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 + _7 = const Const(Value(Leaf(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + switchInt(move _7) -> [Const(Value(Leaf(0x00)): bool): bb3, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } bb2: { StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 _9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _8 = Const(Value(Scalar()): fn(usize) -> bool {use_x})(move _9) -> [return: bb4, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + _8 = Const(Value(Leaf()): fn(usize) -> bool {use_x})(move _9) -> [return: bb4, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14 - // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar()) } + // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Leaf()) } } bb3: { StorageLive(_10); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 - _10 = Const(Value(Scalar()): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 + _10 = Const(Value(Leaf()): fn(usize) -> bool {use_x})(const Const(Value(Leaf(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:23:9: 23:14 - // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar()) } + // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Leaf()) } } bb4: { StorageDead(_9); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 StorageDead(_8); // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = const Const(Value(Scalar()): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 + _0 = const Const(Value(Leaf()): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 goto -> bb6; // bb4[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } bb5: { StorageDead(_10); // bb5[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:18: 23:19 - _0 = const Const(Value(Scalar()): ()); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:22:12: 24:6 + _0 = const Const(Value(Leaf()): ()); // bb5[1]: scope 3 at $DIR/region-subtyping-basic.rs:22:12: 24:6 goto -> bb6; // bb5[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } diff --git a/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir index 0c704ecf1248d..6f2019915a83b 100644 --- a/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir @@ -26,10 +26,10 @@ fn unwrap(_1: Option) -> T { // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Leaf()) } // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) + // + val: Value(Str("explicit panic")) // mir::Constant // + span: $SRC_DIR/std/src/panic.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x65), Leaf(0x78), Leaf(0x70), Leaf(0x6c), Leaf(0x69), Leaf(0x63), Leaf(0x69), Leaf(0x74), Leaf(0x20), Leaf(0x70), Leaf(0x61), Leaf(0x6e), Leaf(0x69), Leaf(0x63)])) } + // + literal: Const { ty: &str, val: Value(Str("explicit panic")) } } bb2: { diff --git a/src/test/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir b/src/test/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir index f880b2bd617d5..c32f425a0b915 100644 --- a/src/test/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir +++ b/src/test/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir @@ -15,10 +15,10 @@ fn main() -> () { _4 = const ""; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22 // ty::Const // + ty: &str - // + val: Value(Branch([])) + // + val: Value(Str("")) // mir::Constant // + span: $DIR/no-spurious-drop-after-call.rs:9:20: 9:22 - // + literal: Const { ty: &str, val: Value(Branch([])) } + // + literal: Const { ty: &str, val: Value(Str("")) } _3 = &(*_4); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22 _2 = ::to_string(move _3) -> bb1; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34 // mir::Constant diff --git a/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir b/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir index 3a8a092e3a33e..79e7a1a321c18 100644 --- a/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir +++ b/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir @@ -192,10 +192,10 @@ static XXX: &Foo = { _2 = Foo { tup: const "hi", data: move _3 }; // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:29: 23:2 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x68), Leaf(0x69)])) + // + val: Value(Str("hi")) // mir::Constant // + span: $DIR/storage_live_dead_in_statics.rs:6:10: 6:14 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x68), Leaf(0x69)])) } + // + literal: Const { ty: &str, val: Value(Str("hi")) } StorageDead(_3); // scope 0 at $DIR/storage_live_dead_in_statics.rs:23:1: 23:2 _1 = &_2; // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:28: 23:2 _0 = &(*_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:28: 23:2 diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index 904926f1733d1..a98cff87a0d2d 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -21,10 +21,10 @@ fn main() -> () { _5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x43)])) + // + val: Value(Str("C")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x43)])) } + // + literal: Const { ty: &str, val: Value(Str("C")) } _1 = &(*_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 StorageDead(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:23: 23:24 StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:24:6: 24:7 @@ -41,10 +41,10 @@ fn main() -> () { _9 = const "E"; // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x45)])) + // + val: Value(Str("E")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x45)])) } + // + literal: Const { ty: &str, val: Value(Str("E")) } _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24 StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:23: 28:24 goto -> bb3; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 @@ -54,10 +54,10 @@ fn main() -> () { _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:21: 27:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x44)])) + // + val: Value(Str("D")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x44)])) } + // + literal: Const { ty: &str, val: Value(Str("D")) } goto -> bb3; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 } diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff index 9326533d01aff..93e79426f0954 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff @@ -27,10 +27,10 @@ _5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x43)])) + // + val: Value(Str("C")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x43)])) } + // + literal: Const { ty: &str, val: Value(Str("C")) } _1 = &(*_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 StorageDead(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:23: 23:24 goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6 @@ -40,10 +40,10 @@ _1 = const "A(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:21:24: 21:34 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x41), Leaf(0x28), Leaf(0x45), Leaf(0x6d), Leaf(0x70), Leaf(0x74), Leaf(0x79), Leaf(0x29)])) + // + val: Value(Str("A(Empty)")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:21:24: 21:34 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x41), Leaf(0x28), Leaf(0x45), Leaf(0x6d), Leaf(0x70), Leaf(0x74), Leaf(0x79), Leaf(0x29)])) } + // + literal: Const { ty: &str, val: Value(Str("A(Empty)")) } goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6 } @@ -52,10 +52,10 @@ _4 = const "B(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x42), Leaf(0x28), Leaf(0x45), Leaf(0x6d), Leaf(0x70), Leaf(0x74), Leaf(0x79), Leaf(0x29)])) + // + val: Value(Str("B(Empty)")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:22:24: 22:34 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x42), Leaf(0x28), Leaf(0x45), Leaf(0x6d), Leaf(0x70), Leaf(0x74), Leaf(0x79), Leaf(0x29)])) } + // + literal: Const { ty: &str, val: Value(Str("B(Empty)")) } _1 = &(*_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34 StorageDead(_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:22:33: 22:34 goto -> bb4; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6 @@ -76,10 +76,10 @@ _9 = const "E"; // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x45)])) + // + val: Value(Str("E")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x45)])) } + // + literal: Const { ty: &str, val: Value(Str("E")) } _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24 StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:28:23: 28:24 goto -> bb7; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 @@ -89,10 +89,10 @@ _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:21: 27:24 // ty::Const // + ty: &str - // + val: Value(Branch([Leaf(0x44)])) + // + val: Value(Str("D")) // mir::Constant // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24 - // + literal: Const { ty: &str, val: Value(Branch([Leaf(0x44)])) } + // + literal: Const { ty: &str, val: Value(Str("D")) } goto -> bb7; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 } diff --git a/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir b/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir index 97c83010e22d0..8f76b9e342cb1 100644 --- a/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir +++ b/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir @@ -34,6 +34,6 @@ fn std::ptr::drop_in_place(_1: *mut Vec) -> () { _3 = as Drop>::drop(move _2) -> [return: bb5, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL - // + literal: Const { ty: for<'r> fn(&'r mut std::vec::Vec) { as std::ops::Drop>::drop}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r> fn(&'r mut std::vec::Vec) { as std::ops::Drop>::drop}, val: Value(Leaf()) } } }