1
Fork 0

Rollup merge of #128712 - compiler-errors:normalize-borrowck, r=lcnr

Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver

Realized that the new solver didn't handle ptr-to-ptr casting correctly.

r? lcnr

Built on #128694
This commit is contained in:
Matthias Krüger 2024-08-12 23:10:50 +02:00 committed by GitHub
commit 4c49418472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 95 additions and 38 deletions

View file

@ -219,9 +219,13 @@ fn layout_of_uncached<'tcx>(
// its struct tail cannot be normalized either, so try to get a
// more descriptive layout error here, which will lead to less confusing
// diagnostics.
//
// We use the raw struct tail function here to get the first tail
// that is an alias, which is likely the cause of the normalization
// error.
match tcx.try_normalize_erasing_regions(
param_env,
tcx.struct_tail_without_normalization(pointee),
tcx.struct_tail_raw(pointee, |ty| ty, || {}),
) {
Ok(_) => {}
Err(better_err) => {