@@ -1774,23 +1774,7 @@ pub enum StatementKind<'tcx> {
1774
1774
/// by miri and only generated when "-Z mir-emit-retag" is passed.
1775
1775
/// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
1776
1776
/// 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 > ) ,
1794
1778
1795
1779
/// Encodes a user's type ascription. These need to be preserved
1796
1780
/// intact so that NLL can respect them. For example:
@@ -1810,6 +1794,19 @@ pub enum StatementKind<'tcx> {
1810
1794
Nop ,
1811
1795
}
1812
1796
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
+
1813
1810
/// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists.
1814
1811
#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug ) ]
1815
1812
pub enum FakeReadCause {
@@ -1845,13 +1842,16 @@ impl<'tcx> Debug for Statement<'tcx> {
1845
1842
match self . kind {
1846
1843
Assign ( ref place, ref rv) => write ! ( fmt, "{:?} = {:?}" , place, rv) ,
1847
1844
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
+ } ,
1852
1853
place,
1853
1854
) ,
1854
- EscapeToRaw ( ref place) => write ! ( fmt, "EscapeToRaw({:?})" , place) ,
1855
1855
StorageLive ( ref place) => write ! ( fmt, "StorageLive({:?})" , place) ,
1856
1856
StorageDead ( ref place) => write ! ( fmt, "StorageDead({:?})" , place) ,
1857
1857
SetDiscriminant {
@@ -2965,6 +2965,7 @@ CloneTypeFoldableAndLiftImpls! {
2965
2965
SourceInfo ,
2966
2966
UpvarDecl ,
2967
2967
FakeReadCause ,
2968
+ RetagKind ,
2968
2969
SourceScope ,
2969
2970
SourceScopeData ,
2970
2971
SourceScopeLocalData ,
@@ -3031,8 +3032,7 @@ EnumTypeFoldableImpl! {
3031
3032
( StatementKind :: StorageLive ) ( a) ,
3032
3033
( StatementKind :: StorageDead ) ( a) ,
3033
3034
( StatementKind :: InlineAsm ) { asm, outputs, inputs } ,
3034
- ( StatementKind :: Retag ) { fn_entry, two_phase, place } ,
3035
- ( StatementKind :: EscapeToRaw ) ( place) ,
3035
+ ( StatementKind :: Retag ) ( kind, place) ,
3036
3036
( StatementKind :: AscribeUserType ) ( a, v, b) ,
3037
3037
( StatementKind :: Nop ) ,
3038
3038
}
0 commit comments