-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for using macro_rules macro as attribute/derive
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![crate_type = "lib"] | ||
|
||
macro_rules! sample { () => {} } | ||
|
||
#[sample] //~ ERROR cannot find attribute `sample` in this scope | ||
#[derive(sample)] //~ ERROR cannot find derive macro `sample` in this scope | ||
//~| ERROR cannot find derive macro `sample` in this scope | ||
//~| ERROR cannot find derive macro `sample` in this scope | ||
pub struct S {} |
52 changes: 52 additions & 0 deletions
52
tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
error: cannot find derive macro `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | ||
| | ||
LL | #[derive(sample)] | ||
| ^^^^^^ consider moving the definition of `sample` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later at here | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ^^^^^^ | ||
|
||
error: cannot find attribute `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3 | ||
| | ||
LL | #[sample] | ||
| ^^^^^^ consider moving the definition of `sample` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later at here | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ^^^^^^ | ||
|
||
error: cannot find derive macro `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | ||
| | ||
LL | #[derive(sample)] | ||
| ^^^^^^ consider moving the definition of `sample` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later at here | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ^^^^^^ | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: cannot find derive macro `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | ||
| | ||
LL | #[derive(sample)] | ||
| ^^^^^^ consider moving the definition of `sample` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later at here | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:3:14 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ^^^^^^ | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 4 previous errors | ||
|