]>
Commit | Line | Data |
---|---|---|
32a655c1 SL |
1 | // Copyright 2017 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 | ||
32a655c1 SL |
11 | struct Foo { |
12 | present: (), | |
13 | } | |
14 | ||
15 | fn main() { | |
16 | let foo = Foo { #[cfg(all())] present: () }; | |
17 | let _ = Foo { #[cfg(any())] present: () }; | |
18 | //~^ ERROR missing field `present` in initializer of `Foo` | |
19 | let _ = Foo { present: (), #[cfg(any())] absent: () }; | |
20 | let _ = Foo { present: (), #[cfg(all())] absent: () }; | |
21 | //~^ ERROR struct `Foo` has no field named `absent` | |
22 | let Foo { #[cfg(all())] present: () } = foo; | |
23 | let Foo { #[cfg(any())] present: () } = foo; | |
24 | //~^ ERROR pattern does not mention field `present` | |
25 | let Foo { present: (), #[cfg(any())] absent: () } = foo; | |
26 | let Foo { present: (), #[cfg(all())] absent: () } = foo; | |
27 | //~^ ERROR struct `Foo` does not have a field named `absent` | |
28 | } |