Debian Codegraph @

gcc/testsuite/rust/compile/macros/proc/attribute_non_function.rs

raw
1 // { dg-additional-options "-frust-crate-type=proc-macro" }
2
3 mod inner {
4 struct InnerStruct;
5 }
6
7 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
8 type AliasedType = inner::InnerStruct;
9
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;
13
14 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
15 struct MyStruct;
16
17 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
18 struct MyCurlyStruct {
19 member: usize,
20 }
21
22 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
23 struct MyTupleStruct(usize);
24
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 }
29
30 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
31 mod my_module {}
32
33 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
34 enum MyEnum {}
35
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,
40 }
41
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";
44
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;
47
48 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
49 trait MyTrait {}
50
51 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
52 impl MyStruct {}
53
54 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
55 impl MyTrait for MyStruct {}
56
57 #[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" }
58 extern "C" {}