@@ -683,6 +683,7 @@ fn phase_cargo_rustc(mut args: env::Args) {
683
683
let mut cmd = miri ( ) ;
684
684
685
685
// Ensure --emit argument for a check-only build is present.
686
+ // We cannot use the usual helpers since we need to check specifically in `env.args`.
686
687
if let Some ( i) = env. args . iter ( ) . position ( |arg| arg. starts_with ( "--emit=" ) ) {
687
688
// For `no_run` tests, rustdoc passes a `--emit` flag; make sure it has the right shape.
688
689
assert_eq ! ( env. args[ i] , "--emit=metadata" ) ;
@@ -877,7 +878,7 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
877
878
878
879
// phase_cargo_miri sets the RUSTDOC env var to ourselves, so we can't use that here;
879
880
// just default to a straight-forward invocation for now:
880
- let mut cmd = Command :: new ( OsString :: from ( "rustdoc" ) ) ;
881
+ let mut cmd = Command :: new ( "rustdoc" ) ;
881
882
882
883
// Because of the way the main function is structured, we have to take the first argument spearately
883
884
// from the rest; to simplify the following argument patching loop, we'll just skip that one.
@@ -888,6 +889,7 @@ fn phase_cargo_rustdoc(fst_arg: &str, mut args: env::Args) {
888
889
cmd. arg ( fst_arg) ;
889
890
890
891
let runtool_flag = "--runtool" ;
892
+ // `crossmode` records if *any* argument matches `runtool_flag`; here we check the first one.
891
893
let mut crossmode = fst_arg == runtool_flag;
892
894
while let Some ( arg) = args. next ( ) {
893
895
if arg == extern_flag {
@@ -950,9 +952,8 @@ fn main() {
950
952
return ;
951
953
}
952
954
953
- // The way rustdoc invokes rustc is indistuingishable from the way cargo invokes rustdoc
954
- // by the arguments alone, and we can't take from the args iterator in this case.
955
- // phase_cargo_rustdoc sets this environment variable to let us disambiguate here
955
+ // The way rustdoc invokes rustc is indistuingishable from the way cargo invokes rustdoc by the
956
+ // arguments alone. `phase_cargo_rustdoc` sets this environment variable to let us disambiguate.
956
957
let invoked_by_rustdoc = env:: var_os ( "MIRI_CALLED_FROM_RUSTDOC" ) . is_some ( ) ;
957
958
if invoked_by_rustdoc {
958
959
// ...however, we then also see this variable when rustdoc invokes us as the testrunner!
0 commit comments