forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#109638 - NotStirred:suggest/non-derive, r=d…
…avidtwco Add suggestion to remove `derive()` if invoked macro is non-derive Adds to the existing `expected derive macro, found {}` error message: ``` help: remove the surrounding "derive()": --> $DIR/macro-path-prelude-fail-4.rs:1:3 | LL | #[derive(inline)] | ^^^^^^^ ^ ``` This suggestion will either fix the issue, in the case that the macro was valid, or provide a better error message if not Not ready for merge yet, as the highlighted span is only valid for trivial formatting. Is there a nice way to get the parent span of the macro path within `smart_resolve_macro_path`? Closes rust-lang#109589
- Loading branch information
Showing
8 changed files
with
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[derive(Clone, Debug)] // OK | ||
struct S; | ||
|
||
#[derive(Debug, inline)] //~ ERROR expected derive macro, found built-in attribute `inline` | ||
struct T; | ||
|
||
#[derive(inline, Debug)] //~ ERROR expected derive macro, found built-in attribute `inline` | ||
struct U; | ||
|
||
fn main() {} |
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,30 @@ | ||
error: expected derive macro, found built-in attribute `inline` | ||
--> $DIR/macro-path-prelude-fail-5.rs:4:17 | ||
| | ||
LL | #[derive(Debug, inline)] | ||
| ^^^^^^ not a derive macro | ||
| | ||
help: remove from the surrounding `derive()` | ||
--> $DIR/macro-path-prelude-fail-5.rs:4:17 | ||
| | ||
LL | #[derive(Debug, inline)] | ||
| ^^^^^^ | ||
= help: add as non-Derive macro | ||
`#[inline]` | ||
|
||
error: expected derive macro, found built-in attribute `inline` | ||
--> $DIR/macro-path-prelude-fail-5.rs:7:10 | ||
| | ||
LL | #[derive(inline, Debug)] | ||
| ^^^^^^ not a derive macro | ||
| | ||
help: remove from the surrounding `derive()` | ||
--> $DIR/macro-path-prelude-fail-5.rs:7:10 | ||
| | ||
LL | #[derive(inline, Debug)] | ||
| ^^^^^^ | ||
= help: add as non-Derive macro | ||
`#[inline]` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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