@@ -2112,11 +2112,9 @@ impl<'a> Resolver<'a> {
21122112 }
21132113 }
21142114
2115- /// Searches the current set of local scopes for labels. Returns the first non-None label that
2116- /// is returned by the given predicate function
2117- ///
2118- /// Stops after meeting a closure.
2119- fn search_label < P , R > ( & self , mut ident : Ident , pred : P ) -> Option < R >
2115+ /// Searches the current set of local scopes for labels. Returns the first non-`None` label
2116+ /// that is returned by the given predicate function. Stops after meeting a closure.
2117+ fn search_label < P , R : std:: fmt:: Debug > ( & self , mut ident : Ident , pred : P ) -> Option < R >
21202118 where P : Fn ( & Rib , Ident ) -> Option < R >
21212119 {
21222120 for rib in self . label_ribs . iter ( ) . rev ( ) {
@@ -2130,7 +2128,7 @@ impl<'a> Resolver<'a> {
21302128 }
21312129 }
21322130 _ => {
2133- // Do not resolve labels across function boundary
2131+ // Do not resolve labels across function boundary.
21342132 return None ;
21352133 }
21362134 }
@@ -3731,8 +3729,8 @@ impl<'a> Resolver<'a> {
37313729 match self . search_label ( label. ident , |rib, id| rib. bindings . get ( & id) . cloned ( ) ) {
37323730 None => {
37333731 // Search again for close matches...
3734- // Picks the first label that is "close enough", which is not necessarily
3735- // the closest match
3732+ // Picks the first label that is "close enough", which is not
3733+ // necessarily the closest match.
37363734 let close_match = self . search_label ( label. ident , |rib, ident| {
37373735 let names = rib. bindings . iter ( ) . map ( |( id, _) | & id. name ) ;
37383736 find_best_match_for_name ( names, & * ident. name . as_str ( ) , None )
@@ -3775,15 +3773,15 @@ impl<'a> Resolver<'a> {
37753773 ExprKind :: Loop ( ref block, label) => self . resolve_labeled_block ( label, expr. id , & block) ,
37763774
37773775 ExprKind :: While ( ref subexpression, ref block, label) => {
3776+ self . visit_expr ( subexpression) ;
37783777 self . with_resolved_label ( label, expr. id , |this| {
3779- this. visit_expr ( subexpression) ;
37803778 this. visit_block ( block) ;
37813779 } ) ;
37823780 }
37833781
37843782 ExprKind :: WhileLet ( ref pats, ref subexpression, ref block, label) => {
3783+ self . visit_expr ( subexpression) ;
37853784 self . with_resolved_label ( label, expr. id , |this| {
3786- this. visit_expr ( subexpression) ;
37873785 this. ribs [ ValueNS ] . push ( Rib :: new ( NormalRibKind ) ) ;
37883786 let mut bindings_list = FxHashMap ( ) ;
37893787 for pat in pats {
0 commit comments