@@ -47,6 +47,8 @@ pub enum Constraint {
4747 ConstrainRegSubVar ( Region , RegionVid ) ,
4848
4949 // Region variable is subregion of concrete region
50+ //
51+ // FIXME(#29436) -- should be remove in favor of a Verify
5052 ConstrainVarSubReg ( RegionVid , Region ) ,
5153}
5254
@@ -972,6 +974,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
972974 }
973975 }
974976
977+ // FIXME(#29436) -- this fn would just go away if we removed ConstrainVarSubReg
975978 fn contraction ( & self ,
976979 free_regions : & FreeRegionMap ,
977980 var_data : & mut [ VarData ] ) {
@@ -983,50 +986,31 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
983986 . unwrap( )
984987 ) ;
985988 match * constraint {
986- ConstrainRegSubVar ( ..) |
987- ConstrainVarSubVar ( ..) => {
988- // Expansion will ensure that these constraints hold. Ignore.
989- false
990- }
991- ConstrainVarSubReg ( a_vid, b_region) => {
992- let a_data = & mut var_data[ a_vid. index as usize ] ;
993- self . contract_node ( free_regions, a_vid, a_data, b_region)
994- }
989+ ConstrainRegSubVar ( ..) |
990+ ConstrainVarSubVar ( ..) => {
991+ // Expansion will ensure that these constraints hold. Ignore.
992+ }
993+ ConstrainVarSubReg ( a_vid, b_region) => {
994+ let a_data = & mut var_data[ a_vid. index as usize ] ;
995+ debug ! ( "contraction: {:?} == {:?}, {:?}" , a_vid, a_data. value, b_region) ;
996+
997+ let a_region = match a_data. value {
998+ ErrorValue => return false ,
999+ Value ( a_region) => a_region,
1000+ } ;
1001+
1002+ if !free_regions. is_subregion_of ( self . tcx , a_region, b_region) {
1003+ debug ! ( "Setting {:?} to ErrorValue: {:?} not subregion of {:?}" ,
1004+ a_vid,
1005+ a_region,
1006+ b_region) ;
1007+ a_data. value = ErrorValue ;
1008+ }
1009+ }
9951010 }
996- } )
997- }
998-
999- fn contract_node ( & self ,
1000- free_regions : & FreeRegionMap ,
1001- a_vid : RegionVid ,
1002- a_data : & mut VarData ,
1003- b_region : Region )
1004- -> bool {
1005- debug ! ( "contract_node({:?} == {:?}, {:?})" ,
1006- a_vid, a_data. value, b_region) ;
1007-
1008- return match a_data. value {
1009- ErrorValue => false , // no change
1010- Value ( a_region) => check_node ( self , free_regions, a_vid, a_data, a_region, b_region) ,
1011- } ;
10121011
1013- fn check_node ( this : & RegionVarBindings ,
1014- free_regions : & FreeRegionMap ,
1015- a_vid : RegionVid ,
1016- a_data : & mut VarData ,
1017- a_region : Region ,
1018- b_region : Region )
1019- -> bool
1020- {
1021- if !free_regions. is_subregion_of ( this. tcx , a_region, b_region) {
1022- debug ! ( "Setting {:?} to ErrorValue: {:?} not subregion of {:?}" ,
1023- a_vid,
1024- a_region,
1025- b_region) ;
1026- a_data. value = ErrorValue ;
1027- }
10281012 false
1029- }
1013+ } )
10301014 }
10311015
10321016 fn collect_concrete_region_errors ( & self ,
0 commit comments