Skip to content

Normalize struct tail type when checking Pointee trait - #92248

Merged
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:normalize-type-for-pointee
Jan 10, 2022
Merged

Normalize struct tail type when checking Pointee trait#92248
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:normalize-type-for-pointee

Conversation

@compiler-errors

@compiler-errorscompiler-errors commented Dec 24, 2021

Copy link
Copy Markdown
Contributor

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

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

r? @michaelwoerister

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

Copy link
Copy Markdown
ContributorAuthor

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

@michaelwoerister

Copy link
Copy Markdown
Member

Thanks for the PR, @compiler-errors!

I don't really know the code involved here.

r? rust-lang/compiler

@Aaron1011

Copy link
Copy Markdown
Contributor

cc @jackh726

@jackh726

Copy link
Copy Markdown
Member

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

@Aaron1011

Copy link
Copy Markdown
Contributor

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

@jackh726

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 5a1c460 has been approved by jackh726

@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 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.
Fixesrust-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.
Fixesrust-lang#91446Fixesrust-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.
Fixesrust-lang#92128Fixesrust-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.
Fixesrust-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:masterJan 10, 2022
@rustbotrustbot 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 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

8 participants

@compiler-errors@rust-highfive@michaelwoerister@Aaron1011@jackh726@bors@wesleywiser@rustbot