diff options
Diffstat (limited to 'src/test/ui/proc-macro/proc-macro-gates.rs')
| -rw-r--r-- | src/test/ui/proc-macro/proc-macro-gates.rs | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs index af6bfa08aaa..678dc83b753 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.rs +++ b/src/test/ui/proc-macro/proc-macro-gates.rs @@ -1,61 +1,62 @@ -// aux-build:proc-macro-gates.rs +// aux-build:test-macros.rs // gate-test-proc_macro_hygiene #![feature(stmt_expr_attributes)] -extern crate proc_macro_gates as foo; - -use foo::*; +#[macro_use] +extern crate test_macros; fn _test_inner() { - #![a] //~ ERROR: non-builtin inner attributes are unstable + #![empty_attr] //~ ERROR: non-builtin inner attributes are unstable } -#[a] //~ ERROR: custom attributes cannot be applied to modules +#[empty_attr] //~ ERROR: custom attributes cannot be applied to modules mod _test2 {} mod _test2_inner { - #![a] //~ ERROR: custom attributes cannot be applied to modules + #![empty_attr] //~ ERROR: custom attributes cannot be applied to modules //~| ERROR: non-builtin inner attributes are unstable } -#[a = "y"] //~ ERROR: must only be followed by a delimiter token +#[empty_attr = "y"] //~ ERROR: must only be followed by a delimiter token fn _test3() {} fn attrs() { // Statement, item - #[a] // OK + #[empty_attr] // OK struct S; // Statement, macro - #[a] //~ ERROR: custom attributes cannot be applied to statements + #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements println!(); // Statement, semi - #[a] //~ ERROR: custom attributes cannot be applied to statements + #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements S; // Statement, local - #[a] //~ ERROR: custom attributes cannot be applied to statements + #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements let _x = 2; // Expr - let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions + let _x = #[identity_attr] 2; //~ ERROR: custom attributes cannot be applied to expressions // Opt expr - let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions + let _x = [#[identity_attr] 2]; //~ ERROR: custom attributes cannot be applied to expressions // Expr macro - let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions + let _x = #[identity_attr] println!(); + //~^ ERROR: custom attributes cannot be applied to expressions } fn main() { - let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types - if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns + let _x: identity!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types + if let identity!(Some(_x)) = Some(3) {} + //~^ ERROR: procedural macros cannot be expanded to patterns - m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements - m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements + empty!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements + empty!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements - let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions - let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions + let _x = identity!(3); //~ ERROR: procedural macros cannot be expanded to expressions + let _x = [empty!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions } |
