1
Fork 0

Rollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obk

fix ICE in ConstProp

Fixes https://github.com/rust-lang/rust/issues/96169
This commit is contained in:
Dylan DPC 2022-07-09 11:28:05 +05:30 committed by GitHub
commit a6c6166d7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 12 deletions

View file

@ -78,6 +78,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
}
#[inline]
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
pub fn to_scalar_or_uninit(self) -> ScalarMaybeUninit<Tag> {
match self {
Immediate::Scalar(val) => val,
@ -87,11 +88,13 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
}
#[inline]
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
pub fn to_scalar(self) -> InterpResult<'tcx, Scalar<Tag>> {
self.to_scalar_or_uninit().check_init()
}
#[inline]
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
pub fn to_scalar_or_uninit_pair(self) -> (ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>) {
match self {
Immediate::ScalarPair(val1, val2) => (val1, val2),
@ -101,6 +104,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
}
#[inline]
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
pub fn to_scalar_pair(self) -> InterpResult<'tcx, (Scalar<Tag>, Scalar<Tag>)> {
let (val1, val2) = self.to_scalar_or_uninit_pair();
Ok((val1.check_init()?, val2.check_init()?))