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

Fix an opaque type ICE #105897

Merged
merged 5 commits into from
Dec 21, 2022
Merged

Fix an opaque type ICE #105897

merged 5 commits into from
Dec 21, 2022

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 19, 2022

fixes #104551

The issue is that if you have

type T = impl Sized;
let (_a, _b): T = ..

we have only the type annotation T, but want to use that ascription for _a and _b, so what we generate is a type ascription plus a field projection saying _a's type is T::0. Of course T has no fields. Of course we could also not generate type annotations for projections into opaque types at all, but that's more fragile, as we now have to make sure that https://github.com/rust-lang/rust/blob/12bbdbdb440119a0b86d2ee742ec1460cdb2c5b9/compiler/rustc_mir_build/src/build/matches/mod.rs#L709 doesn't have any arm that introduces a user type annotation except for PatKind::Binding.

@rustbot
Copy link
Collaborator

rustbot commented Dec 19, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 19, 2022
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 20, 2022

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

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Dec 20, 2022

r=me after conflicts are addressed.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 20, 2022

@bors r=TaKO8Ki

@bors
Copy link
Contributor

bors commented Dec 20, 2022

📌 Commit c9588d5 has been approved by TaKO8Ki

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 Dec 20, 2022
fee1-dead added a commit to fee1-dead-contrib/rust that referenced this pull request Dec 21, 2022
Fix an opaque type ICE

fixes rust-lang#104551

The issue is that if you have

```rust
type T = impl Sized;
let (_a, _b): T = ..
```

we have only the type annotation `T`, but want to use that ascription for `_a` and `_b`, so what we generate is a type ascription plus a field projection saying `_a`'s type is `T::0`. Of course `T` has no fields. Of course we could also not generate type annotations for projections into opaque types at all, but that's more fragile, as we now have to make sure that https://github.com/rust-lang/rust/blob/12bbdbdb440119a0b86d2ee742ec1460cdb2c5b9/compiler/rustc_mir_build/src/build/matches/mod.rs#L709 doesn't have any arm that introduces a user type annotation except for `PatKind::Binding`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#105791 (docs: add long error explanation for error E0472)
 - rust-lang#105897 (Fix an opaque type ICE)
 - rust-lang#105904 (Fix arch flag on i686-apple-darwin)
 - rust-lang#105949 (Bump `cfg-if` to `1.0` in rustc crates)
 - rust-lang#105964 (rustdoc: prevent CSS layout of line numbers shrinking into nothing)
 - rust-lang#105972 (rustdoc: simplify section anchor CSS)
 - rust-lang#105973 (Avoid going through the happy path in case of non-fn builtin calls)
 - rust-lang#105976 (Remove unused `check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-linux-gnu` make rule)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a4ef47d into rust-lang:master Dec 21, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 21, 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
Development

Successfully merging this pull request may close these issues.

TAIT ICE "extracting field of non-tuple non-adt"
6 participants