forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax.rs
38 lines (32 loc) · 859 Bytes
/
syntax.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#![feature(cfg_match)]
cfg_match! {
cfg(unix) => const BAD_SINGLE_ELEMENT: () = ();,
//~^ ERROR arms without brackets are only allowed for function
_ => const BAD_SINGLE_ELEMENT: () = ();,
}
cfg_match! {
cfg(unix) => fn missing_comma() {}
_ => fn missing_comma() {}
//~^ ERROR conditional arms with a single element must end with a com
}
cfg_match! {
cfg(unix) {
//~^ ERROR conditional arm must be declared with a trailing
fn regular_arm() {}
}
_ => { fn regular_arm() {} }
}
cfg_match! {
cfg(unix) => { fn wildcard() {} }
{
//~^ ERROR the last arm is expected to be a wildcard
fn wildcard() {}
}
}
fn meaningless() {
cfg_match! {
//~^ ERROR single arm with a single element has the same effect of a st
cfg(feature = "foo") => fn foo() {},
}
}
pub fn main() {}