Skip to content

Commit

Permalink
Do not assert in op_to_const.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Oct 31, 2023
1 parent 31bc7e2 commit d6c1bb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down

0 comments on commit d6c1bb5

Please sign in to comment.