Skip to content

Trait upcasting coercion (part2) - #87515

Merged
bors merged 5 commits into
rust-lang:masterfrom
crlf0710:trait_upcasting_part2
Aug 3, 2021
Merged

Trait upcasting coercion (part2)#87515
bors merged 5 commits into
rust-lang:masterfrom
crlf0710:trait_upcasting_part2

Conversation

@crlf0710

Copy link
Copy Markdown
Member

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

@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occured to rustc_codegen_cranelift

cc @bjorn3

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2021
@crlf0710crlf0710 added S-blocked Status: Blocked on something else such as an RFC or other implementation work. F-trait_upcasting `#![feature(trait_upcasting)]` and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2021
@crlf0710crlf0710 changed the title Trait upcasting coercion part2Trait upcasting coercion (part2)Jul 27, 2021
@rust-log-analyzer

This comment has been minimized.

@crlf0710
crlf0710force-pushed the trait_upcasting_part2 branch from 522611b to cf6db18CompareJuly 27, 2021 15:29
Comment threadcompiler/rustc_codegen_cranelift/src/unsize.rs Outdated
Comment threadcompiler/rustc_codegen_cranelift/src/unsize.rs Outdated
Comment threadcompiler/rustc_codegen_cranelift/src/unsize.rs Outdated
Comment threadcompiler/rustc_codegen_cranelift/src/unsize.rs Outdated
Comment threadcompiler/rustc_codegen_ssa/src/base.rs Outdated
Comment threadcompiler/rustc_mir/src/interpret/cast.rs Outdated
Comment threadcompiler/rustc_mir/src/interpret/cast.rs Outdated
@bors

bors commented Jul 27, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #83484) made this pull request unmergeable. Please resolve the merge conflicts.

@crlf0710

Copy link
Copy Markdown
MemberAuthor

#86264 has landed, now this is unblocked. I'll address the review comments very soon, and add more tests.

@crlf0710crlf0710 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jul 31, 2021
@crlf0710
crlf0710force-pushed the trait_upcasting_part2 branch from cf6db18 to aaba84eCompareJuly 31, 2021 15:20
@crlf0710crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2021
@crlf0710
crlf0710 requested review from RalfJung and bjorn3July 31, 2021 15:26
@crlf0710

Copy link
Copy Markdown
MemberAuthor

Rebased, addressed the review comments and pull in some tests and document from previous work. This is ready for review again now.

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
MemberAuthor

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.

Comment threadcompiler/rustc_codegen_cranelift/src/unsize.rs Outdated
Comment threadcompiler/rustc_codegen_ssa/src/base.rs Outdated
@crlf0710
crlf0710force-pushed the trait_upcasting_part2 branch from aaba84e to 4e22b21CompareAugust 1, 2021 09:35
@crlf0710

Copy link
Copy Markdown
MemberAuthor

Thanks for the comments! Updated.

Comment threadcompiler/rustc_codegen_ssa/src/base.rs Outdated

@bjorn3bjorn3 left a comment

Copy link
Copy Markdown
Member

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?

@crlf0710
crlf0710force-pushed the trait_upcasting_part2 branch from 2e69d6c to f99a37eCompareAugust 2, 2021 15:15
@crlf0710

Copy link
Copy Markdown
MemberAuthor

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.

@crlf0710
crlf0710 requested a review from RalfJungAugust 2, 2021 15:33
@RalfJung

Copy link
Copy Markdown
Member

👍 for the Miri engine changes.

@bjorn3bjorn3 left a comment

Copy link
Copy Markdown
Member

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.

Comment threadcompiler/rustc_codegen_ssa/src/base.rs Outdated
@crlf0710
crlf0710force-pushed the trait_upcasting_part2 branch from f99a37e to 3cb625eCompareAugust 2, 2021 17:14
@crlf0710

Copy link
Copy Markdown
MemberAuthor

@bjorn3 Updated with the comment above addressed!

@bjorn3

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Aug 2, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 3cb625e has been approved by bjorn3

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 2, 2021
@bors

bors commented Aug 3, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 3cb625e with merge c6bc102...

@bors

bors commented Aug 3, 2021

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing c6bc102 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Aug 3, 2021
@bors
bors merged commit c6bc102 into rust-lang:masterAug 3, 2021
@rustbotrustbot added this to the 1.56.0 milestone Aug 3, 2021
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Aug 6, 2021
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`
@bjorn3bjorn3 mentioned this pull request Aug 6, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 6, 2021
…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
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request Jan 27, 2026
Sync rustc_codegen_cranelift
05677b6 removes two assertions that should have been removed in rust-lang/rust#87515. They are no longer correct and trigger while compiling the sysroot.
r? `@ghost`
`@rustbot` label +A-codegen +A-cranelift +T-compiler
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request Jan 27, 2026
Sync rustc_codegen_cranelift
05677b6 removes two assertions that should have been removed in rust-lang/rust#87515. They are no longer correct and trigger while compiling the sysroot.
r? `@ghost`
`@rustbot` label +A-codegen +A-cranelift +T-compiler
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-trait_upcasting`#![feature(trait_upcasting)]`merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@crlf0710@rust-highfive@rust-log-analyzer@bors@RalfJung@bjorn3@rustbot@alexreg