1 // Copyright 2018 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.
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.
11 // aux-build:proc-macro-gates.rs
12 // gate-test-proc_macro_non_items
13 // gate-test-proc_macro_path_invoc
14 // gate-test-proc_macro_mod line
15 // gate-test-proc_macro_expr
16 // gate-test-proc_macro_mod
17 // gate-test-proc_macro_gen
19 #![feature(use_extern_macros, stmt_expr_attributes)]
21 extern crate proc_macro_gates as foo;
25 #[foo::a] //~ ERROR: paths of length greater than one
32 #[a] //~ ERROR: custom attributes cannot be applied to modules
33 //~| ERROR: procedural macros cannot expand to modules
37 #![a] //~ ERROR: custom attributes cannot be applied to modules
38 //~| ERROR: procedural macros cannot expand to modules
41 #[a = y] //~ ERROR: must only be followed by a delimiter token
44 #[a = ] //~ ERROR: must only be followed by a delimiter token
47 #[a () = ] //~ ERROR: must only be followed by a delimiter token
56 #[a] //~ ERROR: custom attributes cannot be applied to statements
60 #[a] //~ ERROR: custom attributes cannot be applied to statements
64 #[a] //~ ERROR: custom attributes cannot be applied to statements
68 let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions
71 let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions
74 let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions
78 let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types
79 if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns
81 m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
82 m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
84 let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions
85 let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions