@@ -260,7 +260,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
260
260
self . param_env ,
261
261
def_id,
262
262
substs,
263
- ) . ok_or ( EvalErrorKind :: TypeckError . into ( ) ) // turn error prop into a panic to expose associated type in const issue
263
+ ) . ok_or_else ( || EvalErrorKind :: TypeckError . into ( ) ) // turn error prop into a panic to expose associated type in const issue
264
264
}
265
265
266
266
pub ( super ) fn type_is_sized ( & self , ty : Ty < ' tcx > ) -> bool {
@@ -279,9 +279,9 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
279
279
trace ! ( "load mir {:?}" , instance) ;
280
280
match instance {
281
281
ty:: InstanceDef :: Item ( def_id) => {
282
- self . tcx . maybe_optimized_mir ( def_id) . ok_or_else ( || {
282
+ self . tcx . maybe_optimized_mir ( def_id) . ok_or_else ( ||
283
283
EvalErrorKind :: NoMirFor ( self . tcx . item_path_str ( def_id) ) . into ( )
284
- } )
284
+ )
285
285
}
286
286
_ => Ok ( self . tcx . instance_mir ( instance) ) ,
287
287
}
@@ -691,7 +691,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
691
691
self . param_env ,
692
692
def_id,
693
693
substs,
694
- ) . ok_or ( EvalErrorKind :: TypeckError . into ( ) ) ;
694
+ ) . ok_or_else ( || EvalErrorKind :: TypeckError . into ( ) ) ;
695
695
let fn_ptr = self . memory . create_fn_alloc ( instance?) ;
696
696
let valty = ValTy {
697
697
value : Value :: ByVal ( PrimVal :: Ptr ( fn_ptr) ) ,
@@ -1689,7 +1689,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
1689
1689
1690
1690
impl < ' mir , ' tcx > Frame < ' mir , ' tcx > {
1691
1691
pub fn get_local ( & self , local : mir:: Local ) -> EvalResult < ' tcx , Value > {
1692
- self . locals [ local] . ok_or ( EvalErrorKind :: DeadLocal . into ( ) )
1692
+ self . locals [ local] . ok_or_else ( || EvalErrorKind :: DeadLocal . into ( ) )
1693
1693
}
1694
1694
1695
1695
fn set_local ( & mut self , local : mir:: Local , value : Value ) -> EvalResult < ' tcx > {
0 commit comments