File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -459,14 +459,13 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
459
459
operand : & Operand < ' tcx > ,
460
460
) -> Option < ConstValue < ' tcx > > {
461
461
match operand {
462
- Operand :: Constant ( const_) => match const_. literal {
463
- ConstantKind :: Ty ( const_) => fx
464
- . monomorphize ( const_)
465
- . eval_for_mir ( fx. tcx , ParamEnv :: reveal_all ( ) )
466
- . try_to_value ( fx. tcx ) ,
462
+ Operand :: Constant ( const_) => match fx. monomorphize ( const_. literal ) {
463
+ ConstantKind :: Ty ( const_) => Some (
464
+ const_. eval_for_mir ( fx. tcx , ParamEnv :: reveal_all ( ) ) . try_to_value ( fx. tcx ) . unwrap ( ) ,
465
+ ) ,
467
466
ConstantKind :: Val ( val, _) => Some ( val) ,
468
467
ConstantKind :: Unevaluated ( uv, _) => {
469
- fx. tcx . const_eval_resolve ( ParamEnv :: reveal_all ( ) , uv, None ) . ok ( )
468
+ Some ( fx. tcx . const_eval_resolve ( ParamEnv :: reveal_all ( ) , uv, None ) . unwrap ( ) )
470
469
}
471
470
} ,
472
471
// FIXME(rust-lang/rust#85105): Casts like `IMM8 as u32` result in the const being stored
You can’t perform that action at this time.
0 commit comments