This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
compiler/rustc_ty_utils/src Expand file tree Collapse file tree 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> {
3939 }
4040
4141 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 ) ;
4343 for i in 0 ..max {
4444 if let None = self . vars . get ( & i) {
4545 panic ! ( "Unknown variable: {:?}" , i) ;
@@ -90,6 +90,31 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
9090 }
9191
9292 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+
93118 r. super_visit_with ( self )
94119 }
95120}
You can’t perform that action at this time.
0 commit comments