@@ -407,7 +407,10 @@ struct LateResolutionVisitor<'a, 'b, 'ast> {
407407impl < ' a , ' ast > Visitor < ' ast > for LateResolutionVisitor < ' a , ' _ , ' ast > {
408408 fn visit_item ( & mut self , item : & ' ast Item ) {
409409 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 ) ;
410412 self . resolve_item ( item) ;
413+ self . in_func_body = old_ignore;
411414 self . diagnostic_metadata . current_item = prev;
412415 }
413416 fn visit_arm ( & mut self , arm : & ' ast Arm ) {
@@ -1174,8 +1177,6 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
11741177 impl_items : & ' ast [ P < AssocItem > ] ,
11751178 ) {
11761179 debug ! ( "resolve_implementation" ) ;
1177- // Never ignore errors in trait implementations.
1178- let old_ignore = replace ( & mut self . in_func_body , false ) ;
11791180 // If applicable, create a rib for the type parameters.
11801181 self . with_generic_param_rib ( generics, ItemRibKind ( HasGenericParams :: Yes ) , |this| {
11811182 // 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> {
12711272 } ) ;
12721273 } ) ;
12731274 } ) ;
1274- self . in_func_body = old_ignore;
12751275 }
12761276
12771277 fn check_trait_item < F > ( & mut self , ident : Ident , ns : Namespace , span : Span , err : F )
0 commit comments