Skip to content

Commit 646d8d9

Browse files
committed
change is_subtype to relate_types
1 parent 8c3406f commit 646d8d9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ pub(crate) fn codegen_place<'tcx>(
876876
cplace = cplace.place_deref(fx);
877877
}
878878
PlaceElem::OpaqueCast(ty) => bug!("encountered OpaqueCast({ty}) in codegen"),
879-
PlaceElem::Subtype(ty) => cplace = cplace.place_transmute_type(fx, ty),
879+
PlaceElem::Subtype(ty) => cplace = cplace.place_transmute_type(fx, fx.monomorphize(ty)),
880880
PlaceElem::Field(field, _ty) => {
881881
cplace = cplace.place_field(fx, field);
882882
}

src/value_and_place.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,14 @@ impl<'tcx> CPlace<'tcx> {
674674
}
675675
}
676676

677+
/// Used for `ProjectionElem::Subtype`, ty has to be monomorphized before
678+
/// passed on.
677679
pub(crate) fn place_transmute_type(
678680
self,
679681
fx: &mut FunctionCx<'_, '_, 'tcx>,
680682
ty: Ty<'tcx>,
681683
) -> CPlace<'tcx> {
682-
CPlace { inner: self.inner, layout: fx.layout_of(fx.monomorphize(ty)) }
684+
CPlace { inner: self.inner, layout: fx.layout_of(ty) }
683685
}
684686

685687
pub(crate) fn place_field(

0 commit comments

Comments
 (0)