@@ -504,10 +504,9 @@ impl<'a, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
504
504
505
505
visit:: walk_fn_ret_ty ( this, & declaration. output ) ;
506
506
507
- let previous_state = this. in_func_body ;
508
507
// Ignore errors in function bodies if this is rustdoc
509
508
// Be sure not to set this until the function signature has been resolved.
510
- this. in_func_body = true ;
509
+ let previous_state = replace ( & mut this. in_func_body , true ) ;
511
510
// Resolve the function body, potentially inside the body of an async closure
512
511
match fn_kind {
513
512
FnKind :: Fn ( .., body) => walk_list ! ( this, visit_block, body) ,
@@ -1175,9 +1174,8 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1175
1174
impl_items : & ' ast [ P < AssocItem > ] ,
1176
1175
) {
1177
1176
debug ! ( "resolve_implementation" ) ;
1178
- let old_ignore = self . in_func_body ;
1179
1177
// Never ignore errors in trait implementations.
1180
- self . in_func_body = false ;
1178
+ let old_ignore = replace ( & mut self . in_func_body , false ) ;
1181
1179
// If applicable, create a rib for the type parameters.
1182
1180
self . with_generic_param_rib ( generics, ItemRibKind ( HasGenericParams :: Yes ) , |this| {
1183
1181
// Dummy self type for better errors if `Self` is used in the trait path.
0 commit comments