Skip to content
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

Don't allow CoerceUnsized into dyn* (except for trait upcasting) #103386

Merged
merged 3 commits into from
Nov 18, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Oct 22, 2022

This makes sure we don't accidentally allow coercions like Box<T> -> Box<dyn* Trait>, or in the case of this ICE, &T to &dyn* Trait. These coercions don't make sense, at least not via the CoerceUnsized trait.

Fixes #102172
Fixes #102429

@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 22, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 22, 2022
@compiler-errors
Copy link
Member Author

r? @eholk

@rust-highfive rust-highfive assigned eholk and unassigned nagisa Oct 22, 2022
@compiler-errors
Copy link
Member Author

Gotta check if #102429 is fixed by this PR too, I bet so though.

@crlf0710 crlf0710 added the F-dyn_star `#![feature(dyn_star)]` label Oct 22, 2022
@compiler-errors compiler-errors changed the title Don't allow implement CoerceUnsized into dyn* Don't allow CoerceUnsized into dyn* (except for trait upcasting) Nov 11, 2022
@eholk
Copy link
Contributor

eholk commented Nov 18, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Nov 18, 2022

📌 Commit 4f978db has been approved by eholk

It is now in the queue for this repository.

@bors bors 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 Nov 18, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1)
 - rust-lang#103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting))
 - rust-lang#103405 (Detect incorrect chaining of if and if let conditions and recover)
 - rust-lang#103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets)
 - rust-lang#104006 (Add variant_name function to `LangItem`)
 - rust-lang#104494 (Migrate GUI test to use functions)
 - rust-lang#104516 (rustdoc: clean up sidebar width CSS)
 - rust-lang#104550 (fix a typo)

Failed merges:

 - rust-lang#104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 741f3cf into rust-lang:master Nov 18, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 18, 2022
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 21, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1)
 - rust-lang#103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting))
 - rust-lang#103405 (Detect incorrect chaining of if and if let conditions and recover)
 - rust-lang#103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets)
 - rust-lang#104006 (Add variant_name function to `LangItem`)
 - rust-lang#104494 (Migrate GUI test to use functions)
 - rust-lang#104516 (rustdoc: clean up sidebar width CSS)
 - rust-lang#104550 (fix a typo)

Failed merges:

 - rust-lang#104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)

r? `@ghost`
`@rustbot` modify labels: rollup
@compiler-errors compiler-errors deleted the no-coerceunsized-to-dynstar branch August 11, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-dyn_star `#![feature(dyn_star)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE involving references to dyn* &dyn* causes an ICE
7 participants