Skip to content

prevent opaque types from appearing in impl headers - #95973

Merged
bors merged 6 commits into
rust-lang:masterfrom
oli-obk:tait_ub3
Apr 13, 2022
Merged

prevent opaque types from appearing in impl headers#95973
bors merged 6 commits into
rust-lang:masterfrom
oli-obk:tait_ub3

Conversation

@oli-obk

Copy link
Copy Markdown
Contributor

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

@rustbotrustbot 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
Copy Markdown
Contributor

r? @compiler-errors

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2022
Comment threadsrc/test/ui/type-alias-impl-trait/issue-84660-unsoundness.rs Outdated

@compiler-errorscompiler-errors left a comment

Copy link
Copy Markdown
Contributor

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)

Comment threadcompiler/rustc_typeck/src/coherence/orphan.rs Outdated
Co-authored-by: Michael Goulet <michael@errs.io>
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

@bors r=compiler-errors

@bors

bors commented Apr 12, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 6d0349d has been approved by compiler-errors

@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 Apr 12, 2022
@Dylan-DPCDylan-DPC mentioned this pull request 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:masterApr 13, 2022
@rustbotrustbot added this to the 1.62.0 milestone Apr 13, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

6 participants

@oli-obk@rust-highfive@bors@lqd@compiler-errors@rustbot