-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fix an opaque type ICE #105897
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This comment has been minimized.
This comment has been minimized.
810af15
to
03b9ed6
Compare
☔ The latest upstream changes (presumably #105905) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me after conflicts are addressed. |
a28a1da
to
c9588d5
Compare
@bors r=TaKO8Ki |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #104551
The issue is that if you have
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 isT::0
. Of courseT
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 forPatKind::Binding
.