]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726
authorMatthias Krüger <matthias.krueger@famsik.de>
Mon, 10 Jan 2022 10:03:03 +0000 (11:03 +0100)
committerGitHub <noreply@github.com>
Mon, 10 Jan 2022 10:03:03 +0000 (11:03 +0100)
commit6466f89fc5df36b4c841fca9d10e27c50dd744b5
tree6fa30bed1d995e5eb4f781a78393eee688e1e5ad
parentd63a8d965e76f29a2b65c1f22a32613df1fe5c2c
parent5a1c460898e9e0559542f33e5ac4f690e054cd17
Rollup merge of #92248 - compiler-errors:normalize-type-for-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 #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](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 #91446
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_trait_selection/src/traits/project.rs