@@ -156,11 +156,11 @@ pub enum StackPopCleanup {
156
156
/// `ret` stores the block we jump to on a normal return, while `unwind`
157
157
/// stores the block used for cleanup during unwinding.
158
158
Goto { ret : Option < mir:: BasicBlock > , unwind : StackPopUnwind } ,
159
- /// Just do nothing: Used by Main and for TLS hooks in miri .
159
+ /// The root frame of the stack: nowhere else to jump to .
160
160
/// `cleanup` says whether locals are deallocated. Static computation
161
161
/// wants them leaked to intern what they need (and just throw away
162
162
/// the entire `ecx` when it is done).
163
- None { cleanup : bool } ,
163
+ Root { cleanup : bool } ,
164
164
}
165
165
166
166
/// State of a local variable including a memoized layout
@@ -849,7 +849,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
849
849
// because this is CTFE and the final value will be thoroughly validated anyway.
850
850
let cleanup = match return_to_block {
851
851
StackPopCleanup :: Goto { .. } => true ,
852
- StackPopCleanup :: None { cleanup, .. } => cleanup,
852
+ StackPopCleanup :: Root { cleanup, .. } => cleanup,
853
853
} ;
854
854
855
855
if !cleanup {
@@ -874,16 +874,22 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
874
874
// Follow the unwind edge.
875
875
let unwind = match return_to_block {
876
876
StackPopCleanup :: Goto { unwind, .. } => unwind,
877
- StackPopCleanup :: None { .. } => {
878
- panic ! ( "Encountered StackPopCleanup::None when unwinding!" )
877
+ StackPopCleanup :: Root { .. } => {
878
+ panic ! ( "encountered StackPopCleanup::Root when unwinding!" )
879
879
}
880
880
} ;
881
881
self . unwind_to_block ( unwind)
882
882
} else {
883
883
// Follow the normal return edge.
884
884
match return_to_block {
885
885
StackPopCleanup :: Goto { ret, .. } => self . return_to_block ( ret) ,
886
- StackPopCleanup :: None { .. } => Ok ( ( ) ) ,
886
+ StackPopCleanup :: Root { .. } => {
887
+ assert ! (
888
+ self . stack( ) . is_empty( ) ,
889
+ "only the topmost frame can have StackPopCleanup::Root"
890
+ ) ;
891
+ Ok ( ( ) )
892
+ }
887
893
}
888
894
}
889
895
}
0 commit comments