]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/attributes-on-modules-fail.rs
Rollup merge of #107470 - kadiwa4:bootstrap_cleanup, r=albertlarsan68
[rust.git] / tests / ui / proc-macro / attributes-on-modules-fail.rs
1 // aux-build:test-macros.rs
2
3 #[macro_use]
4 extern crate test_macros;
5
6 #[identity_attr]
7 mod m {
8     pub struct X;
9
10     type A = Y; //~ ERROR cannot find type `Y` in this scope
11 }
12
13 struct Y;
14 type A = X; //~ ERROR cannot find type `X` in this scope
15
16 #[derive(Copy)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
17 mod n {}
18
19 #[empty_attr]
20 mod module; //~ ERROR non-inline modules in proc macro input are unstable
21
22 #[empty_attr]
23 mod outer {
24     mod inner; //~ ERROR non-inline modules in proc macro input are unstable
25
26     mod inner_inline {} // OK
27 }
28
29 #[derive(Empty)]
30 struct S {
31     field: [u8; {
32         #[path = "outer/inner.rs"]
33         mod inner; //~ ERROR non-inline modules in proc macro input are unstable
34         mod inner_inline {} // OK
35         0
36     }]
37 }
38
39 #[identity_attr]
40 fn f() {
41     #[path = "outer/inner.rs"]
42     mod inner; //~ ERROR non-inline modules in proc macro input are unstable
43     mod inner_inline {} // OK
44 }
45
46 fn main() {}