diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-15 16:04:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-15 16:04:01 +0200 |
| commit | c97a9c82b218951c5de0ce9a01cb8c00d2429997 (patch) | |
| tree | d86bd7dc7127908333ad38b44761f1a6e15529da /compiler | |
| parent | 501837fa8859c61824a433609925de40178d12e5 (diff) | |
| parent | ae4eeb9299b5938cca183ad7a90e70a1bb4b1174 (diff) | |
| download | rust-c97a9c82b218951c5de0ce9a01cb8c00d2429997.tar.gz rust-c97a9c82b218951c5de0ce9a01cb8c00d2429997.zip | |
Rollup merge of #145430 - Urgau:drop_forget_useless-145427, r=lqd
Fix wrong spans with external macros in the `dropping_copy_types` lint This PR fixes some wrong spans manipulations when external macros are involved. Specifically we didn't make sure the spans had the same context, which kind-of make our spans manipulations go wrong and produce weird spans. We fix that by making sure they have the same context. Fixes https://github.com/rust-lang/rust/issues/145427
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/drop_forget_useless.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index 7f098893f7d..c2d137986ce 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -151,7 +151,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { && let Node::Stmt(stmt) = node && let StmtKind::Semi(e) = stmt.kind && e.hir_id == expr.hir_id - && let Some(arg_span) = arg.span.find_ancestor_inside(expr.span) + && let Some(arg_span) = arg.span.find_ancestor_inside_same_ctxt(expr.span) { UseLetUnderscoreIgnoreSuggestion::Suggestion { start_span: expr.span.shrink_to_lo().until(arg_span), |
