Skip to content

Commit d6c1bb5

Browse files
committed
Do not assert in op_to_const.
1 parent 31bc7e2 commit d6c1bb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ pub(super) fn op_to_const<'tcx>(
132132
// functionality.)
133133
_ => false,
134134
};
135-
let immediate = if force_as_immediate {
136-
Right(ecx.read_immediate(op).expect("normalization works on validated constants"))
135+
let immediate = if force_as_immediate && let Ok(imm) = ecx.read_immediate(op) {
136+
Right(imm)
137137
} else {
138138
op.as_mplace_or_imm()
139139
};

0 commit comments

Comments
 (0)