diff options
| author | ouz-a <ouz.agz@gmail.com> | 2023-09-30 13:44:31 +0300 |
|---|---|---|
| committer | ouz-a <ouz.agz@gmail.com> | 2023-10-02 23:39:45 +0300 |
| commit | 646d8d982264b91bd1b434b30b25845f21508c48 (patch) | |
| tree | cce2171aafe5e946822bd2e7bf2e499fc8d37459 | |
| parent | 8c3406f8bc3c20cb38c44514f1017c25ee566cd5 (diff) | |
| download | rust-646d8d982264b91bd1b434b30b25845f21508c48.tar.gz rust-646d8d982264b91bd1b434b30b25845f21508c48.zip | |
change is_subtype to relate_types
| -rw-r--r-- | src/base.rs | 2 | ||||
| -rw-r--r-- | src/value_and_place.rs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/base.rs b/src/base.rs index a13d3a0e115..0a451dad9d2 100644 --- a/src/base.rs +++ b/src/base.rs @@ -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); } diff --git a/src/value_and_place.rs b/src/value_and_place.rs index 34cde0a0e78..09033cfb23f 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -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( |
