Fix data layout of reference to nested unsized structs

This commit is contained in:
hkalbasi 2023-06-29 23:38:13 +03:30
parent f53f9230f0
commit 302bb3c871
3 changed files with 53 additions and 1 deletions

View file

@ -315,7 +315,10 @@ fn struct_tail_erasing_lifetimes(db: &dyn HirDatabase, pointee: Ty) -> Ty {
let data = db.struct_data(*i);
let mut it = data.variant_data.fields().iter().rev();
match it.next() {
Some((f, _)) => field_ty(db, (*i).into(), f, subst),
Some((f, _)) => {
let last_field_ty = field_ty(db, (*i).into(), f, subst);
struct_tail_erasing_lifetimes(db, last_field_ty)
}
None => pointee,
}
}