-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Resolve enum field visibility correctly #79956
Conversation
r? @eddyb (rust-highfive has picked a reviewer for you, use r? to override) |
LL | foo::Pub {}; | ||
| ^^^^^^^^ | ||
|
||
error[E0063]: missing field `y` in initializer of `Enum` |
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 should probably print
error[E0063]: missing field `y` in initializer of `Enum::Variant`
but that's unrelated to this change.
(I'm leaving this as a todo for myself.)
383fe5a
to
013c498
Compare
Could you also squashing commits after addressing the comments? |
I believe I have addressed all of your comments now. |
Thanks! |
Previously, this code treated enum fields' visibility as if they were struct fields. However, that's not correct because the visibility of a struct field with `ast::VisibilityKind::Inherited` is private to the module it's defined in, whereas the visibility of an *enum* field with `ast::VisibilityKind::Inherited` is the visibility of the enum it belongs to.
66690dd
to
5ce3f4c
Compare
Squashed! |
@bors r+ |
📌 Commit 5ce3f4c has been approved by |
☀️ Test successful - checks-actions |
Nominating for beta-backport since this error comes up fairly frequently and the unfixed version is very confusing and annoying, and it's likely that it's even more so for newcomers. (The issue this fixed was P-high because of the reasons I listed.) |
rust-lang/rust#79956 improved enum's visibility and now we can check the visibility more precisely.
rust-lang/rust#79956 improved enum's visibility and now we can check the visibility more precisely.
Fixes #79593. 🎉
Previously, this code treated enum fields' visibility as if they were
struct fields. However, that's not correct because the visibility of a
struct field with
ast::VisibilityKind::Inherited
is private to themodule it's defined in, whereas the visibility of an enum field with
ast::VisibilityKind::Inherited
is the visibility of the enum itbelongs to.