@@ -407,7 +407,10 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
407
407
impl < ' a , ' ast > Visitor < ' ast > for LateResolutionVisitor < ' a , ' _ , ' ast > {
408
408
fn visit_item ( & mut self , item : & ' ast Item ) {
409
409
let prev = replace ( & mut self . diagnostic_metadata . current_item , Some ( item) ) ;
410
+ // Always report errors in items we just entered.
411
+ let old_ignore = replace ( & mut self . in_func_body , false ) ;
410
412
self . resolve_item ( item) ;
413
+ self . in_func_body = old_ignore;
411
414
self . diagnostic_metadata . current_item = prev;
412
415
}
413
416
fn visit_arm ( & mut self , arm : & ' ast Arm ) {
@@ -1174,8 +1177,6 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1174
1177
impl_items : & ' ast [ P < AssocItem > ] ,
1175
1178
) {
1176
1179
debug ! ( "resolve_implementation" ) ;
1177
- // Never ignore errors in trait implementations.
1178
- let old_ignore = replace ( & mut self . in_func_body , false ) ;
1179
1180
// If applicable, create a rib for the type parameters.
1180
1181
self . with_generic_param_rib ( generics, ItemRibKind ( HasGenericParams :: Yes ) , |this| {
1181
1182
// Dummy self type for better errors if `Self` is used in the trait path.
@@ -1271,7 +1272,6 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1271
1272
} ) ;
1272
1273
} ) ;
1273
1274
} ) ;
1274
- self . in_func_body = old_ignore;
1275
1275
}
1276
1276
1277
1277
fn check_trait_item < F > ( & mut self , ident : Ident , ns : Namespace , span : Span , err : F )
0 commit comments