rust/compiler/rustc_mir_transform
bors 9415853279 Auto merge of #151556 - eggyal:unused-assignment-to-unused-variable, r=cjgillot
Fix suppression of `unused_assignment` in binding of `unused_variable`

Unused assignments to an unused variable should trigger only the `unused_variables` lint and not also the `unused_assignments` lint. This was previously implemented by checking whether the span of the assignee was within the span of the binding pattern, however that failed to capture situations was imported from elsewhere (eg from the input tokenstream of a proc-macro that generates the binding pattern).

By comparing the span of the assignee to those of the variable introductions instead, a reported stable-to-stable regression is resolved.

This fix also impacted some other preexisting tests, which had (undesirably) been triggering both the `unused_variables` and `unused_assignments` lints on the same initializing assignment; those tests have therefore now been updated to expect only the former lint.

Fixes rust-lang/rust#151514
r? cjgillot (as author of reworked liveness testing in rust-lang/rust#142390)
2026-01-25 13:10:32 +00:00
..
src Auto merge of #151556 - eggyal:unused-assignment-to-unused-variable, r=cjgillot 2026-01-25 13:10:32 +00:00
Cargo.toml compiler: upgrade to hashbrown 0.16.1 2026-01-13 11:18:09 -08:00
messages.ftl Handle inline asm in has_ffi_unwind_calls 2025-11-25 16:01:02 +00:00