@@ -2112,11 +2112,9 @@ impl<'a> Resolver<'a> {
2112
2112
}
2113
2113
}
2114
2114
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 >
2120
2118
where P : Fn ( & Rib , Ident ) -> Option < R >
2121
2119
{
2122
2120
for rib in self . label_ribs . iter ( ) . rev ( ) {
@@ -2130,7 +2128,7 @@ impl<'a> Resolver<'a> {
2130
2128
}
2131
2129
}
2132
2130
_ => {
2133
- // Do not resolve labels across function boundary
2131
+ // Do not resolve labels across function boundary.
2134
2132
return None ;
2135
2133
}
2136
2134
}
@@ -3731,8 +3729,8 @@ impl<'a> Resolver<'a> {
3731
3729
match self . search_label ( label. ident , |rib, id| rib. bindings . get ( & id) . cloned ( ) ) {
3732
3730
None => {
3733
3731
// 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.
3736
3734
let close_match = self . search_label ( label. ident , |rib, ident| {
3737
3735
let names = rib. bindings . iter ( ) . map ( |( id, _) | & id. name ) ;
3738
3736
find_best_match_for_name ( names, & * ident. name . as_str ( ) , None )
@@ -3775,15 +3773,15 @@ impl<'a> Resolver<'a> {
3775
3773
ExprKind :: Loop ( ref block, label) => self . resolve_labeled_block ( label, expr. id , & block) ,
3776
3774
3777
3775
ExprKind :: While ( ref subexpression, ref block, label) => {
3776
+ self . visit_expr ( subexpression) ;
3778
3777
self . with_resolved_label ( label, expr. id , |this| {
3779
- this. visit_expr ( subexpression) ;
3780
3778
this. visit_block ( block) ;
3781
3779
} ) ;
3782
3780
}
3783
3781
3784
3782
ExprKind :: WhileLet ( ref pats, ref subexpression, ref block, label) => {
3783
+ self . visit_expr ( subexpression) ;
3785
3784
self . with_resolved_label ( label, expr. id , |this| {
3786
- this. visit_expr ( subexpression) ;
3787
3785
this. ribs [ ValueNS ] . push ( Rib :: new ( NormalRibKind ) ) ;
3788
3786
let mut bindings_list = FxHashMap ( ) ;
3789
3787
for pat in pats {
0 commit comments