@@ -684,34 +684,6 @@ impl<'tcx> Visitor<'tcx> for OperandCollector<'tcx, '_, '_, '_> {
684684
685685struct DummyMachine ;
686686
687- /// Macro for machine-specific `InterpError` without allocation.
688- /// (These will never be shown to the user, but they help diagnose ICEs.)
689- macro_rules! throw_machine_stop_str {
690- ( $( $tt: tt) * ) => { {
691- // We make a new local type for it. The type itself does not carry any information,
692- // but its vtable (for the `MachineStopType` trait) does.
693- #[ derive( Debug ) ]
694- struct Zst ;
695- // Printing this type shows the desired string.
696- impl std:: fmt:: Display for Zst {
697- fn fmt( & self , f: & mut std:: fmt:: Formatter <' _>) -> std:: fmt:: Result {
698- write!( f, $( $tt) * )
699- }
700- }
701- impl rustc_middle:: mir:: interpret:: MachineStopType for Zst {
702- fn diagnostic_message( & self ) -> rustc_errors:: DiagnosticMessage {
703- self . to_string( ) . into( )
704- }
705-
706- fn add_args(
707- self : Box <Self >,
708- _: & mut dyn FnMut ( std:: borrow:: Cow <' static , str >, rustc_errors:: DiagnosticArgValue <' static >) ,
709- ) { }
710- }
711- throw_machine_stop!( Zst )
712- } } ;
713- }
714-
715687impl < ' mir , ' tcx : ' mir > rustc_const_eval:: interpret:: Machine < ' mir , ' tcx > for DummyMachine {
716688 rustc_const_eval:: interpret:: compile_time_machine!( <' mir, ' tcx>) ;
717689 type MemoryKind = !;
@@ -750,13 +722,13 @@ impl<'mir, 'tcx: 'mir> rustc_const_eval::interpret::Machine<'mir, 'tcx> for Dumm
750722 is_write : bool ,
751723 ) -> InterpResult < ' tcx > {
752724 if is_write {
753- throw_machine_stop_str ! ( "can't write to global" ) ;
725+ crate :: const_prop :: throw_machine_stop_str!( "can't write to global" ) ;
754726 }
755727
756728 // If the static allocation is mutable, then we can't const prop it as its content
757729 // might be different at runtime.
758730 if alloc. inner ( ) . mutability . is_mut ( ) {
759- throw_machine_stop_str ! ( "can't access mutable globals in ConstProp" ) ;
731+ crate :: const_prop :: throw_machine_stop_str!( "can't access mutable globals in ConstProp" ) ;
760732 }
761733
762734 Ok ( ( ) )
0 commit comments