@@ -684,34 +684,6 @@ impl<'tcx> Visitor<'tcx> for OperandCollector<'tcx, '_, '_, '_> {
684
684
685
685
struct DummyMachine ;
686
686
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
-
715
687
impl < ' mir , ' tcx : ' mir > rustc_const_eval:: interpret:: Machine < ' mir , ' tcx > for DummyMachine {
716
688
rustc_const_eval:: interpret:: compile_time_machine!( <' mir, ' tcx>) ;
717
689
type MemoryKind = !;
@@ -750,13 +722,13 @@ impl<'mir, 'tcx: 'mir> rustc_const_eval::interpret::Machine<'mir, 'tcx> for Dumm
750
722
is_write : bool ,
751
723
) -> InterpResult < ' tcx > {
752
724
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" ) ;
754
726
}
755
727
756
728
// If the static allocation is mutable, then we can't const prop it as its content
757
729
// might be different at runtime.
758
730
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" ) ;
760
732
}
761
733
762
734
Ok ( ( ) )
0 commit comments