1
Fork 0

Do not assert in op_to_const.

This commit is contained in:
Camille GILLOT 2023-10-31 11:31:08 +00:00
parent 146dafa262
commit c2f49e9edf
2 changed files with 13 additions and 2 deletions

View file

@ -132,8 +132,8 @@ pub(super) fn op_to_const<'tcx>(
// functionality.)
_ => false,
};
let immediate = if force_as_immediate {
Right(ecx.read_immediate(op).expect("normalization works on validated constants"))
let immediate = if force_as_immediate && let Ok(imm) = ecx.read_immediate(op) {
Right(imm)
} else {
op.as_mplace_or_imm()
};