diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-31 11:31:08 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-11-01 16:49:18 +0000 |
| commit | c2f49e9edf2bae4eaede9af13f5dfb80aacb04d1 (patch) | |
| tree | d039fb4f2941d8e90f7302c93509c81b7b3651e5 /compiler/rustc_const_eval/src | |
| parent | 146dafa26277c873172f555017b970ef006d302a (diff) | |
| download | rust-c2f49e9edf2bae4eaede9af13f5dfb80aacb04d1.tar.gz rust-c2f49e9edf2bae4eaede9af13f5dfb80aacb04d1.zip | |
Do not assert in op_to_const.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 669838308a5..cc8b10bd07d 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -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() }; |
