rust/tests/ui/pattern/bindings-after-at
Alan Egerton 01268919a5 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.

(cherry picked from commit 22b3f59882)
2026-02-12 09:06:11 -08:00
..
bind-by-copy-or-pat.rs lower bindings in the order they're written 2025-08-06 12:13:40 -07:00
bind-by-copy.rs Fix suppression of unused_assignment in binding of unused_variable 2026-02-12 09:06:11 -08:00
bind-by-copy.stderr Fix suppression of unused_assignment in binding of unused_variable 2026-02-12 09:06:11 -08:00
bind-by-move-neither-can-live-while-the-other-survives-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
bind-by-move-neither-can-live-while-the-other-survives-1.stderr Tweak wording 2024-03-13 23:05:17 +00:00
bind-by-move-no-subbindings-fun-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
bind-by-move-no-subbindings-fun-param.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
borrowck-move-and-move.rs Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-move-and-move.stderr Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-at-and-box-pass.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
borrowck-pat-at-and-box.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
borrowck-pat-at-and-box.stderr Run check_match and check_liveness when MIR is built instead of having an explicit phase for them 2023-04-21 22:32:38 +00:00
borrowck-pat-by-copy-bindings-in-at.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
borrowck-pat-by-move-and-ref-inverse-promotion.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
borrowck-pat-by-move-and-ref-inverse-promotion.stderr Tweak wording 2024-03-13 23:05:17 +00:00
borrowck-pat-by-move-and-ref-inverse.rs Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-by-move-and-ref-inverse.stderr Tweak wording 2024-03-13 23:05:17 +00:00
borrowck-pat-by-move-and-ref.rs Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-by-move-and-ref.stderr Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-ref-both-sides.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
borrowck-pat-ref-mut-and-ref.rs Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-ref-mut-and-ref.stderr Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck 2024-07-26 14:41:56 -04:00
borrowck-pat-ref-mut-twice.rs Put new bindings first in refutable cases too 2024-01-25 02:56:02 +01:00
borrowck-pat-ref-mut-twice.stderr Tweak wording 2024-03-13 23:05:17 +00:00
box-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
copy-and-move-mixed.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
copy-and-move-mixed.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
default-binding-modes-both-sides-independent.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
default-binding-modes-both-sides-independent.stderr Tweak wording 2024-03-13 23:05:17 +00:00
nested-binding-mode-lint.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nested-binding-modes-mut.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
nested-binding-modes-mut.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
nested-binding-modes-ref.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
nested-binding-modes-ref.stderr Make E0614 a structured error 2025-02-25 16:56:04 +00:00
nested-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nested-type-ascription-syntactically-invalid.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
nested-type-ascription-syntactically-invalid.stderr Remove old diagnostic notes for type ascription syntax 2025-04-16 20:24:55 +10:00
or-patterns-box-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
or-patterns-slice-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
or-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
pat-at-same-name-both.rs Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
pat-at-same-name-both.stderr Better span for "make binding mutable" suggestion 2024-07-04 02:02:21 +00:00
slice-patterns.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
wild-before-at-syntactically-rejected.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
wild-before-at-syntactically-rejected.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00