From 6ee87ae5944e02342e3d600700b773a1d4303845 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 11 Sep 2024 20:43:50 +0200 Subject: [PATCH] Use the same span for attributes and Try expansion of ? This is needed for Clippy to know that the `#[allow(unused)]` attributes added by the expansion of `?` are part of the desugaring, and that they do not come from the user code. rust-lang/rust-clippy#13380 exhibits a manifestation of this problem. --- compiler/rustc_ast_lowering/src/expr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index a6c7714a182bf..b887908f90461 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1837,7 +1837,7 @@ impl<'hir> LoweringContext<'_, 'hir> { Safety::Default, sym::allow, sym::unreachable_code, - self.lower_span(span), + try_span, ); let attrs: AttrVec = thin_vec![attr];