forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#132949 - clubby789:macro-rules-attr-derive,…
… r=fmease Add specific diagnostic for using macro_rules macro as attribute/derive Fixes rust-lang#132928
- Loading branch information
Showing
7 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
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
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 {} |
42 changes: 42 additions & 0 deletions
42
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,42 @@ | ||
error: cannot find derive macro `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ------ `sample` exists, but a declarative macro cannot be used as a derive macro | ||
... | ||
LL | #[derive(sample)] | ||
| ^^^^^^ | ||
|
||
error: cannot find attribute `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ------ `sample` exists, but a declarative macro cannot be used as an attribute macro | ||
LL | | ||
LL | #[sample] | ||
| ^^^^^^ | ||
|
||
error: cannot find derive macro `sample` in this scope | ||
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10 | ||
| | ||
LL | macro_rules! sample { () => {} } | ||
| ------ `sample` exists, but a declarative macro cannot be used as a derive macro | ||
... | ||
LL | #[derive(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 | macro_rules! sample { () => {} } | ||
| ------ `sample` exists, but a declarative macro cannot be used as a derive macro | ||
... | ||
LL | #[derive(sample)] | ||
| ^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 4 previous errors | ||
|