@@ -1788,23 +1788,7 @@ pub enum StatementKind<'tcx> {
1788
1788
/// by miri and only generated when "-Z mir-emit-retag" is passed.
1789
1789
/// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
1790
1790
/// 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 > ) ,
1808
1792
1809
1793
/// Encodes a user's type ascription. These need to be preserved
1810
1794
/// intact so that NLL can respect them. For example:
@@ -1824,6 +1808,19 @@ pub enum StatementKind<'tcx> {
1824
1808
Nop ,
1825
1809
}
1826
1810
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
+
1827
1824
/// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists.
1828
1825
#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug ) ]
1829
1826
pub enum FakeReadCause {
@@ -1859,13 +1856,16 @@ impl<'tcx> Debug for Statement<'tcx> {
1859
1856
match self . kind {
1860
1857
Assign ( ref place, ref rv) => write ! ( fmt, "{:?} = {:?}" , place, rv) ,
1861
1858
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
+ } ,
1866
1867
place,
1867
1868
) ,
1868
- EscapeToRaw ( ref place) => write ! ( fmt, "EscapeToRaw({:?})" , place) ,
1869
1869
StorageLive ( ref place) => write ! ( fmt, "StorageLive({:?})" , place) ,
1870
1870
StorageDead ( ref place) => write ! ( fmt, "StorageDead({:?})" , place) ,
1871
1871
SetDiscriminant {
@@ -2979,6 +2979,7 @@ CloneTypeFoldableAndLiftImpls! {
2979
2979
SourceInfo ,
2980
2980
UpvarDecl ,
2981
2981
FakeReadCause ,
2982
+ RetagKind ,
2982
2983
SourceScope ,
2983
2984
SourceScopeData ,
2984
2985
SourceScopeLocalData ,
@@ -3046,8 +3047,7 @@ EnumTypeFoldableImpl! {
3046
3047
( StatementKind :: StorageLive ) ( a) ,
3047
3048
( StatementKind :: StorageDead ) ( a) ,
3048
3049
( StatementKind :: InlineAsm ) { asm, outputs, inputs } ,
3049
- ( StatementKind :: Retag ) { fn_entry, two_phase, place } ,
3050
- ( StatementKind :: EscapeToRaw ) ( place) ,
3050
+ ( StatementKind :: Retag ) ( kind, place) ,
3051
3051
( StatementKind :: AscribeUserType ) ( a, v, b) ,
3052
3052
( StatementKind :: Nop ) ,
3053
3053
}
0 commit comments