@@ -339,15 +339,15 @@ fn exit(exit_code: i32) -> ! {
339339 std:: process:: exit ( exit_code) ;
340340}
341341
342- fn show_error_ ( msg : & impl std:: fmt:: Display ) -> ! {
342+ fn fatal_error_ ( msg : & impl std:: fmt:: Display ) -> ! {
343343 eprintln ! ( "fatal error: {msg}" ) ;
344344 exit ( 1 )
345345}
346346
347- macro_rules! show_error {
348- ( $( $tt: tt) * ) => { $crate:: show_error_ ( & format_args!( $( $tt) * ) ) } ;
347+ macro_rules! fatal_error {
348+ ( $( $tt: tt) * ) => { $crate:: fatal_error_ ( & format_args!( $( $tt) * ) ) } ;
349349}
350- use show_error ;
350+ use fatal_error ;
351351
352352/// Execute a compiler with the given CLI arguments and callbacks.
353353fn run_compiler_and_exit (
@@ -520,7 +520,7 @@ fn main() {
520520 params. precise_interior_mut = false ;
521521 }
522522 _ =>
523- show_error ! (
523+ fatal_error ! (
524524 "`-Zmiri-tree-borrows` is required before `-Zmiri-tree-borrows-no-precise-interior-mut`"
525525 ) ,
526526 } ;
@@ -547,7 +547,7 @@ fn main() {
547547 "warn-nobacktrace" =>
548548 miri:: IsolatedOp :: Reject ( miri:: RejectOpWith :: WarningWithoutBacktrace ) ,
549549 _ =>
550- show_error ! (
550+ fatal_error ! (
551551 "-Zmiri-isolation-error must be `abort`, `hide`, `warn`, or `warn-nobacktrace`"
552552 ) ,
553553 } ;
@@ -578,16 +578,16 @@ fn main() {
578578 "all" => RetagFields :: Yes ,
579579 "none" => RetagFields :: No ,
580580 "scalar" => RetagFields :: OnlyScalar ,
581- _ => show_error ! ( "`-Zmiri-retag-fields` can only be `all`, `none`, or `scalar`" ) ,
581+ _ => fatal_error ! ( "`-Zmiri-retag-fields` can only be `all`, `none`, or `scalar`" ) ,
582582 } ;
583583 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-seed=" ) {
584584 let seed = param. parse :: < u64 > ( ) . unwrap_or_else ( |_| {
585- show_error ! ( "-Zmiri-seed must be an integer that fits into u64" )
585+ fatal_error ! ( "-Zmiri-seed must be an integer that fits into u64" )
586586 } ) ;
587587 miri_config. seed = Some ( seed) ;
588588 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-many-seeds=" ) {
589589 let range = parse_range ( param) . unwrap_or_else ( |err| {
590- show_error ! (
590+ fatal_error ! (
591591 "-Zmiri-many-seeds requires a range in the form `from..to` or `..to`: {err}"
592592 )
593593 } ) ;
@@ -604,51 +604,51 @@ fn main() {
604604 miri_config. forwarded_env_vars . push ( param. to_owned ( ) ) ;
605605 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-env-set=" ) {
606606 let Some ( ( name, value) ) = param. split_once ( '=' ) else {
607- show_error ! ( "-Zmiri-env-set requires an argument of the form <name>=<value>" ) ;
607+ fatal_error ! ( "-Zmiri-env-set requires an argument of the form <name>=<value>" ) ;
608608 } ;
609609 miri_config. set_env_vars . insert ( name. to_owned ( ) , value. to_owned ( ) ) ;
610610 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-track-pointer-tag=" ) {
611611 let ids: Vec < u64 > = parse_comma_list ( param) . unwrap_or_else ( |err| {
612- show_error ! ( "-Zmiri-track-pointer-tag requires a comma separated list of valid `u64` arguments: {err}" )
612+ fatal_error ! ( "-Zmiri-track-pointer-tag requires a comma separated list of valid `u64` arguments: {err}" )
613613 } ) ;
614614 for id in ids. into_iter ( ) . map ( miri:: BorTag :: new) {
615615 if let Some ( id) = id {
616616 miri_config. tracked_pointer_tags . insert ( id) ;
617617 } else {
618- show_error ! ( "-Zmiri-track-pointer-tag requires nonzero arguments" ) ;
618+ fatal_error ! ( "-Zmiri-track-pointer-tag requires nonzero arguments" ) ;
619619 }
620620 }
621621 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-track-alloc-id=" ) {
622622 let ids = parse_comma_list :: < NonZero < u64 > > ( param) . unwrap_or_else ( |err| {
623- show_error ! ( "-Zmiri-track-alloc-id requires a comma separated list of valid non-zero `u64` arguments: {err}" )
623+ fatal_error ! ( "-Zmiri-track-alloc-id requires a comma separated list of valid non-zero `u64` arguments: {err}" )
624624 } ) ;
625625 miri_config. tracked_alloc_ids . extend ( ids. into_iter ( ) . map ( miri:: AllocId ) ) ;
626626 } else if arg == "-Zmiri-track-alloc-accesses" {
627627 miri_config. track_alloc_accesses = true ;
628628 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-address-reuse-rate=" ) {
629629 miri_config. address_reuse_rate = parse_rate ( param)
630- . unwrap_or_else ( |err| show_error ! ( "-Zmiri-address-reuse-rate {err}" ) ) ;
630+ . unwrap_or_else ( |err| fatal_error ! ( "-Zmiri-address-reuse-rate {err}" ) ) ;
631631 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-address-reuse-cross-thread-rate=" ) {
632632 miri_config. address_reuse_cross_thread_rate = parse_rate ( param)
633- . unwrap_or_else ( |err| show_error ! ( "-Zmiri-address-reuse-cross-thread-rate {err}" ) ) ;
633+ . unwrap_or_else ( |err| fatal_error ! ( "-Zmiri-address-reuse-cross-thread-rate {err}" ) ) ;
634634 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-compare-exchange-weak-failure-rate=" ) {
635635 miri_config. cmpxchg_weak_failure_rate = parse_rate ( param) . unwrap_or_else ( |err| {
636- show_error ! ( "-Zmiri-compare-exchange-weak-failure-rate {err}" )
636+ fatal_error ! ( "-Zmiri-compare-exchange-weak-failure-rate {err}" )
637637 } ) ;
638638 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-preemption-rate=" ) {
639- miri_config. preemption_rate =
640- parse_rate ( param ) . unwrap_or_else ( |err| show_error ! ( "-Zmiri-preemption-rate {err}" ) ) ;
639+ miri_config. preemption_rate = parse_rate ( param )
640+ . unwrap_or_else ( |err| fatal_error ! ( "-Zmiri-preemption-rate {err}" ) ) ;
641641 } else if arg == "-Zmiri-report-progress" {
642642 // This makes it take a few seconds between progress reports on my laptop.
643643 miri_config. report_progress = Some ( 1_000_000 ) ;
644644 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-report-progress=" ) {
645645 let interval = param. parse :: < u32 > ( ) . unwrap_or_else ( |err| {
646- show_error ! ( "-Zmiri-report-progress requires a `u32`: {}" , err)
646+ fatal_error ! ( "-Zmiri-report-progress requires a `u32`: {}" , err)
647647 } ) ;
648648 miri_config. report_progress = Some ( interval) ;
649649 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-provenance-gc=" ) {
650650 let interval = param. parse :: < u32 > ( ) . unwrap_or_else ( |err| {
651- show_error ! ( "-Zmiri-provenance-gc requires a `u32`: {}" , err)
651+ fatal_error ! ( "-Zmiri-provenance-gc requires a `u32`: {}" , err)
652652 } ) ;
653653 miri_config. gc_interval = interval;
654654 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-measureme=" ) {
@@ -658,7 +658,7 @@ fn main() {
658658 "0" => BacktraceStyle :: Off ,
659659 "1" => BacktraceStyle :: Short ,
660660 "full" => BacktraceStyle :: Full ,
661- _ => show_error ! ( "-Zmiri-backtrace may only be 0, 1, or full" ) ,
661+ _ => fatal_error ! ( "-Zmiri-backtrace may only be 0, 1, or full" ) ,
662662 } ;
663663 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-native-lib=" ) {
664664 let filename = param. to_string ( ) ;
@@ -675,27 +675,27 @@ fn main() {
675675 miri_config. native_lib . push ( filename. into ( ) ) ;
676676 }
677677 } else {
678- show_error ! ( "-Zmiri-native-lib `{}` does not exist" , filename) ;
678+ fatal_error ! ( "-Zmiri-native-lib `{}` does not exist" , filename) ;
679679 }
680680 } else if arg == "-Zmiri-force-old-native-lib-mode" {
681681 miri_config. force_old_native_lib = true ;
682682 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-num-cpus=" ) {
683683 let num_cpus = param
684684 . parse :: < u32 > ( )
685- . unwrap_or_else ( |err| show_error ! ( "-Zmiri-num-cpus requires a `u32`: {}" , err) ) ;
685+ . unwrap_or_else ( |err| fatal_error ! ( "-Zmiri-num-cpus requires a `u32`: {}" , err) ) ;
686686 if !( 1 ..=miri:: MAX_CPUS ) . contains ( & usize:: try_from ( num_cpus) . unwrap ( ) ) {
687- show_error ! ( "-Zmiri-num-cpus must be in the range 1..={}" , miri:: MAX_CPUS ) ;
687+ fatal_error ! ( "-Zmiri-num-cpus must be in the range 1..={}" , miri:: MAX_CPUS ) ;
688688 }
689689 miri_config. num_cpus = num_cpus;
690690 } else if let Some ( param) = arg. strip_prefix ( "-Zmiri-force-page-size=" ) {
691691 let page_size = param. parse :: < u64 > ( ) . unwrap_or_else ( |err| {
692- show_error ! ( "-Zmiri-force-page-size requires a `u64`: {}" , err)
692+ fatal_error ! ( "-Zmiri-force-page-size requires a `u64`: {}" , err)
693693 } ) ;
694694 // Convert from kilobytes to bytes.
695695 let page_size = if page_size. is_power_of_two ( ) {
696696 page_size * 1024
697697 } else {
698- show_error ! ( "-Zmiri-force-page-size requires a power of 2: {page_size}" ) ;
698+ fatal_error ! ( "-Zmiri-force-page-size requires a power of 2: {page_size}" ) ;
699699 } ;
700700 miri_config. page_size = Some ( page_size) ;
701701 } else {
@@ -706,22 +706,22 @@ fn main() {
706706 // Tree Borrows implies strict provenance, and is not compatible with native calls.
707707 if matches ! ( miri_config. borrow_tracker, Some ( BorrowTrackerMethod :: TreeBorrows { .. } ) ) {
708708 if miri_config. provenance_mode != ProvenanceMode :: Strict {
709- show_error ! (
709+ fatal_error ! (
710710 "Tree Borrows does not support integer-to-pointer casts, and hence requires strict provenance"
711711 ) ;
712712 }
713713 if !miri_config. native_lib . is_empty ( ) {
714- show_error ! ( "Tree Borrows is not compatible with calling native functions" ) ;
714+ fatal_error ! ( "Tree Borrows is not compatible with calling native functions" ) ;
715715 }
716716 }
717717
718718 // Native calls and strict provenance are not compatible.
719719 if !miri_config. native_lib . is_empty ( ) && miri_config. provenance_mode == ProvenanceMode :: Strict {
720- show_error ! ( "strict provenance is not compatible with calling native functions" ) ;
720+ fatal_error ! ( "strict provenance is not compatible with calling native functions" ) ;
721721 }
722722 // You can set either one seed or many.
723723 if many_seeds. is_some ( ) && miri_config. seed . is_some ( ) {
724- show_error ! ( "Only one of `-Zmiri-seed` and `-Zmiri-many-seeds can be set" ) ;
724+ fatal_error ! ( "Only one of `-Zmiri-seed` and `-Zmiri-many-seeds can be set" ) ;
725725 }
726726
727727 // Ensure we have parallelism for many-seeds mode.
@@ -737,12 +737,12 @@ fn main() {
737737 assert_eq ! ( genmc_config. is_some( ) , miri_config. genmc_mode) ;
738738 if genmc_config. is_some ( ) {
739739 if !miri_config. data_race_detector {
740- show_error ! ( "Cannot disable data race detection in GenMC mode (currently)" ) ;
740+ fatal_error ! ( "Cannot disable data race detection in GenMC mode (currently)" ) ;
741741 } else if !miri_config. weak_memory_emulation {
742- show_error ! ( "Cannot disable weak memory emulation in GenMC mode" ) ;
742+ fatal_error ! ( "Cannot disable weak memory emulation in GenMC mode" ) ;
743743 }
744744 } else if miri_config. weak_memory_emulation && !miri_config. data_race_detector {
745- show_error ! (
745+ fatal_error ! (
746746 "Weak memory emulation cannot be enabled when the data race detector is disabled"
747747 ) ;
748748 } ;
0 commit comments