-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add toggle for
parse_meta_item
unsafe parsing
This makes it possible for the `unsafe(...)` syntax to only be valid at the top level, and the `NestedMetaItem`s will automatically reject `unsafe(...)`.
- Loading branch information
1 parent
d8bc876
commit 5bd483d
Showing
17 changed files
with
217 additions
and
95 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
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
59 changes: 54 additions & 5 deletions
59
tests/ui/attributes/unsafe/derive-unsafe-attributes.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 |
---|---|---|
@@ -1,16 +1,65 @@ | ||
error: traits in `#[derive(...)]` don't accept `unsafe(...)` | ||
error: expected identifier, found keyword `unsafe` | ||
--> $DIR/derive-unsafe-attributes.rs:3:10 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^ | ||
| ^^^^^^ expected identifier, found keyword | ||
| | ||
help: escape `unsafe` to use it as an identifier | ||
| | ||
LL | #[derive(r#unsafe(Debug))] | ||
| ++ | ||
|
||
error: traits in `#[derive(...)]` don't accept arguments | ||
--> $DIR/derive-unsafe-attributes.rs:3:16 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^^ help: remove the arguments | ||
|
||
error: `derive` is not an unsafe attribute | ||
--> $DIR/derive-unsafe-attributes.rs:6:3 | ||
--> $DIR/derive-unsafe-attributes.rs:12:3 | ||
| | ||
LL | #[unsafe(derive(Debug))] | ||
| ^^^^^^ | ||
| ^^^^^^ this is not an unsafe attribute | ||
| | ||
= note: extraneous unsafe is not allowed in attributes | ||
|
||
error: aborting due to 2 previous errors | ||
error: expected identifier, found keyword `unsafe` | ||
--> $DIR/derive-unsafe-attributes.rs:3:10 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^ expected identifier, found keyword | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
help: escape `unsafe` to use it as an identifier | ||
| | ||
LL | #[derive(r#unsafe(Debug))] | ||
| ++ | ||
|
||
error: expected identifier, found keyword `unsafe` | ||
--> $DIR/derive-unsafe-attributes.rs:3:10 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^ expected identifier, found keyword | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
help: escape `unsafe` to use it as an identifier | ||
| | ||
LL | #[derive(r#unsafe(Debug))] | ||
| ++ | ||
|
||
error: cannot find derive macro `r#unsafe` in this scope | ||
--> $DIR/derive-unsafe-attributes.rs:3:10 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^ | ||
|
||
error: cannot find derive macro `r#unsafe` in this scope | ||
--> $DIR/derive-unsafe-attributes.rs:3:10 | ||
| | ||
LL | #[derive(unsafe(Debug))] | ||
| ^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 7 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
Oops, something went wrong.