diff options
| author | Michael Goulet <michael@errs.io> | 2022-04-01 20:24:32 -0700 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-04-06 19:28:27 -0700 |
| commit | 17f5c4d255323d331345ffe4cfebb959b1b5fa1a (patch) | |
| tree | d8f8c010c0e0f55bcf6a788339d5fce53d6798bc /src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs | |
| parent | 8f36334ca939a67cce3f37f24953ff6f2d3f3d33 (diff) | |
| download | rust-17f5c4d255323d331345ffe4cfebb959b1b5fa1a.tar.gz rust-17f5c4d255323d331345ffe4cfebb959b1b5fa1a.zip | |
Fix unit struct/enum variant in destructuring assignment
Diffstat (limited to 'src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs')
| -rw-r--r-- | src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs b/src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs new file mode 100644 index 00000000000..8da7f90c524 --- /dev/null +++ b/src/test/ui/destructuring-assignment/struct-or-enum-variant-path.rs @@ -0,0 +1,34 @@ +// check-pass + +struct S; + +enum E { + V, +} + +type A = E; + +fn main() { + let mut a; + + (S, a) = (S, ()); + + (E::V, a) = (E::V, ()); + + (<E>::V, a) = (E::V, ()); + (A::V, a) = (E::V, ()); +} + +impl S { + fn check() { + let a; + (Self, a) = (S, ()); + } +} + +impl E { + fn check() { + let a; + (Self::V, a) = (E::V, ()); + } +} |
