Skip to content

Commit 8522140

Browse files
committed
Add test for using macro_rules macro as attribute/derive
1 parent 5700240 commit 8522140

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![crate_type = "lib"]
2+
3+
macro_rules! sample { () => {} }
4+
5+
#[sample] //~ ERROR cannot find attribute `sample` in this scope
6+
#[derive(sample)] //~ ERROR cannot find derive macro `sample` in this scope
7+
//~| ERROR cannot find derive macro `sample` in this scope
8+
//~| ERROR cannot find derive macro `sample` in this scope
9+
pub struct S {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error: cannot find derive macro `sample` in this scope
2+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10
3+
|
4+
LL | #[derive(sample)]
5+
| ^^^^^^ consider moving the definition of `sample` before this call
6+
|
7+
note: a macro with the same name exists, but it appears later at here
8+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14
9+
|
10+
LL | macro_rules! sample { () => {} }
11+
| ^^^^^^
12+
13+
error: cannot find attribute `sample` in this scope
14+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3
15+
|
16+
LL | #[sample]
17+
| ^^^^^^ consider moving the definition of `sample` before this call
18+
|
19+
note: a macro with the same name exists, but it appears later at here
20+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14
21+
|
22+
LL | macro_rules! sample { () => {} }
23+
| ^^^^^^
24+
25+
error: cannot find derive macro `sample` in this scope
26+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10
27+
|
28+
LL | #[derive(sample)]
29+
| ^^^^^^ consider moving the definition of `sample` before this call
30+
|
31+
note: a macro with the same name exists, but it appears later at here
32+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14
33+
|
34+
LL | macro_rules! sample { () => {} }
35+
| ^^^^^^
36+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
37+
38+
error: cannot find derive macro `sample` in this scope
39+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10
40+
|
41+
LL | #[derive(sample)]
42+
| ^^^^^^ consider moving the definition of `sample` before this call
43+
|
44+
note: a macro with the same name exists, but it appears later at here
45+
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14
46+
|
47+
LL | macro_rules! sample { () => {} }
48+
| ^^^^^^
49+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
50+
51+
error: aborting due to 4 previous errors
52+

0 commit comments

Comments
 (0)