@@ -7,7 +7,7 @@ use super::{
7
7
InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , Rollback , Snapshot , SubregionOrigin ,
8
8
} ;
9
9
10
- use rustc_data_structures:: fx:: { FxHashMap , FxIndexSet } ;
10
+ use rustc_data_structures:: fx:: FxHashMap ;
11
11
use rustc_data_structures:: intern:: Interned ;
12
12
use rustc_data_structures:: sync:: Lrc ;
13
13
use rustc_data_structures:: undo_log:: UndoLogs ;
@@ -104,26 +104,6 @@ pub struct RegionConstraintData<'tcx> {
104
104
/// An example is a `A <= B` where neither `A` nor `B` are
105
105
/// inference variables.
106
106
pub verifys : Vec < Verify < ' tcx > > ,
107
-
108
- /// A "given" is a relationship that is known to hold. In
109
- /// particular, we often know from closure fn signatures that a
110
- /// particular free region must be a subregion of a region
111
- /// variable:
112
- ///
113
- /// foo.iter().filter(<'a> |x: &'a &'b T| ...)
114
- ///
115
- /// In situations like this, `'b` is in fact a region variable
116
- /// introduced by the call to `iter()`, and `'a` is a bound region
117
- /// on the closure (as indicated by the `<'a>` prefix). If we are
118
- /// naive, we wind up inferring that `'b` must be `'static`,
119
- /// because we require that it be greater than `'a` and we do not
120
- /// know what `'a` is precisely.
121
- ///
122
- /// This hashmap is used to avoid that naive scenario. Basically
123
- /// we record the fact that `'a <= 'b` is implied by the fn
124
- /// signature, and then ignore the constraint when solving
125
- /// equations. This is a bit of a hack but seems to work.
126
- pub givens : FxIndexSet < ( Region < ' tcx > , ty:: RegionVid ) > ,
127
107
}
128
108
129
109
/// Represents a constraint that influences the inference process.
@@ -297,9 +277,6 @@ pub(crate) enum UndoLog<'tcx> {
297
277
/// We added the given `verify`.
298
278
AddVerify ( usize ) ,
299
279
300
- /// We added the given `given`.
301
- AddGiven ( Region < ' tcx > , ty:: RegionVid ) ,
302
-
303
280
/// We added a GLB/LUB "combination variable".
304
281
AddCombination ( CombineMapType , TwoRegions < ' tcx > ) ,
305
282
}
@@ -348,9 +325,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
348
325
self . data . verifys . pop ( ) ;
349
326
assert_eq ! ( self . data. verifys. len( ) , index) ;
350
327
}
351
- AddGiven ( sub, sup) => {
352
- self . data . givens . remove ( & ( sub, sup) ) ;
353
- }
354
328
AddCombination ( Glb , ref regions) => {
355
329
self . glbs . remove ( regions) ;
356
330
}
@@ -492,15 +466,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
492
466
self . undo_log . push ( AddVerify ( index) ) ;
493
467
}
494
468
495
- pub ( super ) fn add_given ( & mut self , sub : Region < ' tcx > , sup : ty:: RegionVid ) {
496
- // cannot add givens once regions are resolved
497
- if self . data . givens . insert ( ( sub, sup) ) {
498
- debug ! ( "add_given({:?} <= {:?})" , sub, sup) ;
499
-
500
- self . undo_log . push ( AddGiven ( sub, sup) ) ;
501
- }
502
- }
503
-
504
469
pub ( super ) fn make_eqregion (
505
470
& mut self ,
506
471
origin : SubregionOrigin < ' tcx > ,
@@ -804,11 +769,8 @@ impl<'tcx> RegionConstraintData<'tcx> {
804
769
/// Returns `true` if this region constraint data contains no constraints, and `false`
805
770
/// otherwise.
806
771
pub fn is_empty ( & self ) -> bool {
807
- let RegionConstraintData { constraints, member_constraints, verifys, givens } = self ;
808
- constraints. is_empty ( )
809
- && member_constraints. is_empty ( )
810
- && verifys. is_empty ( )
811
- && givens. is_empty ( )
772
+ let RegionConstraintData { constraints, member_constraints, verifys } = self ;
773
+ constraints. is_empty ( ) && member_constraints. is_empty ( ) && verifys. is_empty ( )
812
774
}
813
775
}
814
776
0 commit comments