Debian Codegraph @

gcc/testsuite/rust/compile/macros/proc/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] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
8 type AliasedType = inner::InnerStruct;
9
10 // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" "" { target *-*-* } .+1 }
11 #[proc_macro]
12 use inner::InnerStruct;
13
14 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
15 struct MyStruct;
16
17 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
18 struct MyCurlyStruct {
19 member: usize,
20 }
21
22 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
23 struct MyTupleStruct(usize);
24
25 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
26 extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." }
27 // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 }
28
29 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
30 mod my_module {}
31
32 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
33 enum MyEnum {}
34
35 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
36 union MyUnion {
37 f1: u32,
38 f2: f32,
39 }
40
41 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
42 const MY_CONST_STR: &str = "my_string";
43
44 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
45 static MY_STATIC_USIZE: usize = 10;
46
47 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
48 trait MyTrait {}
49
50 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
51 impl MyStruct {}
52
53 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
54 impl MyTrait for MyStruct {}
55
56 #[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" }
57 extern "C" {}