diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/pattern/issue-11577.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/pattern/issue-11577.rs b/src/test/ui/pattern/issue-11577.rs new file mode 100644 index 000000000..70177c5ed --- /dev/null +++ b/src/test/ui/pattern/issue-11577.rs @@ -0,0 +1,18 @@ +// run-pass +// Destructuring struct variants would ICE where regular structs wouldn't + +enum Foo { + VBar { num: isize } +} + +struct SBar { num: isize } + +pub fn main() { + let vbar = Foo::VBar { num: 1 }; + let Foo::VBar { num } = vbar; + assert_eq!(num, 1); + + let sbar = SBar { num: 2 }; + let SBar { num } = sbar; + assert_eq!(num, 2); +} |