@@ -7,7 +7,7 @@ use super::{
77 InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , Rollback , Snapshot , SubregionOrigin ,
88} ;
99
10- use rustc_data_structures:: fx:: { FxHashMap , FxIndexSet } ;
10+ use rustc_data_structures:: fx:: FxHashMap ;
1111use rustc_data_structures:: intern:: Interned ;
1212use rustc_data_structures:: sync:: Lrc ;
1313use rustc_data_structures:: undo_log:: UndoLogs ;
@@ -104,26 +104,6 @@ pub struct RegionConstraintData<'tcx> {
104104 /// An example is a `A <= B` where neither `A` nor `B` are
105105 /// inference variables.
106106 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 ) > ,
127107}
128108
129109/// Represents a constraint that influences the inference process.
@@ -297,9 +277,6 @@ pub(crate) enum UndoLog<'tcx> {
297277 /// We added the given `verify`.
298278 AddVerify ( usize ) ,
299279
300- /// We added the given `given`.
301- AddGiven ( Region < ' tcx > , ty:: RegionVid ) ,
302-
303280 /// We added a GLB/LUB "combination variable".
304281 AddCombination ( CombineMapType , TwoRegions < ' tcx > ) ,
305282}
@@ -348,9 +325,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
348325 self . data . verifys . pop ( ) ;
349326 assert_eq ! ( self . data. verifys. len( ) , index) ;
350327 }
351- AddGiven ( sub, sup) => {
352- self . data . givens . remove ( & ( sub, sup) ) ;
353- }
354328 AddCombination ( Glb , ref regions) => {
355329 self . glbs . remove ( regions) ;
356330 }
@@ -492,15 +466,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
492466 self . undo_log . push ( AddVerify ( index) ) ;
493467 }
494468
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-
504469 pub ( super ) fn make_eqregion (
505470 & mut self ,
506471 origin : SubregionOrigin < ' tcx > ,
@@ -804,11 +769,8 @@ impl<'tcx> RegionConstraintData<'tcx> {
804769 /// Returns `true` if this region constraint data contains no constraints, and `false`
805770 /// otherwise.
806771 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 ( )
812774 }
813775}
814776
0 commit comments