change is_subtype to relate_types

This commit is contained in:
ouz-a 2023-09-30 13:44:31 +03:00
parent 8c3406f8bc
commit 646d8d9822
2 changed files with 4 additions and 2 deletions

View File

@ -876,7 +876,7 @@ pub(crate) fn codegen_place<'tcx>(
cplace = cplace.place_deref(fx);
}
PlaceElem::OpaqueCast(ty) => bug!("encountered OpaqueCast({ty}) in codegen"),
PlaceElem::Subtype(ty) => cplace = cplace.place_transmute_type(fx, ty),
PlaceElem::Subtype(ty) => cplace = cplace.place_transmute_type(fx, fx.monomorphize(ty)),
PlaceElem::Field(field, _ty) => {
cplace = cplace.place_field(fx, field);
}

View File

@ -674,12 +674,14 @@ impl<'tcx> CPlace<'tcx> {
}
}
/// Used for `ProjectionElem::Subtype`, ty has to be monomorphized before
/// passed on.
pub(crate) fn place_transmute_type(
self,
fx: &mut FunctionCx<'_, '_, 'tcx>,
ty: Ty<'tcx>,
) -> CPlace<'tcx> {
CPlace { inner: self.inner, layout: fx.layout_of(fx.monomorphize(ty)) }
CPlace { inner: self.inner, layout: fx.layout_of(ty) }
}
pub(crate) fn place_field(