-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #63867 - petrochenkov:dhelpers, r=matthewjasper
resolve: Block expansion of a derive container until all its derives are resolved So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (#63248). The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see #63468 (comment) and the `#[stable_hasher]`-related test failures in #63468). So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved. After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives. Unblocks #63468 r? @matthewjasper (as a reviewer of #63248) cc @c410-f3r
- Loading branch information
Showing
12 changed files
with
127 additions
and
113 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
16 changes: 5 additions & 11 deletions
16
src/test/ui/feature-gate/issue-43106-gating-of-derive.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,38 +1,32 @@ | ||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:4:1 | ||
| | ||
LL | #![derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` | ||
|
||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:7:1 | ||
| | ||
LL | #[derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:10:17 | ||
--> $DIR/issue-43106-gating-of-derive.rs:7:17 | ||
| | ||
LL | mod inner { #![derive(Debug)] } | ||
| ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` | ||
|
||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:13:5 | ||
--> $DIR/issue-43106-gating-of-derive.rs:10:5 | ||
| | ||
LL | #[derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:26:5 | ||
--> $DIR/issue-43106-gating-of-derive.rs:23:5 | ||
| | ||
LL | #[derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: `derive` may only be applied to structs, enums and unions | ||
--> $DIR/issue-43106-gating-of-derive.rs:30:5 | ||
--> $DIR/issue-43106-gating-of-derive.rs:27:5 | ||
| | ||
LL | #[derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
error: aborting due to 5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions | ||
//~| ERROR cannot determine resolution for the derive macro `Copy` | ||
|
||
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
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
Oops, something went wrong.