-
Notifications
You must be signed in to change notification settings - Fork 5
derive_where attribute macro instead of derive macro #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+366
−449
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
51a37b9
Code changes for migrating to attribute_macro
ModProg e342c42
documentation for attribute macro
ModProg c591c10
formatted
ModProg 36913ba
Fixing tests
ModProg 913be22
Formatted
ModProg ad622fd
Fixed test
ModProg be091ef
Remove empty lines
ModProg 6c8d692
Apply suggestions from code review
ModProg a208094
Apply suggestions
ModProg 681793a
fix removing item on error
ModProg 537017b
resort imports
ModProg 2c2b931
Use span of cleaned item
ModProg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,38 +1,37 @@ | ||
error: unknown option | ||
--> tests/ui/default.rs:7:42 | ||
--> tests/ui/default.rs:6:42 | ||
| | ||
7 | struct DefaultOnStruct<T>(#[derive_where(default)] PhantomData<T>); | ||
6 | struct DefaultOnStruct<T>(#[derive_where(default)] PhantomData<T>); | ||
| ^^^^^^^ | ||
|
||
error: `default` is only supported if `Default` is being implemented | ||
--> tests/ui/default.rs:12:17 | ||
--> tests/ui/default.rs:10:17 | ||
| | ||
12 | #[derive_where(default)] | ||
10 | #[derive_where(default)] | ||
| ^^^^^^^ | ||
|
||
error: required `default` option on a variant if `Default` is being implemented | ||
--> tests/ui/default.rs:17:1 | ||
--> tests/ui/default.rs:15:1 | ||
| | ||
17 | / #[derive_where(Default)] | ||
18 | | enum MissingDefault<T> { | ||
19 | | A(PhantomData<T>), | ||
20 | | } | ||
15 | / enum MissingDefault<T> { | ||
16 | | A(PhantomData<T>), | ||
17 | | } | ||
| |_^ | ||
|
||
error: multiple `default` options in enum | ||
--> tests/ui/default.rs:27:17 | ||
--> tests/ui/default.rs:23:17 | ||
| | ||
27 | #[derive_where(default)] | ||
23 | #[derive_where(default)] | ||
| ^^^^^^^ | ||
|
||
error: duplicate `default` option | ||
--> tests/ui/default.rs:34:26 | ||
--> tests/ui/default.rs:29:26 | ||
| | ||
34 | #[derive_where(default, default)] | ||
29 | #[derive_where(default, default)] | ||
| ^^^^^^^ | ||
|
||
error: duplicate `default` option | ||
--> tests/ui/default.rs:42:17 | ||
--> tests/ui/default.rs:36:17 | ||
| | ||
42 | #[derive_where(default)] | ||
36 | #[derive_where(default)] | ||
| ^^^^^^^ |
This file contains hidden or 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 hidden or 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,53 +1,51 @@ | ||
error: no traits found to implement, use `#[derive_where(..)` to specify some | ||
--> tests/ui/item.rs:6:1 | ||
error: empty `derive_where` found | ||
--> tests/ui/item.rs:5:1 | ||
| | ||
6 | struct NoAttribute<T>(PhantomData<T>); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unexpected option syntax | ||
--> tests/ui/item.rs:9:3 | ||
5 | #[derive_where] | ||
ModProg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ^^^^^^^^^^^^^^^ | ||
| | ||
9 | #[derive_where] | ||
| ^^^^^^^^^^^^ | ||
= note: this error originates in the attribute macro `derive_where` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: empty `derive_where` found | ||
--> tests/ui/item.rs:13:3 | ||
| | ||
13 | #[derive_where()] | ||
| ^^^^^^^^^^^^^^ | ||
--> tests/ui/item.rs:8:1 | ||
| | ||
8 | #[derive_where()] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `derive_where` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: expected `,` | ||
--> tests/ui/item.rs:17:24 | ||
--> tests/ui/item.rs:11:24 | ||
| | ||
17 | #[derive_where(Clone; T;)] | ||
11 | #[derive_where(Clone; T;)] | ||
| ^ | ||
|
||
error: expected type to bind to, expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime | ||
--> tests/ui/item.rs:21:25 | ||
--> tests/ui/item.rs:14:25 | ||
| | ||
21 | #[derive_where(Clone; T,,)] | ||
14 | #[derive_where(Clone; T,,)] | ||
| ^ | ||
|
||
error: expected type to bind to, expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime | ||
--> tests/ui/item.rs:25:23 | ||
--> tests/ui/item.rs:17:23 | ||
| | ||
25 | #[derive_where(Clone; where)] | ||
17 | #[derive_where(Clone; where)] | ||
| ^^^^^ | ||
|
||
error: expected `;` or `, | ||
--> tests/ui/item.rs:29:22 | ||
--> tests/ui/item.rs:20:22 | ||
| | ||
29 | #[derive_where(Clone Debug)] | ||
20 | #[derive_where(Clone Debug)] | ||
| ^^^^^ | ||
|
||
error: expected `,` | ||
--> tests/ui/item.rs:33:25 | ||
--> tests/ui/item.rs:23:25 | ||
| | ||
33 | #[derive_where(Clone; T U)] | ||
23 | #[derive_where(Clone; T U)] | ||
| ^ | ||
|
||
error: unexpected option syntax | ||
--> tests/ui/item.rs:37:16 | ||
--> tests/ui/item.rs:26:16 | ||
| | ||
37 | #[derive_where("Clone")] | ||
26 | #[derive_where("Clone")] | ||
| ^^^^^^^ |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.