Skip to content

Change E0451 to output proper indices for tuple-struct fields. #31721

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
merged 2 commits into from
Feb 20, 2016

Conversation

rphmeier
Copy link
Contributor

Fixes #31706

Also fixes a phrasing error in the diagnostic.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@Manishearth
Copy link
Member

Huh, this is interesting; pretty ambivalent about this. On one hand I see the dissonance between this and the tuple access syntax, on the other hand English. Hm.

@Manishearth
Copy link
Member

@bors r+ rollup

thought a bit more about this. As long as it isn't saying "zeroeth" and "first" it should be fine.

thanks!

@bors
Copy link
Collaborator

bors commented Feb 18, 2016

📌 Commit 94499e3 has been approved by Manishearth

@@ -710,7 +710,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
NamedField(name) => format!("field `{}` of {} is private",
name, struct_desc),
UnnamedField(idx) => format!("field #{} of {} is private",
Copy link
Member

Choose a reason for hiding this comment

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

This use of # always irks me - is it an american thing? I thought using '#' for 'number' went out of fashion in about 1900. The error message would be just as good without the '#', IMO.

Copy link
Member

Choose a reason for hiding this comment

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

More so when describing the fields as 0-indexed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm inclined to agree about the error message itself -- it would probably look nicer just as "field X of Y is private". I figure that such a change would be better in another PR, but I could add it to this one.

Copy link
Member

Choose a reason for hiding this comment

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

Another PR is fine

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Feb 19, 2016
…anishearth

Fixes rust-lang#31706

Also fixes a phrasing error in the diagnostic.
bors added a commit that referenced this pull request Feb 19, 2016
bors added a commit that referenced this pull request Feb 20, 2016
@bors bors merged commit 94499e3 into rust-lang:master Feb 20, 2016
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.

Nitpicking: visibility errors on a tuple struct count fields from 1 when the language counts them from 0
5 participants