diff options
| author | bors <bors@rust-lang.org> | 2022-09-20 12:09:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-20 12:09:52 +0000 |
| commit | 6eeefe2ce6c158a8ea877ae68c250478940ae809 (patch) | |
| tree | db17677d2f437113d6fd2b8c2184f2a43acf9799 | |
| parent | 6214e085ed8f6ba33daac69ffb877f296ca8b240 (diff) | |
| parent | 93af5f599922bd14c2156b26b277fa642cbceac5 (diff) | |
| download | rust-6eeefe2ce6c158a8ea877ae68c250478940ae809.tar.gz rust-6eeefe2ce6c158a8ea877ae68c250478940ae809.zip | |
Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Allow patterns to constrain the hidden type of opaque types fixes #96572 reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864) TODO: * check if https://github.com/rust-lang/rust/issues/99685 is avoided
| -rw-r--r-- | src/base.rs | 1 | ||||
| -rw-r--r-- | src/value_and_place.rs | 8 |
2 files changed, 9 insertions, 0 deletions
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 @@ impl<'tcx> CPlace<'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>, |
