-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix associated types in copy implementations #38152
Conversation
} | ||
|
||
fn visit_implementation_of_coerce_unsized<'a, 'tcx>( | ||
tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId, |
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.
nit: maybe separate each arg on its own line?
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 say just rustfmt this new file and be done with it.
curiously, the test will ICE immediately with Stable rustc on play.rust-lang.org, but will timeout with beta and nightly. |
for variant in &adt.variants { | ||
for field in &variant.fields { | ||
if !field_implements_copy(field) { | ||
return Err(CopyImplementationError::InfrigingVariant( |
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.
Pre-existing, but it seems like it would be nice to give both the variant name and the field name -- can we do that instead?
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.
That's a good idea.
} | ||
|
||
fn visit_implementation_of_coerce_unsized<'a, 'tcx>( | ||
tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId, |
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 say just rustfmt this new file and be done with it.
} | ||
let method_def_id = items[0]; | ||
|
||
let self_type = tcx.item_type(impl_did); |
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.
Is this file all code collected from other places, or did you make changes to it? I couldn't tell.
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.
Code moved from coherence::mod
.
How do you rustfmt? |
@arielb1 |
☔ The latest upstream changes (presumably #38099) made this pull request unmergeable. Please resolve the merge conflicts. |
@arielb1 if you don't feel like running rustfmt, no biggy, but let's rebase :) |
d662ceb
to
14efebc
Compare
@bors r+ |
📌 Commit 14efebc has been approved by |
I was just going to rustfmt the new file and add better error reporting. @bors r- |
no functional changes
Bar( | ||
&'a mut bool //~ this field does not implement `Copy` | ||
), | ||
Baz, |
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.
can we make this a ui
test? I'd like to see precisely where the span is, since it's critical to the message
Span the affected fields instead of reporting the field/variant name.
--> $DIR/E0204.rs:27:6 | ||
| | ||
23 | Bar { x: Vec<u32> }, | ||
| ----------- this field does not implement `Copy` |
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.
looks great :)
@bors r+ |
📌 Commit 4cab293 has been approved by |
⌛ Testing commit 4cab293 with merge be89c6b... |
💔 Test failed - status-appveyor |
this makes error messages consistent across architectures
@bors r=nikomatsakis |
📌 Commit 5fad51e has been approved by |
⌛ Testing commit 5fad51e with merge 5e8f802... |
💔 Test failed - status-appveyor |
⌛ Testing commit 5fad51e with merge 4f1a16e... |
💔 Test failed - status-travis |
Network Error:
@bors retry |
⌛ Testing commit 5fad51e with merge 60812a8... |
⌛ Testing commit 5fad51e with merge 7bd015d... |
⌛ Testing commit 5fad51e with merge 2b62184... |
💔 Test failed - status-travis |
⌛ Testing commit 5fad51e with merge 90618ce... |
💔 Test failed - status-travis |
@bors retry |
Fix associated types in copy implementations Fixes an ICE and an error in checking copy implementations. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Fixes an ICE and an error in checking copy implementations.
r? @nikomatsakis