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

Normalize struct tail type when checking Pointee trait #92248

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Dec 24, 2021

Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on <Ty as Pointee>::Metadata later.
Fixes #92128
Fixes #92577

Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing <_ as Pointee>::Metadata to be properly replaced with an infer variable (here) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types.

Fixes #91446

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

r? @michaelwoerister

(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 Dec 24, 2021
@compiler-errors
Copy link
Member Author

cc: @SimonSapin, who implemented the code that is modified here.

@michaelwoerister
Copy link
Member

Thanks for the PR, @compiler-errors!

I don't really know the code involved here.

r? rust-lang/compiler

@Aaron1011
Copy link
Member

cc @jackh726

@jackh726
Copy link
Member

jackh726 commented Jan 6, 2022

LGTM. Do you think we should add the test from #92577, or do you think the current test covers it?

@Aaron1011
Copy link
Member

It looks like they're pretty much the same, so I think this is fine as is.

@jackh726
Copy link
Member

jackh726 commented Jan 6, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jan 6, 2022

📌 Commit 5a1c460 has been approved by jackh726

@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 Jan 6, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 6, 2022
…pointee, r=jackh726

Normalize struct tail type when checking Pointee trait

Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later.
Fixes rust-lang#92128

Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types.

Fixes rust-lang#91446
Fixes rust-lang#92248
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 9, 2022
…pointee, r=jackh726

Normalize struct tail type when checking Pointee trait

Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later.
Fixes rust-lang#92128
Fixes rust-lang#92577

Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types.

Fixes rust-lang#91446
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#92248 (Normalize struct tail type when checking Pointee trait)
 - rust-lang#92357 (Fix invalid removal of newlines from doc comments)
 - rust-lang#92602 (Make source links look cleaner)
 - rust-lang#92636 (Normalize generator-local types with unevaluated constants)
 - rust-lang#92693 (Release notes: add `Result::unwrap_{,err_}unchecked`)
 - rust-lang#92702 (Clean up lang_items::extract)
 - rust-lang#92717 (update miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6466f89 into rust-lang:master Jan 10, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 10, 2022
@compiler-errors compiler-errors deleted the normalize-type-for-pointee branch April 7, 2022 04:37
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
8 participants