-
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
Fold E0612, E0613 into E0609 #42996
Fold E0612, E0613 into E0609 #42996
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (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. |
My apologies, I forgot to run the full test suite and apparently missed something. |
All tests pass now on my end |
Thanks for the pull request! We'll get @pnkfelix or someone else from the compiler team to review this soon. cc @GuillaumeGomez -- perhaps you'd like to take a look since I believe you created some of these in the first place? |
src/librustc_typeck/check/mod.rs
Outdated
@@ -3057,20 +3057,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { | |||
return field_ty; | |||
} | |||
|
|||
if tuple_like { | |||
type_error_struct!(self.tcx().sess, expr.span, expr_t, E0612, |
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 feel like this error is a bit different than the others. Not sure if this is a good idea to merge it as well... To be more precise: the others refer to non-existing fields whereas this one is about accessing a out-of-bound value (so it kind of exist).
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 really think we should keep E0612 on its own and not merge it with others.
src/librustc_typeck/check/mod.rs
Outdated
self.tcx().types.err | ||
} | ||
|
||
fn no_such_field_err<T: Display>(&self, span: Span, field: T, expr_t: &ty::TyS) | ||
-> DiagnosticBuilder { | ||
|
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.
Extra empty line.
src/librustc_typeck/diagnostics.rs
Outdated
println!("x: {} y: {}", s.x, s.y); | ||
``` | ||
"##, | ||
// E0612: Removed (merged with E0609) |
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.
Please put them into the error code list at the bottom.
@@ -12,5 +12,5 @@ const TUP: (usize,) = (42,); | |||
|
|||
fn main() { | |||
let a: [isize; TUP.1]; | |||
//~^ ERROR attempted out-of-bounds tuple index | |||
//~^ ERROR no field `1` on type `(usize,)` |
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 error is clearly less good from my point of view. Before it was very clear but now, seems more confusing.
@GuillaumeGomez Alright, reverted the changes to E0612 |
Thanks! Please squash your commits and then it's good for me. |
994ef30
to
d7ebc61
Compare
ping @GuillaumeGomez, looks like this has been updated and is ready for a re-review? |
The review was done, I was waiting for the squash. Since it's done, we can r+. Thanks @Boreeas! @bors: r+ |
📌 Commit d7ebc61 has been approved by |
No problem! My apologies for not sending a notice that I squashed |
🔒 Merge conflict |
Resolves rust-lang#42945
d7ebc61
to
c215d08
Compare
Rebased the PR |
Then here we go again! @bors: r+ |
📌 Commit c215d08 has been approved by |
☀️ Test successful - status-appveyor, status-travis |
As discussed in #42945, with PR 1506 tuple indices are no longer considered a separate case from normal field. This PR folds E06012 ("tuple index out of bounds") and E0613 ("type is not a tuple") into E0609 ("type does not have field with that name")
Resolves #42945