Skip to content

Commit

Permalink
Use the same span for attributes and Try expansion of ?
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
samueltardieu committed Sep 11, 2024
1 parent f7f8bdf commit 6ee87ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit 6ee87ae

Please sign in to comment.