rust/compiler/rustc_mir_transform
Alan Egerton 22b3f59882
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.
2026-01-23 22:20:52 +00:00
..
src Fix suppression of unused_assignment in binding of unused_variable 2026-01-23 22:20:52 +00:00
Cargo.toml Use a hook to decouple rustc_mir_transform from rustc_mir_build 2026-01-10 22:14:35 +11:00
messages.ftl Handle inline asm in has_ffi_unwind_calls 2025-11-25 16:01:02 +00:00