Skip to content

Commit b3d0eeb

Browse files
committed
refactor(compile): Always add base args first
This will make it less likely that anything that depends on them will get moved before them and makes it easier to consistently add logic that depends on them.
1 parent 22bbc95 commit b3d0eeb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,15 @@ fn prepare_rustc(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult<ProcessBuilde
662662
let mut base = cx
663663
.compilation
664664
.rustc_process(unit, is_primary, is_workspace)?;
665+
build_base_args(cx, &mut base, unit)?;
666+
667+
base.inherit_jobserver(&cx.jobserver);
668+
build_deps_args(&mut base, cx, unit)?;
669+
add_cap_lints(cx.bcx, unit, &mut base);
670+
base.args(cx.bcx.rustflags_args(unit));
671+
if cx.bcx.config.cli_unstable().binary_dep_depinfo {
672+
base.arg("-Z").arg("binary-dep-depinfo");
673+
}
665674

666675
if is_primary {
667676
base.env("CARGO_PRIMARY_PACKAGE", "1");
@@ -672,14 +681,6 @@ fn prepare_rustc(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult<ProcessBuilde
672681
base.env("CARGO_TARGET_TMPDIR", tmp.display().to_string());
673682
}
674683

675-
base.inherit_jobserver(&cx.jobserver);
676-
build_base_args(cx, &mut base, unit)?;
677-
build_deps_args(&mut base, cx, unit)?;
678-
add_cap_lints(cx.bcx, unit, &mut base);
679-
base.args(cx.bcx.rustflags_args(unit));
680-
if cx.bcx.config.cli_unstable().binary_dep_depinfo {
681-
base.arg("-Z").arg("binary-dep-depinfo");
682-
}
683684
Ok(base)
684685
}
685686

0 commit comments

Comments
 (0)