@@ -269,9 +269,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
269269 ) ;
270270 throw_inval ! ( AlreadyReported ( guar) ) ;
271271 } else {
272+ // `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
273+ // so this should be unreachable.
272274 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" ) ;
275276 }
276277 }
277278 _ => Ok ( ecx. tcx . instance_mir ( instance) ) ,
@@ -339,11 +340,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
339340
340341 // CTFE-specific intrinsics.
341342 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" ) ;
347344 } ;
348345 match intrinsic_name {
349346 sym:: ptr_guaranteed_eq | sym:: ptr_guaranteed_ne => {
@@ -400,11 +397,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
400397 }
401398 }
402399 _ => {
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+ ) ;
408403 }
409404 }
410405
@@ -447,7 +442,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
447442 _left : & ImmTy < ' tcx > ,
448443 _right : & ImmTy < ' tcx > ,
449444 ) -> 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" ) ;
451446 }
452447
453448 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,
469464 _ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
470465 _ptr : Pointer < AllocId > ,
471466 ) -> 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" )
473469 }
474470
475471 #[ inline( always) ]
0 commit comments