diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-12-11 02:17:28 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-11 02:17:28 +0000 |
| commit | c2d23ad0df5b3603ea0a1d2f4892fb84faaf8a3f (patch) | |
| tree | debad8c5f99699e00d6ef4b13372778f5a8856db /tests | |
| parent | 59740a8eb1081fba7a25b60ab7d7acae98f1d3bd (diff) | |
| parent | f51f72b400b554effa48811534219430b68f3861 (diff) | |
Detect shadowing in pattern field (#13797)
Fix #13795 changelog: [`shadow_same`]: detect shadowing as a pattern field
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/shadow.rs | 8 | ||||
| -rw-r--r-- | tests/ui/shadow.stderr | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/tests/ui/shadow.rs b/tests/ui/shadow.rs index 30b96277f99..31944f5ef1b 100644 --- a/tests/ui/shadow.rs +++ b/tests/ui/shadow.rs @@ -133,4 +133,12 @@ fn shadow_closure() { .collect(); } +struct Issue13795 { + value: i32, +} + +fn issue13795(value: Issue13795) { + let Issue13795 { value, .. } = value; +} + fn main() {} diff --git a/tests/ui/shadow.stderr b/tests/ui/shadow.stderr index 5d2d7060450..c8c524b3a2f 100644 --- a/tests/ui/shadow.stderr +++ b/tests/ui/shadow.stderr @@ -304,5 +304,17 @@ note: previous binding is here LL | .map(|i| i.map(|i| i - 10)) | ^ -error: aborting due to 25 previous errors +error: `value` is shadowed by itself in `value` + --> tests/ui/shadow.rs:141:22 + | +LL | let Issue13795 { value, .. } = value; + | ^^^^^ + | +note: previous binding is here + --> tests/ui/shadow.rs:140:15 + | +LL | fn issue13795(value: Issue13795) { + | ^^^^^ + +error: aborting due to 26 previous errors |
