]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issue-21033.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / run-pass / issue-21033.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 // pretty-expanded FIXME #23616
11
12 #![feature(box_patterns)]
13 #![feature(box_syntax)]
14
15 enum E {
16 StructVar { boxed: Box<i32> }
17 }
18
19 fn main() {
20
21 // Test matching each shorthand notation for field patterns.
22 let mut a = E::StructVar { boxed: box 3 };
23 match a {
24 E::StructVar { box boxed } => { }
25 }
26 match a {
27 E::StructVar { box ref boxed } => { }
28 }
29 match a {
30 E::StructVar { box mut boxed } => { }
31 }
32 match a {
33 E::StructVar { box ref mut boxed } => { }
34 }
35 match a {
36 E::StructVar { ref boxed } => { }
37 }
38 match a {
39 E::StructVar { ref mut boxed } => { }
40 }
41 match a {
42 E::StructVar { mut boxed } => { }
43 }
44
45 // Test matching non shorthand notation. Recreate a since last test
46 // moved `boxed`
47 let mut a = E::StructVar { boxed: box 3 };
48 match a {
49 E::StructVar { boxed: box ref mut num } => { }
50 }
51 match a {
52 E::StructVar { boxed: ref mut num } => { }
53 }
54
55 }