gccrs: Handle `async` functions in traits
[official-gcc.git] / gcc / testsuite / rust / compile / proc_macro_attribute_non_function.rs
blob0e88bbebacc4003102f6d864a6661ec1eba2897c
1 // { dg-additional-options "-frust-crate-type=proc-macro" }
3 mod inner {
4     struct InnerStruct;
7 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
8 type AliasedType = inner::InnerStruct;
10 // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .+1 }
11 #[proc_macro_attribute]
12 use inner::InnerStruct;
14 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
15 struct MyStruct;
17 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
18 struct MyCurlyStruct {
19     member: usize,
22 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
23 struct MyTupleStruct(usize);
25 #[proc_macro_attribute]
26 // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .-1 }
27 extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." }
28                               // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 }
30 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
31 mod my_module {}
33 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
34 enum MyEnum {}
36 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
37 union MyUnion {
38     f1: u32,
39     f2: f32,
42 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
43 const MY_CONST_STR: &str = "my_string";
45 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
46 static MY_STATIC_USIZE: usize = 10;
48 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
49 trait MyTrait {}
51 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
52 impl MyStruct {}
54 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
55 impl MyTrait for MyStruct {}
57 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
58 extern "C" {}