File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
compiler/rustc_infer/src/infer Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ impl<'tcx> InferCtxt<'tcx> {
166
166
167
167
/// Trait queries just want to pass back type obligations "as is"
168
168
pub fn take_registered_region_obligations ( & self ) -> Vec < TypeOutlivesConstraint < ' tcx > > {
169
+ assert ! ( !self . in_snapshot( ) , "cannot take registered region obligations in a snapshot" ) ;
169
170
std:: mem:: take ( & mut self . inner . borrow_mut ( ) . region_obligations )
170
171
}
171
172
Original file line number Diff line number Diff line change
1
+ use std:: assert_matches:: assert_matches;
1
2
use std:: marker:: PhantomData ;
2
3
3
4
use rustc_data_structures:: undo_log:: { Rollback , UndoLogs } ;
@@ -73,7 +74,8 @@ impl<'tcx> Rollback<UndoLog<'tcx>> for InferCtxtInner<'tcx> {
73
74
}
74
75
UndoLog :: ProjectionCache ( undo) => self . projection_cache . reverse ( undo) ,
75
76
UndoLog :: PushTypeOutlivesConstraint => {
76
- self . region_obligations . pop ( ) ;
77
+ let popped = self . region_obligations . pop ( ) ;
78
+ assert_matches ! ( popped, Some ( _) , "pushed region constraint but could not pop it" ) ;
77
79
}
78
80
}
79
81
}
You can’t perform that action at this time.
0 commit comments