Skip to content
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

Point out which struct's field is private #13346

Merged
merged 1 commit into from
Apr 6, 2014

Conversation

ben0x539
Copy link
Contributor

@ben0x539 ben0x539 commented Apr 5, 2014

In the error message for when a private field is used, include the name of the struct, or if it's a struct-like enum variant, the names of the variant and the enum.

This fixes #13341.

@ben0x539 ben0x539 changed the title name struct in "field ... is private" error Point out which struct's field is private Apr 5, 2014
@@ -578,10 +578,42 @@ impl<'a> PrivacyVisitor<'a> {
};
if field.vis == ast::Public { return }
if !is_local(field.id) || !self.private_accessible(field.id.node) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this if statement to if foo { return }?

Just to help reduce the amount of indentation.

@alexcrichton
Copy link
Member

This looks great, nice work!

Just a few small comments and I think this is good to go.

@ben0x539
Copy link
Contributor Author

ben0x539 commented Apr 6, 2014

Thank you for your comments!

How is this?

bors added a commit that referenced this pull request Apr 6, 2014
In the error message for when a private field is used, include the name of the struct, or if it's a struct-like enum variant, the names of the variant and the enum.

This fixes #13341.
@bors bors closed this Apr 6, 2014
@bors bors merged commit d4b73a7 into rust-lang:master Apr 6, 2014
@emberian
Copy link
Member

Awesome, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Point out which type's field is private
4 participants