@@ -269,9 +269,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
269
269
) ;
270
270
throw_inval ! ( AlreadyReported ( guar) ) ;
271
271
} else {
272
+ // `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
273
+ // so this should be unreachable.
272
274
let path = ecx. tcx . def_path_str ( def. did ) ;
273
- Err ( ConstEvalErrKind :: NeedsRfc ( format ! ( "calling extern function `{}`" , path) )
274
- . into ( ) )
275
+ bug ! ( "trying to call extern function `{path}` at compile-time" ) ;
275
276
}
276
277
}
277
278
_ => Ok ( ecx. tcx . instance_mir ( instance) ) ,
@@ -339,11 +340,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
339
340
340
341
// CTFE-specific intrinsics.
341
342
let Some ( ret) = target else {
342
- return Err ( ConstEvalErrKind :: NeedsRfc ( format ! (
343
- "calling intrinsic `{}`" ,
344
- intrinsic_name
345
- ) )
346
- . into ( ) ) ;
343
+ throw_unsup_format ! ( "intrinsic `{intrinsic_name}` is not supported at compile-time" ) ;
347
344
} ;
348
345
match intrinsic_name {
349
346
sym:: ptr_guaranteed_eq | sym:: ptr_guaranteed_ne => {
@@ -400,11 +397,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
400
397
}
401
398
}
402
399
_ => {
403
- return Err ( ConstEvalErrKind :: NeedsRfc ( format ! (
404
- "calling intrinsic `{}`" ,
405
- intrinsic_name
406
- ) )
407
- . into ( ) ) ;
400
+ throw_unsup_format ! (
401
+ "intrinsic `{intrinsic_name}` is not supported at compile-time"
402
+ ) ;
408
403
}
409
404
}
410
405
@@ -447,7 +442,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
447
442
_left : & ImmTy < ' tcx > ,
448
443
_right : & ImmTy < ' tcx > ,
449
444
) -> InterpResult < ' tcx , ( Scalar , bool , Ty < ' tcx > ) > {
450
- Err ( ConstEvalErrKind :: NeedsRfc ( "pointer arithmetic or comparison" . to_string ( ) ) . into ( ) )
445
+ throw_unsup_format ! ( "pointer arithmetic or comparison is not supported at compile-time" ) ;
451
446
}
452
447
453
448
fn before_terminator ( ecx : & mut InterpCx < ' mir , ' tcx , Self > ) -> InterpResult < ' tcx > {
@@ -469,7 +464,8 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
469
464
_ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
470
465
_ptr : Pointer < AllocId > ,
471
466
) -> InterpResult < ' tcx > {
472
- Err ( ConstEvalErrKind :: NeedsRfc ( "exposing pointers" . to_string ( ) ) . into ( ) )
467
+ // This is only reachable with -Zunleash-the-miri-inside-of-you.
468
+ throw_unsup_format ! ( "exposing pointers is not possible at compile-time" )
473
469
}
474
470
475
471
#[ inline( always) ]
0 commit comments