From c1160a8f8662c743170c895332f5c82ca26e4d4a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 11 Dec 2018 19:54:38 +0100 Subject: [PATCH] treat ref-to-raw cast like a reborrow: do a special kind of retag --- src/librustc/ich/impls_mir.rs | 4 +- src/librustc/mir/mod.rs | 48 ++++++++-------- src/librustc/mir/visit.rs | 18 ++---- src/librustc_codegen_ssa/mir/statement.rs | 1 - src/librustc_mir/borrow_check/mod.rs | 1 - .../borrow_check/nll/invalidation.rs | 1 - .../borrow_check/nll/type_check/mod.rs | 1 - src/librustc_mir/dataflow/impls/borrows.rs | 1 - .../dataflow/move_paths/builder.rs | 1 - src/librustc_mir/interpret/cast.rs | 20 +++---- src/librustc_mir/interpret/machine.rs | 12 +--- src/librustc_mir/interpret/step.rs | 8 +-- src/librustc_mir/shim.rs | 13 +---- src/librustc_mir/transform/add_retag.rs | 55 ++++++++----------- src/librustc_mir/transform/check_unsafety.rs | 1 - src/librustc_mir/transform/generator.rs | 2 +- src/librustc_mir/transform/inline.rs | 9 +-- src/librustc_mir/transform/qualify_consts.rs | 1 - .../transform/qualify_min_const_fn.rs | 1 - .../transform/remove_noop_landing_pads.rs | 3 +- src/librustc_mir/transform/rustc_peek.rs | 1 - src/test/mir-opt/retag.rs | 2 +- 22 files changed, 76 insertions(+), 128 deletions(-) diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index a46e12be1aeac..d82020f59a10e 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -200,13 +200,13 @@ impl_stable_hash_for!(impl<'gcx> for enum mir::StatementKind<'gcx> [ mir::Statem SetDiscriminant { place, variant_index }, StorageLive(place), StorageDead(place), - EscapeToRaw(place), - Retag { fn_entry, two_phase, place }, + Retag(retag_kind, place), AscribeUserType(place, variance, c_ty), Nop, InlineAsm { asm, outputs, inputs }, }); +impl_stable_hash_for!(enum mir::RetagKind { FnEntry, TwoPhase, Raw, Default }); impl_stable_hash_for!(enum mir::FakeReadCause { ForMatchGuard, ForMatchedPlace, ForLet }); impl<'a, 'gcx> HashStable> for mir::Place<'gcx> { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 68b5c3e2df322..61fed669e1499 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1774,23 +1774,7 @@ pub enum StatementKind<'tcx> { /// by miri and only generated when "-Z mir-emit-retag" is passed. /// See /// for more details. - Retag { - /// `fn_entry` indicates whether this is the initial retag that happens in the - /// function prolog. - fn_entry: bool, - /// `two_phase` indicates whether this is just the reservation action of - /// a two-phase borrow. - two_phase: bool, - /// The place to retag - place: Place<'tcx>, - }, - - /// Escape the given reference to a raw pointer, so that it can be accessed - /// without precise provenance tracking. These statements are currently only interpreted - /// by miri and only generated when "-Z mir-emit-retag" is passed. - /// See - /// for more details. - EscapeToRaw(Operand<'tcx>), + Retag(RetagKind, Place<'tcx>), /// Encodes a user's type ascription. These need to be preserved /// intact so that NLL can respect them. For example: @@ -1810,6 +1794,19 @@ pub enum StatementKind<'tcx> { Nop, } +/// `RetagKind` describes what kind of retag is to be performed. +#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq)] +pub enum RetagKind { + /// The initial retag when entering a function + FnEntry, + /// Retag preparing for a two-phase borrow + TwoPhase, + /// Retagging raw pointers + Raw, + /// A "normal" retag + Default, +} + /// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists. #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)] pub enum FakeReadCause { @@ -1845,13 +1842,16 @@ impl<'tcx> Debug for Statement<'tcx> { match self.kind { Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv), FakeRead(ref cause, ref place) => write!(fmt, "FakeRead({:?}, {:?})", cause, place), - Retag { fn_entry, two_phase, ref place } => - write!(fmt, "Retag({}{}{:?})", - if fn_entry { "[fn entry] " } else { "" }, - if two_phase { "[2phase] " } else { "" }, + Retag(ref kind, ref place) => + write!(fmt, "Retag({}{:?})", + match kind { + RetagKind::FnEntry => "[fn entry] ", + RetagKind::TwoPhase => "[2phase] ", + RetagKind::Raw => "[raw] ", + RetagKind::Default => "", + }, place, ), - EscapeToRaw(ref place) => write!(fmt, "EscapeToRaw({:?})", place), StorageLive(ref place) => write!(fmt, "StorageLive({:?})", place), StorageDead(ref place) => write!(fmt, "StorageDead({:?})", place), SetDiscriminant { @@ -2965,6 +2965,7 @@ CloneTypeFoldableAndLiftImpls! { SourceInfo, UpvarDecl, FakeReadCause, + RetagKind, SourceScope, SourceScopeData, SourceScopeLocalData, @@ -3031,8 +3032,7 @@ EnumTypeFoldableImpl! { (StatementKind::StorageLive)(a), (StatementKind::StorageDead)(a), (StatementKind::InlineAsm) { asm, outputs, inputs }, - (StatementKind::Retag) { fn_entry, two_phase, place }, - (StatementKind::EscapeToRaw)(place), + (StatementKind::Retag)(kind, place), (StatementKind::AscribeUserType)(a, v, b), (StatementKind::Nop), } diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 237f6bc9c7b45..278a4dc1d873a 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -153,11 +153,10 @@ macro_rules! make_mir_visitor { } fn visit_retag(&mut self, - fn_entry: & $($mutability)* bool, - two_phase: & $($mutability)* bool, + kind: & $($mutability)* RetagKind, place: & $($mutability)* Place<'tcx>, location: Location) { - self.super_retag(fn_entry, two_phase, place, location); + self.super_retag(kind, place, location); } fn visit_place(&mut self, @@ -385,9 +384,6 @@ macro_rules! make_mir_visitor { location ); } - StatementKind::EscapeToRaw(ref $($mutability)* op) => { - self.visit_operand(op, location); - } StatementKind::StorageLive(ref $($mutability)* local) => { self.visit_local( local, @@ -417,10 +413,9 @@ macro_rules! make_mir_visitor { self.visit_operand(input, location); } } - StatementKind::Retag { ref $($mutability)* fn_entry, - ref $($mutability)* two_phase, - ref $($mutability)* place } => { - self.visit_retag(fn_entry, two_phase, place, location); + StatementKind::Retag ( ref $($mutability)* kind, + ref $($mutability)* place ) => { + self.visit_retag(kind, place, location); } StatementKind::AscribeUserType( ref $($mutability)* place, @@ -725,8 +720,7 @@ macro_rules! make_mir_visitor { } fn super_retag(&mut self, - _fn_entry: & $($mutability)* bool, - _two_phase: & $($mutability)* bool, + _kind: & $($mutability)* RetagKind, place: & $($mutability)* Place<'tcx>, location: Location) { self.visit_place( diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index 568a7e7e1600f..80539b78c7073 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -106,7 +106,6 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::StatementKind::FakeRead(..) | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => bx, } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 5eca62938f7a8..824acc89b1d52 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -590,7 +590,6 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx StatementKind::Nop | StatementKind::AscribeUserType(..) | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } | StatementKind::StorageLive(..) => { // `Nop`, `AscribeUserType`, `Retag`, and `StorageLive` are irrelevant // to borrow check. diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 07bda8af62618..d2810de284a89 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -135,7 +135,6 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { StatementKind::Nop | StatementKind::AscribeUserType(..) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::StorageLive(..) => { // `Nop`, `AscribeUserType`, `Retag`, and `StorageLive` are irrelevant // to borrow check. diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 4807abe2bdd19..b9fc100d9a2e6 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1316,7 +1316,6 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { | StatementKind::StorageDead(..) | StatementKind::InlineAsm { .. } | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } | StatementKind::Nop => {} } } diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 5e78ef03c2c6b..0bace39c7e395 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -300,7 +300,6 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { mir::StatementKind::SetDiscriminant { .. } | mir::StatementKind::StorageLive(..) | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => {} diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 7fe27e97d3d3b..d201a355a2ae9 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -302,7 +302,6 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { "SetDiscriminant should not exist during borrowck"); } StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => {} } diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 7d636b77ced4c..118539fc58ebf 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -44,22 +44,16 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } Misc => { - let src_layout = src.layout; let src = self.read_immediate(src)?; - // There are no casts to references - assert!(!dest.layout.ty.is_region_ptr()); - // Hence we make all casts erase the tag - let src = src.erase_tag().with_default_tag(); - - if self.type_is_fat_ptr(src_layout.ty) { - match (src, self.type_is_fat_ptr(dest.layout.ty)) { + if self.type_is_fat_ptr(src.layout.ty) { + match (*src, self.type_is_fat_ptr(dest.layout.ty)) { // pointers to extern types (Immediate::Scalar(_),_) | // slices and trait objects to other slices/trait objects (Immediate::ScalarPair(..), true) => { // No change to immediate - self.write_immediate(src, dest)?; + self.write_immediate(*src, dest)?; } // slices and trait objects to thin pointers (dropping the metadata) (Immediate::ScalarPair(data, _), false) => { @@ -67,11 +61,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } } } else { - match src_layout.variants { + match src.layout.variants { layout::Variants::Single { index } => { - if let Some(def) = src_layout.ty.ty_adt_def() { + if let Some(def) = src.layout.ty.ty_adt_def() { // Cast from a univariant enum - assert!(src_layout.is_zst()); + assert!(src.layout.is_zst()); let discr_val = def .discriminant_for_variant(*self.tcx, index) .val; @@ -84,7 +78,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> layout::Variants::NicheFilling { .. } => {}, } - let dest_val = self.cast_scalar(src.to_scalar()?, src_layout, dest.layout)?; + let dest_val = self.cast_scalar(src.to_scalar()?, src.layout, dest.layout)?; self.write_scalar(dest_val, dest)?; } } diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 4c7aa887045c7..e6f3b664c007b 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -203,22 +203,12 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { #[inline] fn retag( _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, - _fn_entry: bool, - _two_phase: bool, + _kind: mir::RetagKind, _place: PlaceTy<'tcx, Self::PointerTag>, ) -> EvalResult<'tcx> { Ok(()) } - /// Execute an escape-to-raw operation - #[inline] - fn escape_to_raw( - _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, - _ptr: OpTy<'tcx, Self::PointerTag>, - ) -> EvalResult<'tcx> { - Ok(()) - } - /// Called immediately before a new stack frame got pushed fn stack_push( ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index a6835e4f16738..596dba5760646 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -119,13 +119,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> FakeRead(..) => {} // Stacked Borrows. - Retag { fn_entry, two_phase, ref place } => { + Retag(kind, ref place) => { let dest = self.eval_place(place)?; - M::retag(self, fn_entry, two_phase, dest)?; - } - EscapeToRaw(ref op) => { - let op = self.eval_operand(op, None)?; - M::escape_to_raw(self, op)?; + M::retag(self, kind, dest)?; } // Statements we do not track. diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 114162946051e..0ed8ce2a1b896 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -226,20 +226,11 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // The first argument (index 0), but add 1 for the return value. let dropee_ptr = Place::Local(Local::new(1+0)); if tcx.sess.opts.debugging_opts.mir_emit_retag { - // Function arguments should be retagged + // Function arguments should be retagged, and we make this one raw. mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::Retag { - fn_entry: true, - two_phase: false, - place: dropee_ptr.clone(), - }, + kind: StatementKind::Retag(RetagKind::Raw, dropee_ptr.clone()), }); - // We use raw ptr operations, better prepare the alias tracking for that - mir.basic_blocks_mut()[START_BLOCK].statements.insert(1, Statement { - source_info, - kind: StatementKind::EscapeToRaw(Operand::Copy(dropee_ptr.clone())), - }) } let patch = { let param_env = tcx.param_env(def_id).with_reveal_all(); diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 811b85446cb23..69c0a68ae7051 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -118,7 +118,7 @@ impl MirPass for AddRetag { basic_blocks[START_BLOCK].statements.splice(0..0, places.into_iter().map(|place| Statement { source_info, - kind: StatementKind::Retag { fn_entry: true, two_phase: false, place }, + kind: StatementKind::Retag(RetagKind::FnEntry, place), }) ); } @@ -154,7 +154,7 @@ impl MirPass for AddRetag { for (source_info, dest_place, dest_block) in returns { basic_blocks[dest_block].statements.insert(0, Statement { source_info, - kind: StatementKind::Retag { fn_entry: false, two_phase: false, place: dest_place }, + kind: StatementKind::Retag(RetagKind::Default, dest_place), }); } @@ -164,9 +164,9 @@ impl MirPass for AddRetag { // We want to insert statements as we iterate. To this end, we // iterate backwards using indices. for i in (0..block_data.statements.len()).rev() { - match block_data.statements[i].kind { - // If we are casting *from* a reference, we may have to escape-to-raw. - StatementKind::Assign(_, box Rvalue::Cast( + let (retag_kind, place) = match block_data.statements[i].kind { + // If we are casting *from* a reference, we may have to retag-as-raw. + StatementKind::Assign(ref place, box Rvalue::Cast( CastKind::Misc, ref src, dest_ty, @@ -175,42 +175,35 @@ impl MirPass for AddRetag { if src_ty.is_region_ptr() { // The only `Misc` casts on references are those creating raw pointers. assert!(dest_ty.is_unsafe_ptr()); - // Insert escape-to-raw before the cast. We are not concerned - // with stability here: Our EscapeToRaw will not change the value - // that the cast will then use. - // `src` might be a "move", but we rely on this not actually moving - // but just doing a memcpy. It is crucial that we do EscapeToRaw - // on the src because we need it with its original type. - let source_info = block_data.statements[i].source_info; - block_data.statements.insert(i, Statement { - source_info, - kind: StatementKind::EscapeToRaw(src.clone()), - }); + (RetagKind::Raw, place) + } else { + // Some other cast, no retag + continue } } // Assignments of reference or ptr type are the ones where we may have // to update tags. This includes `x = &[mut] ...` and hence // we also retag after taking a reference! StatementKind::Assign(ref place, box ref rvalue) if needs_retag(place) => { - let two_phase = match rvalue { - Rvalue::Ref(_, borrow_kind, _) => - borrow_kind.allows_two_phase_borrow(), - _ => false + let kind = match rvalue { + Rvalue::Ref(_, borrow_kind, _) + if borrow_kind.allows_two_phase_borrow() + => + RetagKind::TwoPhase, + _ => + RetagKind::Default, }; - // Insert a retag after the assignment. - let source_info = block_data.statements[i].source_info; - block_data.statements.insert(i+1, Statement { - source_info, - kind: StatementKind::Retag { - fn_entry: false, - two_phase, - place: place.clone(), - }, - }); + (kind, place) } // Do nothing for the rest - _ => {}, + _ => continue, }; + // Insert a retag after the statement. + let source_info = block_data.statements[i].source_info; + block_data.statements.insert(i+1, Statement { + source_info, + kind: StatementKind::Retag(retag_kind, place.clone()), + }); } } } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 3607869384077..f6b7f817aad53 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -117,7 +117,6 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { StatementKind::StorageLive(..) | StatementKind::StorageDead(..) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => { // safe (at least as emitted during MIR construction) diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index f870e4a2a4227..fe19accb03137 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -689,7 +689,7 @@ fn create_generator_drop_shim<'a, 'tcx>( // Alias tracking must know we changed the type mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::EscapeToRaw(Operand::Copy(Place::Local(self_arg()))), + kind: StatementKind::Retag(RetagKind::Raw, Place::Local(self_arg())), }) } diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index afe0066df1f28..88424d75baa88 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -709,16 +709,17 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { fn visit_retag( &mut self, - fn_entry: &mut bool, - two_phase: &mut bool, + kind: &mut RetagKind, place: &mut Place<'tcx>, loc: Location, ) { - self.super_retag(fn_entry, two_phase, place, loc); + self.super_retag(kind, place, loc); // We have to patch all inlined retags to be aware that they are no longer // happening on function entry. - *fn_entry = false; + if *kind == RetagKind::FnEntry { + *kind = RetagKind::Default; + } } fn visit_terminator_kind(&mut self, block: BasicBlock, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 5f08dee872859..59e59ce479e04 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1237,7 +1237,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { StatementKind::StorageDead(_) | StatementKind::InlineAsm {..} | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => {} } diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 3c1b9dbd91fa8..85c6e3989aa32 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -243,7 +243,6 @@ fn check_statement( | StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => Ok(()), } diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 81b010e7dcec9..cdab5a1d7b011 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -65,8 +65,7 @@ impl RemoveNoopLandingPads { StatementKind::Assign { .. } | StatementKind::SetDiscriminant { .. } | StatementKind::InlineAsm { .. } | - StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } => { + StatementKind::Retag { .. } => { return false; } } diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index c996dc285f7e7..fabcba12f21bb 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -162,7 +162,6 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir::StatementKind::StorageDead(_) | mir::StatementKind::InlineAsm { .. } | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => continue, mir::StatementKind::SetDiscriminant{ .. } => diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index 7da55c0868cd2..f48862ff9330b 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -87,8 +87,8 @@ fn main() { // ... // _14 = &mut (*_10); // Retag(_14); -// EscapeToRaw(move _14); // _13 = move _14 as *mut i32 (Misc); +// Retag([raw] _13); // ... // _17 = move _18(move _19) -> bb2; // }