-
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
Trait upcasting coercion (part2) #87515
Conversation
Some changes occured to rustc_codegen_cranelift cc @bjorn3 Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
522611b
to
cf6db18
Compare
☔ The latest upstream changes (presumably #83484) made this pull request unmergeable. Please resolve the merge conflicts. |
#86264 has landed, now this is unblocked. I'll address the review comments very soon, and add more tests. |
cf6db18
to
aaba84e
Compare
Rebased, addressed the review comments and pull in some tests and document from previous work. This is ready for review again now. |
.expect("unsized_info: missing principal trait for trait upcasting coercion"); | ||
let principal_b = data_b | ||
.principal() | ||
.expect("unsized_info: missing principal trait for trait upcasting coercion"); |
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.
Isn't the principal non-existent when the trait object only consists of traits like Send
, Sync
or Sized
?
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.
Yes, if the principal is non-existent, either it's not upcasting coercion, like &dyn Send+Sync
to &dyn Send
will be a simple case (and will take the early return code path), or it will be rejected by type-checking, like dyn Foo + Send
to dyn Send
will be rejected.
I added some comments within the code to clarify.
aaba84e
to
4e22b21
Compare
Thanks for the comments! Updated. |
@RalfJung Thanks for the review! I've addressed the comments. |
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.
The codegen part LGTM apart from a minor nit. I will leave @RalfJung to approve the miri part. I don't see any obvious problems with the trait selection code, but given that I am not familiar with it, maybe @nikomatsakis want to take a look?
2e69d6c
to
f99a37e
Compare
Updated and addressed the comments. For the trait selection related stuff, I think niko has been and will be on vacation in the next two weeks. if it's possible i'd prefer more detailed review of this part be defered a little, and we'll revisit it after this FIXME is solved. |
👍 for the Miri engine changes. |
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.
For the trait selection related stuff, I think niko has been and will be on vacation in the next two weeks. if it's possible i'd prefer more detailed review of this part be defered a little, and we'll revisit it after this FIXME is solved.
Sure. r=me with the nit resolved.
f99a37e
to
3cb625e
Compare
@bjorn3 Updated with the comment above addressed! |
@bors r+ |
📌 Commit 3cb625e has been approved by |
☀️ Test successful - checks-actions |
Trait upcasting coercion (part2) This is the second part of trait upcasting coercion implementation. Currently this is blocked on rust-lang#86264 . The third part might be implemented using unsafety checking r? `@bjorn3`
…jorn3 Sync rustc_codegen_cranelift 05677b6 removes two assertions that should have been removed in rust-lang#87515. They are no longer correct and trigger while compiling the sysroot. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
This is the second part of trait upcasting coercion implementation.
Currently this is blocked on #86264 .
The third part might be implemented using unsafety checking
r? @bjorn3