File tree 1 file changed +26
-1
lines changed
compiler/rustc_ty_utils/src
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ impl<'tcx> BoundVarsCollector<'tcx> {
39
39
}
40
40
41
41
fn into_vars ( self , tcx : TyCtxt < ' tcx > ) -> & ' tcx ty:: List < ty:: BoundVariableKind > {
42
- let max = self . vars . iter ( ) . map ( |( k, _) | * k) . max ( ) . unwrap_or_else ( || 0 ) ;
42
+ let max = self . vars . iter ( ) . map ( |( k, _) | * k) . max ( ) . unwrap_or ( 0 ) ;
43
43
for i in 0 ..max {
44
44
if let None = self . vars . get ( & i) {
45
45
panic ! ( "Unknown variable: {:?}" , i) ;
@@ -90,6 +90,31 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
90
90
}
91
91
92
92
fn visit_region ( & mut self , r : ty:: Region < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
93
+ use std:: collections:: btree_map:: Entry ;
94
+ match r {
95
+ ty:: ReLateBound ( index, br) if * index == self . binder_index => match br. kind {
96
+ ty:: BrNamed ( _def_id, _name) => {
97
+ // FIXME
98
+ }
99
+
100
+ ty:: BrAnon ( var) => match self . vars . entry ( var) {
101
+ Entry :: Vacant ( entry) => {
102
+ entry. insert ( ty:: BoundVariableKind :: Region ( br. kind ) ) ;
103
+ }
104
+ Entry :: Occupied ( entry) => match entry. get ( ) {
105
+ ty:: BoundVariableKind :: Region ( _) => { }
106
+ _ => bug ! ( "Conflicting bound vars" ) ,
107
+ } ,
108
+ } ,
109
+
110
+ ty:: BrEnv => {
111
+ // FIXME
112
+ }
113
+ } ,
114
+
115
+ _ => ( ) ,
116
+ } ;
117
+
93
118
r. super_visit_with ( self )
94
119
}
95
120
}
You can’t perform that action at this time.
0 commit comments