1 #![feature(half_open_range_patterns)]
2 
main()3 fn main() {}
4 
e()5 #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; }
6 //~^ ERROR an inner attribute is not permitted in this context
e()7 #[cfg(FALSE)] fn e() { let _ = [#[attr]]; }
8 //~^ ERROR expected expression, found `]`
e()9 #[cfg(FALSE)] fn e() { let _ = foo#[attr](); }
10 //~^ ERROR expected one of
e()11 #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
12 //~^ ERROR an inner attribute is not permitted in this context
13 //~| ERROR expected expression, found `)`
e()14 #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
15 //~^ ERROR an inner attribute is not permitted in this context
16 //~| ERROR expected expression, found `)`
e()17 #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
18 //~^ ERROR an inner attribute is not permitted in this context
e()19 #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
20 //~^ ERROR an inner attribute is not permitted in this context
e()21 #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
22 //~^ ERROR an inner attribute is not permitted in this context
e()23 #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; }
24 //~^ ERROR expected one of
e()25 #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
26 //~^ ERROR an inner attribute is not permitted in this context
e()27 #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
28 //~^ ERROR an inner attribute is not permitted in this context
e()29 #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
30 //~^ ERROR an inner attribute is not permitted in this context
e()31 #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
32 //~^ ERROR an inner attribute is not permitted in this context
e()33 #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; }
34 //~^ ERROR expected expression, found `..`
e()35 #[cfg(FALSE)] fn e() { let _ = #[attr] ..; }
36 //~^ ERROR expected expression, found `..`
e()37 #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
38 //~^ ERROR an inner attribute is not permitted in this context
e()39 #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
40 //~^ ERROR an inner attribute is not permitted in this context
e()41 #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
42 //~^ ERROR outer attributes are not allowed on `if`
e()43 #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
44 //~^ ERROR an inner attribute is not permitted in this context
e()45 #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; }
46 //~^ ERROR expected one of
e()47 #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
48 //~^ ERROR outer attributes are not allowed on `if`
e()49 #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
50 //~^ ERROR an inner attribute is not permitted in this context
e()51 #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
52 //~^ ERROR outer attributes are not allowed on `if`
e()53 #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
54 //~^ ERROR outer attributes are not allowed on `if`
e()55 #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
56 //~^ ERROR an inner attribute is not permitted in this context
e()57 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
58 //~^ ERROR outer attributes are not allowed on `if`
e()59 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
60 //~^ ERROR an inner attribute is not permitted in this context
e()61 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
62 //~^ ERROR expected one of
e()63 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
64 //~^ ERROR outer attributes are not allowed on `if`
e()65 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
66 //~^ ERROR an inner attribute is not permitted in this context
e()67 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
68 //~^ ERROR outer attributes are not allowed on `if`
e()69 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
70 //~^ ERROR outer attributes are not allowed on `if`
e()71 #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
72 //~^ ERROR an inner attribute is not permitted in this context
73 
s()74 #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
75 //~^ ERROR an inner attribute is not permitted following an outer attribute
s()76 #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
77 //~^ ERROR an inner attribute is not permitted following an outer attribute
s()78 #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
79 //~^ ERROR an inner attribute is not permitted following an outer attribute
s()80 #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
81 //~^ ERROR an inner attribute is not permitted following an outer attribute
s()82 #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
83 //~^ ERROR an inner attribute is not permitted following an outer attribute
84 
85 // FIXME: Allow attributes in pattern constexprs?
86 // note: requires parens in patterns to allow disambiguation
87 
e()88 #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
89 //~^ ERROR inclusive range with no end
90 //~| ERROR expected one of `=>`, `if`, or `|`, found `#`
e()91 #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
92 //~^ ERROR inclusive range with no end
93 //~| ERROR expected one of `=>`, `if`, or `|`, found `#`
e()94 #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
95 //~^ ERROR unexpected token: `#`
e()96 #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
97 //~^ ERROR inclusive range with no end
98 //~| ERROR expected one of `=>`, `if`, or `|`, found `#`
99 
e()100 #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
101 //~^ ERROR unexpected token: `#`
102 //~| ERROR expected one of `.`
e()103 #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
104 //~^ ERROR unexpected token: `#`
105 //~| ERROR expected one of `.`
106 
107 // make sure we don't catch this bug again...
e()108 #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } }
109 //~^ ERROR expected statement after outer attribute
e()110 #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } }
111 //~^ ERROR expected statement after outer attribute
112