@@ -1774,23 +1774,7 @@ pub enum StatementKind<'tcx> {
17741774 /// by miri and only generated when "-Z mir-emit-retag" is passed.
17751775 /// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
17761776 /// for more details.
1777- Retag {
1778- /// `fn_entry` indicates whether this is the initial retag that happens in the
1779- /// function prolog.
1780- fn_entry : bool ,
1781- /// `two_phase` indicates whether this is just the reservation action of
1782- /// a two-phase borrow.
1783- two_phase : bool ,
1784- /// The place to retag
1785- place : Place < ' tcx > ,
1786- } ,
1787-
1788- /// Escape the given reference to a raw pointer, so that it can be accessed
1789- /// without precise provenance tracking. These statements are currently only interpreted
1790- /// by miri and only generated when "-Z mir-emit-retag" is passed.
1791- /// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
1792- /// for more details.
1793- EscapeToRaw ( Operand < ' tcx > ) ,
1777+ Retag ( RetagKind , Place < ' tcx > ) ,
17941778
17951779 /// Encodes a user's type ascription. These need to be preserved
17961780 /// intact so that NLL can respect them. For example:
@@ -1810,6 +1794,19 @@ pub enum StatementKind<'tcx> {
18101794 Nop ,
18111795}
18121796
1797+ /// `RetagKind` describes what kind of retag is to be performed.
1798+ #[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug , PartialEq , Eq ) ]
1799+ pub enum RetagKind {
1800+ /// The initial retag when entering a function
1801+ FnEntry ,
1802+ /// Retag preparing for a two-phase borrow
1803+ TwoPhase ,
1804+ /// Retagging raw pointers
1805+ Raw ,
1806+ /// A "normal" retag
1807+ Default ,
1808+ }
1809+
18131810/// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists.
18141811#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug ) ]
18151812pub enum FakeReadCause {
@@ -1845,13 +1842,16 @@ impl<'tcx> Debug for Statement<'tcx> {
18451842 match self . kind {
18461843 Assign ( ref place, ref rv) => write ! ( fmt, "{:?} = {:?}" , place, rv) ,
18471844 FakeRead ( ref cause, ref place) => write ! ( fmt, "FakeRead({:?}, {:?})" , cause, place) ,
1848- Retag { fn_entry, two_phase, ref place } =>
1849- write ! ( fmt, "Retag({}{}{:?})" ,
1850- if fn_entry { "[fn entry] " } else { "" } ,
1851- if two_phase { "[2phase] " } else { "" } ,
1845+ Retag ( ref kind, ref place) =>
1846+ write ! ( fmt, "Retag({}{:?})" ,
1847+ match kind {
1848+ RetagKind :: FnEntry => "[fn entry] " ,
1849+ RetagKind :: TwoPhase => "[2phase] " ,
1850+ RetagKind :: Raw => "[raw] " ,
1851+ RetagKind :: Default => "" ,
1852+ } ,
18521853 place,
18531854 ) ,
1854- EscapeToRaw ( ref place) => write ! ( fmt, "EscapeToRaw({:?})" , place) ,
18551855 StorageLive ( ref place) => write ! ( fmt, "StorageLive({:?})" , place) ,
18561856 StorageDead ( ref place) => write ! ( fmt, "StorageDead({:?})" , place) ,
18571857 SetDiscriminant {
@@ -2965,6 +2965,7 @@ CloneTypeFoldableAndLiftImpls! {
29652965 SourceInfo ,
29662966 UpvarDecl ,
29672967 FakeReadCause ,
2968+ RetagKind ,
29682969 SourceScope ,
29692970 SourceScopeData ,
29702971 SourceScopeLocalData ,
@@ -3031,8 +3032,7 @@ EnumTypeFoldableImpl! {
30313032 ( StatementKind :: StorageLive ) ( a) ,
30323033 ( StatementKind :: StorageDead ) ( a) ,
30333034 ( StatementKind :: InlineAsm ) { asm, outputs, inputs } ,
3034- ( StatementKind :: Retag ) { fn_entry, two_phase, place } ,
3035- ( StatementKind :: EscapeToRaw ) ( place) ,
3035+ ( StatementKind :: Retag ) ( kind, place) ,
30363036 ( StatementKind :: AscribeUserType ) ( a, v, b) ,
30373037 ( StatementKind :: Nop ) ,
30383038 }
0 commit comments