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

prevent opaque types from appearing in impl headers #95973

Merged
merged 6 commits into from
Apr 13, 2022

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Apr 12, 2022

cc @lqd

opaque types are not distinguishable from their hidden type at the codegen stage. So we could either end up with cases where the hidden type doesn't implement the trait (which will thus ICE) or where the hidden type does implement the trait (so we'd be using its impl instead of the one written for the opaque type). This can even lead to unsound behaviour without unsafe code.

Fixes #86411.
Fixes #84660.

rebase of #87382 plus some diagnostic tweaks

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 12, 2022
@rust-highfive
Copy link
Collaborator

r? @compiler-errors

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2022
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with mine and lqd's typo nits fixed, or not (they're insignificant anyways)

compiler/rustc_typeck/src/coherence/orphan.rs Outdated Show resolved Hide resolved
Co-authored-by: Michael Goulet <michael@errs.io>
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 12, 2022

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Apr 12, 2022

📌 Commit 6d0349d has been approved by compiler-errors

@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 Apr 12, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#95316 (Rustdoc: Discriminate required and provided associated constants and types)
 - rust-lang#95405 (Move name resolution logic to a dedicated file)
 - rust-lang#95914 (Implement tuples using recursion)
 - rust-lang#95918 (Delay a bug when we see SelfCtor in ref pattern)
 - rust-lang#95970 (Fix suggestions in case of `T:` bounds)
 - rust-lang#95973 (prevent opaque types from appearing in impl headers)
 - rust-lang#95986 (Autolabel library PRs with T-libs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e96304b into rust-lang:master Apr 13, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
6 participants