@@ -1788,23 +1788,7 @@ pub enum StatementKind<'tcx> {
17881788 /// by miri and only generated when "-Z mir-emit-retag" is passed.
17891789 /// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
17901790 /// for more details.
1791- Retag {
1792- /// `fn_entry` indicates whether this is the initial retag that happens in the
1793- /// function prolog.
1794- fn_entry : bool ,
1795- /// `two_phase` indicates whether this is just the reservation action of
1796- /// a two-phase borrow.
1797- two_phase : bool ,
1798- /// The place to retag
1799- place : Place < ' tcx > ,
1800- } ,
1801-
1802- /// Escape the given reference to a raw pointer, so that it can be accessed
1803- /// without precise provenance tracking. These statements are currently only interpreted
1804- /// by miri and only generated when "-Z mir-emit-retag" is passed.
1805- /// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
1806- /// for more details.
1807- EscapeToRaw ( Operand < ' tcx > ) ,
1791+ Retag ( RetagKind , Place < ' tcx > ) ,
18081792
18091793 /// Encodes a user's type ascription. These need to be preserved
18101794 /// intact so that NLL can respect them. For example:
@@ -1824,6 +1808,19 @@ pub enum StatementKind<'tcx> {
18241808 Nop ,
18251809}
18261810
1811+ /// `RetagKind` describes what kind of retag is to be performed.
1812+ #[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug , PartialEq , Eq ) ]
1813+ pub enum RetagKind {
1814+ /// The initial retag when entering a function
1815+ FnEntry ,
1816+ /// Retag preparing for a two-phase borrow
1817+ TwoPhase ,
1818+ /// Retagging raw pointers
1819+ Raw ,
1820+ /// A "normal" retag
1821+ Default ,
1822+ }
1823+
18271824/// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists.
18281825#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug ) ]
18291826pub enum FakeReadCause {
@@ -1859,13 +1856,16 @@ impl<'tcx> Debug for Statement<'tcx> {
18591856 match self . kind {
18601857 Assign ( ref place, ref rv) => write ! ( fmt, "{:?} = {:?}" , place, rv) ,
18611858 FakeRead ( ref cause, ref place) => write ! ( fmt, "FakeRead({:?}, {:?})" , cause, place) ,
1862- Retag { fn_entry, two_phase, ref place } =>
1863- write ! ( fmt, "Retag({}{}{:?})" ,
1864- if fn_entry { "[fn entry] " } else { "" } ,
1865- if two_phase { "[2phase] " } else { "" } ,
1859+ Retag ( ref kind, ref place) =>
1860+ write ! ( fmt, "Retag({}{:?})" ,
1861+ match kind {
1862+ RetagKind :: FnEntry => "[fn entry] " ,
1863+ RetagKind :: TwoPhase => "[2phase] " ,
1864+ RetagKind :: Raw => "[raw] " ,
1865+ RetagKind :: Default => "" ,
1866+ } ,
18661867 place,
18671868 ) ,
1868- EscapeToRaw ( ref place) => write ! ( fmt, "EscapeToRaw({:?})" , place) ,
18691869 StorageLive ( ref place) => write ! ( fmt, "StorageLive({:?})" , place) ,
18701870 StorageDead ( ref place) => write ! ( fmt, "StorageDead({:?})" , place) ,
18711871 SetDiscriminant {
@@ -2979,6 +2979,7 @@ CloneTypeFoldableAndLiftImpls! {
29792979 SourceInfo ,
29802980 UpvarDecl ,
29812981 FakeReadCause ,
2982+ RetagKind ,
29822983 SourceScope ,
29832984 SourceScopeData ,
29842985 SourceScopeLocalData ,
@@ -3046,8 +3047,7 @@ EnumTypeFoldableImpl! {
30463047 ( StatementKind :: StorageLive ) ( a) ,
30473048 ( StatementKind :: StorageDead ) ( a) ,
30483049 ( StatementKind :: InlineAsm ) { asm, outputs, inputs } ,
3049- ( StatementKind :: Retag ) { fn_entry, two_phase, place } ,
3050- ( StatementKind :: EscapeToRaw ) ( place) ,
3050+ ( StatementKind :: Retag ) ( kind, place) ,
30513051 ( StatementKind :: AscribeUserType ) ( a, v, b) ,
30523052 ( StatementKind :: Nop ) ,
30533053 }
0 commit comments