@@ -167,7 +167,7 @@ pub struct InferCtxtInner<'tcx> {
167
167
/// `resolve_regions_and_report_errors` is invoked, this gets set to `None`
168
168
/// -- further attempts to perform unification, etc., may fail if new
169
169
/// region constraints would've been added.
170
- region_constraints : Option < RegionConstraintStorage < ' tcx > > ,
170
+ region_constraint_storage : Option < RegionConstraintStorage < ' tcx > > ,
171
171
172
172
/// A set of constraints that regionck must validate. Each
173
173
/// constraint has the form `T:'a`, meaning "some type `T` must
@@ -214,7 +214,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
214
214
const_unification_storage : ut:: UnificationTableStorage :: new ( ) ,
215
215
int_unification_storage : ut:: UnificationTableStorage :: new ( ) ,
216
216
float_unification_storage : ut:: UnificationTableStorage :: new ( ) ,
217
- region_constraints : Some ( RegionConstraintStorage :: new ( ) ) ,
217
+ region_constraint_storage : Some ( RegionConstraintStorage :: new ( ) ) ,
218
218
region_obligations : vec ! [ ] ,
219
219
}
220
220
}
@@ -268,7 +268,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
268
268
}
269
269
270
270
pub fn unwrap_region_constraints ( & mut self ) -> RegionConstraintCollector < ' tcx , ' _ > {
271
- self . region_constraints
271
+ self . region_constraint_storage
272
272
. as_mut ( )
273
273
. expect ( "region constraints already solved" )
274
274
. with_log ( & mut self . undo_log )
@@ -705,8 +705,9 @@ impl<'tcx> InferOk<'tcx, ()> {
705
705
}
706
706
}
707
707
708
+ /// Extends `CombinedSnapshot` by tracking which variables were added in the snapshot
708
709
#[ must_use = "once you start a snapshot, you should always consume it" ]
709
- pub struct FullSnapshot < ' a , ' tcx > {
710
+ pub struct FudgeSnapshot < ' a , ' tcx > {
710
711
snapshot : CombinedSnapshot < ' a , ' tcx > ,
711
712
region_constraints_snapshot : RegionSnapshot ,
712
713
type_snapshot : type_variable:: Snapshot < ' tcx > ,
@@ -830,10 +831,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
830
831
result
831
832
}
832
833
833
- fn start_full_snapshot ( & self ) -> FullSnapshot < ' a , ' tcx > {
834
+ fn start_fudge_snapshot ( & self ) -> FudgeSnapshot < ' a , ' tcx > {
834
835
let snapshot = self . start_snapshot ( ) ;
835
836
let mut inner = self . inner . borrow_mut ( ) ;
836
- FullSnapshot {
837
+ FudgeSnapshot {
837
838
snapshot,
838
839
type_snapshot : inner. type_variables ( ) . snapshot ( ) ,
839
840
const_var_len : inner. const_unification_table ( ) . len ( ) ,
@@ -925,12 +926,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
925
926
r
926
927
}
927
928
928
- pub fn probe_full < R , F > ( & self , f : F ) -> R
929
+ /// Like `probe` but provides information about which variables were created in the snapshot,
930
+ /// allowing for inference fudging
931
+ pub fn probe_fudge < R , F > ( & self , f : F ) -> R
929
932
where
930
- F : FnOnce ( & FullSnapshot < ' a , ' tcx > ) -> R ,
933
+ F : FnOnce ( & FudgeSnapshot < ' a , ' tcx > ) -> R ,
931
934
{
932
935
debug ! ( "probe()" ) ;
933
- let snapshot = self . start_full_snapshot ( ) ;
936
+ let snapshot = self . start_fudge_snapshot ( ) ;
934
937
let r = f ( & snapshot) ;
935
938
self . rollback_to ( "probe" , snapshot. snapshot ) ;
936
939
r
@@ -1294,7 +1297,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1294
1297
inner. region_obligations
1295
1298
) ;
1296
1299
inner
1297
- . region_constraints
1300
+ . region_constraint_storage
1298
1301
. take ( )
1299
1302
. expect ( "regions already resolved" )
1300
1303
. with_log ( & mut inner. undo_log )
@@ -1362,7 +1365,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1362
1365
pub fn take_region_var_origins ( & self ) -> VarInfos {
1363
1366
let mut inner = self . inner . borrow_mut ( ) ;
1364
1367
let ( var_infos, data) = inner
1365
- . region_constraints
1368
+ . region_constraint_storage
1366
1369
. take ( )
1367
1370
. expect ( "regions already resolved" )
1368
1371
. with_log ( & mut inner. undo_log )
0 commit comments