@@ -401,31 +401,6 @@ path = "lib.rs"
401
401
}
402
402
}
403
403
404
- fn main ( ) {
405
- // Check for version and help flags even when invoked as `cargo-miri`.
406
- if std:: env:: args ( ) . any ( |a| a == "--help" || a == "-h" ) {
407
- show_help ( ) ;
408
- return ;
409
- }
410
- if std:: env:: args ( ) . any ( |a| a == "--version" || a == "-V" ) {
411
- show_version ( ) ;
412
- return ;
413
- }
414
-
415
- if let Some ( "miri" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
416
- // This arm is for when `cargo miri` is called. We call `cargo check` for each applicable target,
417
- // but with the `RUSTC` env var set to the `cargo-miri` binary so that we come back in the other branch,
418
- // and dispatch the invocations to `rustc` and `miri`, respectively.
419
- in_cargo_miri ( ) ;
420
- } else if let Some ( "rustc" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
421
- // This arm is executed when `cargo-miri` runs `cargo check` with the `RUSTC_WRAPPER` env var set to itself:
422
- // dependencies get dispatched to `rustc`, the final test/binary to `miri`.
423
- inside_cargo_rustc ( ) ;
424
- } else {
425
- show_error ( format ! ( "must be called with either `miri` or `rustc` as first argument." ) )
426
- }
427
- }
428
-
429
404
fn in_cargo_miri ( ) {
430
405
let ( subcommand, skip) = match std:: env:: args ( ) . nth ( 2 ) . as_deref ( ) {
431
406
Some ( "test" ) => ( MiriCommand :: Test , 3 ) ,
@@ -593,3 +568,28 @@ fn inside_cargo_rustc() {
593
568
Err ( e) => panic ! ( "error running {:?}:\n {:?}" , command, e) ,
594
569
}
595
570
}
571
+
572
+ fn main ( ) {
573
+ // Check for version and help flags even when invoked as `cargo-miri`.
574
+ if has_arg_flag ( "--help" ) || has_arg_flag ( "-h" ) {
575
+ show_help ( ) ;
576
+ return ;
577
+ }
578
+ if has_arg_flag ( "--version" ) || has_arg_flag ( "-V" ) {
579
+ show_version ( ) ;
580
+ return ;
581
+ }
582
+
583
+ if let Some ( "miri" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
584
+ // This arm is for when `cargo miri` is called. We call `cargo check` for each applicable target,
585
+ // but with the `RUSTC` env var set to the `cargo-miri` binary so that we come back in the other branch,
586
+ // and dispatch the invocations to `rustc` and `miri`, respectively.
587
+ in_cargo_miri ( ) ;
588
+ } else if let Some ( "rustc" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
589
+ // This arm is executed when `cargo-miri` runs `cargo check` with the `RUSTC_WRAPPER` env var set to itself:
590
+ // dependencies get dispatched to `rustc`, the final test/binary to `miri`.
591
+ inside_cargo_rustc ( ) ;
592
+ } else {
593
+ show_error ( format ! ( "must be called with either `miri` or `rustc` as first argument." ) )
594
+ }
595
+ }
0 commit comments