Skip to content

Commit

Permalink
Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Browse files Browse the repository at this point in the history
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: rust-lang/rust#99368 (comment))

TODO:

* check if rust-lang/rust#99685 is avoided
  • Loading branch information
bors committed Sep 20, 2022
2 parents 6214e08 + 93af5f5 commit 6eeefe2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit 6eeefe2

Please sign in to comment.