-
Notifications
You must be signed in to change notification settings - Fork 13k
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
incorrect visitor use #91441
Closed
Closed
incorrect visitor use #91441
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
@@ -1,9 +1,63 @@ | ||
error[E0616]: field `i` of struct `S` is private | ||
--> $DIR/nested_macro_privacy.rs:15:18 | ||
error[E0412]: cannot find type `S` in this scope | ||
--> $DIR/nested_macro_privacy.rs:5:18 | ||
| | ||
LL | #[derive(Default)] | ||
| ^^^^^^^ not found in this scope | ||
... | ||
LL | n!(foo, S, i, m); | ||
| ---------------- in this macro invocation | ||
| | ||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0412]: cannot find type `S` in this scope | ||
--> $DIR/nested_macro_privacy.rs:5:18 | ||
| | ||
LL | #[derive(Default)] | ||
| ^^^^^^^ not found in this scope | ||
... | ||
LL | n!(foo, S, i, m); | ||
| ---------------- in this macro invocation | ||
| | ||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0422]: cannot find struct, variant or union type `S` in this scope | ||
--> $DIR/nested_macro_privacy.rs:5:18 | ||
| | ||
LL | #[derive(Default)] | ||
| ^^^^^^^ not found in this scope | ||
... | ||
LL | n!(foo, S, i, m); | ||
| ---------------- in this macro invocation | ||
| | ||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0599]: no function or associated item named `default` found for struct `S` in the current scope | ||
--> $DIR/nested_macro_privacy.rs:15:8 | ||
| | ||
LL | pub struct $S { $i: u32 } | ||
| ------------- function or associated item `default` not found for this | ||
... | ||
LL | S::default().i; | ||
| ^ private field | ||
| ^^^^^^^ function or associated item not found in `S` | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
= note: the following trait defines an item `default`, perhaps you need to implement it: | ||
candidate #1: `Default` | ||
|
||
error[E0599]: no function or associated item named `default` found for struct `S` in the current scope | ||
--> $DIR/nested_macro_privacy.rs:16:11 | ||
| | ||
LL | pub struct $S { $i: u32 } | ||
| ------------- function or associated item `default` not found for this | ||
... | ||
LL | m!(S::default()); // ok | ||
| ^^^^^^^ function or associated item not found in `S` | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
= note: the following trait defines an item `default`, perhaps you need to implement it: | ||
candidate #1: `Default` | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0616`. | ||
Some errors have detailed explanations: E0412, E0422, E0599. | ||
For more information about an error, try `rustc --explain E0412`. |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what I was talking about in #90519, all the marks are already added in the
TraitDef::span
span (self.span
infn create_derived_impl
).This visitor only needs to replace the visited span's context with the
TraitDef::span
context while keeping the location.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When doing that I get failures during bootstrap when computing
derive
s, so I assumed I was doing something wrong:With the
apply_mark
approach on the other hand I could get through bootstrap consistently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, of course, some parts of the output should not be visited, after all.
The
Foo
parts, specifically, i.e. references to the type for which we are deriving the impl.