]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-21033.rs
Rollup merge of #106752 - sulami:master, r=estebank
[rust.git] / tests / ui / issues / issue-21033.rs
1 // run-pass
2 #![allow(unused_mut)]
3 #![allow(unused_variables)]
4 // pretty-expanded FIXME #23616
5
6 #![feature(box_patterns)]
7
8 enum E {
9     StructVar { boxed: Box<i32> }
10 }
11
12 fn main() {
13
14     // Test matching each shorthand notation for field patterns.
15     let mut a = E::StructVar { boxed: Box::new(3) };
16     match a {
17         E::StructVar { box boxed } => { }
18     }
19     match a {
20         E::StructVar { box ref boxed } => { }
21     }
22     match a {
23         E::StructVar { box mut boxed } => { }
24     }
25     match a {
26         E::StructVar { box ref mut boxed } => { }
27     }
28     match a {
29         E::StructVar { ref boxed } => { }
30     }
31     match a {
32         E::StructVar { ref mut boxed } => { }
33     }
34     match a {
35         E::StructVar { mut boxed } => { }
36     }
37
38     // Test matching non shorthand notation. Recreate a since last test
39     // moved `boxed`
40     let mut a = E::StructVar { boxed: Box::new(3) };
41     match a {
42         E::StructVar { boxed: box ref mut num } => { }
43     }
44     match a {
45         E::StructVar { boxed: ref mut num } => { }
46     }
47
48 }