From 93af5f599922bd14c2156b26b277fa642cbceac5 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 27 Jul 2022 11:58:34 +0000 Subject: [PATCH] Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"" This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561. --- src/base.rs | 1 + src/value_and_place.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/base.rs b/src/base.rs index 399474d79e3..11540d80081 100644 --- a/src/base.rs +++ b/src/base.rs @@ -850,6 +850,7 @@ pub(crate) fn codegen_place<'tcx>( PlaceElem::Deref => { cplace = cplace.place_deref(fx); } + PlaceElem::OpaqueCast(ty) => cplace = cplace.place_opaque_cast(fx, 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 cfaadca9491..3fa3e3657cb 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -621,6 +621,14 @@ fn transmute_value<'tcx>( } } + pub(crate) fn place_opaque_cast( + self, + fx: &mut FunctionCx<'_, '_, 'tcx>, + ty: Ty<'tcx>, + ) -> CPlace<'tcx> { + CPlace { inner: self.inner, layout: fx.layout_of(ty) } + } + pub(crate) fn place_field( self, fx: &mut FunctionCx<'_, '_, 'tcx>,