-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New error codes #42614
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
New error codes #42614
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_typeck/diagnostics.rs
Outdated
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.
Should be "Attempted to access a private field on a tuple-struct."
src/librustc_typeck/diagnostics.rs
Outdated
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.
Use "make" instead of "set"
src/librustc_typeck/diagnostics.rs
Outdated
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.
Instead "add a getter function to keep the field private but allow for accessing its value:".
src/librustc_typeck/diagnostics.rs
Outdated
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.
I'd suggest using "n" here instead of "x" as "n" is commonly used for referring to integer values.
src/librustc_typeck/diagnostics.rs
Outdated
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.
Instead "If you want to index into an array, use []
instead:"
src/librustc_typeck/diagnostics.rs
Outdated
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.
Too many commas and incorrect conjugation. Instead "However, if you wanted to access a field of a struct check that the field name is spelled correctly."
src/librustc_typeck/diagnostics.rs
Outdated
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.
Instead "Attempted to access a private field on a struct."
src/librustc_typeck/diagnostics.rs
Outdated
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.
Instead: "1) Set the field public:"
I don't like the double-colons on this line.
src/librustc_typeck/diagnostics.rs
Outdated
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.
Instead "2) Add a getter function:"
src/librustc_typeck/check/mod.rs
Outdated
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.
I suggest instead: "attempted to access tuple index {}
on type {}
, but the type is not a tuple or tuple struct"
9c9d0a0
to
8063e12
Compare
@Susurrus: Thanks a lot for this review! Updated. :) |
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.
Travis found some errors
src/librustc_typeck/diagnostics.rs
Outdated
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.
index into a slice
would this be more accurate?
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.
I wanted to include both Vec and slices.
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.
In the context of Rust, when I see the term "array" I often think of fixed-length arrays [T; n]
. But I don't have a better term on hand that covers the cases here, so this is fine with me.
src/librustc_typeck/diagnostics.rs
Outdated
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.
If you want to access a field of a struct, ensure the field's name is spelled correctly
this sounds better to me, but i don't feel strongly
8063e12
to
0a2d5dc
Compare
☔ The latest upstream changes (presumably #42644) made this pull request unmergeable. Please resolve the merge conflicts. |
0a2d5dc
to
ee60064
Compare
Rebased. |
Would it be worth combining E0611 (private field access, tuple struct) and E0616 (private field access, traditional struct)? From the user's perspective, it's the same error, just in different situations. (EDIT: For any infra team members who see this in a week, I believe imperio just left for a 10-day vacation, so updates on this will likely wait until he's come back from that.) |
ping @pnkfelix, I think this is ready for a re-review |
@bors r+ |
📌 Commit ee60064 has been approved by |
New error codes Part of #42229. cc @Susurrus @frewsxcv @QuietMisdreavus
☀️ Test successful - status-appveyor, status-travis |
Part of #42229.
cc @Susurrus @frewsxcv @QuietMisdreavus