@@ -47,6 +47,8 @@ pub enum Constraint {
47
47
ConstrainRegSubVar ( Region , RegionVid ) ,
48
48
49
49
// Region variable is subregion of concrete region
50
+ //
51
+ // FIXME(#29436) -- should be remove in favor of a Verify
50
52
ConstrainVarSubReg ( RegionVid , Region ) ,
51
53
}
52
54
@@ -972,6 +974,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
972
974
}
973
975
}
974
976
977
+ // FIXME(#29436) -- this fn would just go away if we removed ConstrainVarSubReg
975
978
fn contraction ( & self ,
976
979
free_regions : & FreeRegionMap ,
977
980
var_data : & mut [ VarData ] ) {
@@ -983,50 +986,31 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
983
986
. unwrap( )
984
987
) ;
985
988
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
+ }
995
1010
}
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
- } ;
1012
1011
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
- }
1028
1012
false
1029
- }
1013
+ } )
1030
1014
}
1031
1015
1032
1016
fn collect_concrete_region_errors ( & self ,
0 commit comments