Skip to content

Commit db94219

Browse files
committed
use owned Command on command invokers
Signed-off-by: onur-ozkan <[email protected]>
1 parent 7516912 commit db94219

File tree

12 files changed

+259
-213
lines changed

12 files changed

+259
-213
lines changed

src/bootstrap/src/core/build_steps/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ macro_rules! clean_crate_tree {
8585

8686
// NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,
8787
// and doesn't use `stream_cargo` to avoid passing `--message-format` which `clean` doesn't accept.
88-
builder.run(&mut cargo);
88+
builder.run(cargo);
8989
}
9090
}
9191
)+ }

src/bootstrap/src/core/build_steps/compile.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -777,14 +777,15 @@ impl Step for StartupObjects {
777777
// a local_rebuild compiler already has stage1 features
778778
cmd.arg("--cfg").arg("bootstrap");
779779
}
780-
builder.run(
781-
cmd.arg("--target")
782-
.arg(target.rustc_target_arg())
783-
.arg("--emit=obj")
784-
.arg("-o")
785-
.arg(dst_file)
786-
.arg(src_file),
787-
);
780+
781+
cmd.arg("--target")
782+
.arg(target.rustc_target_arg())
783+
.arg("--emit=obj")
784+
.arg("-o")
785+
.arg(dst_file)
786+
.arg(src_file);
787+
788+
builder.run(cmd);
788789
}
789790

790791
let target = sysroot_dir.join((*file).to_string() + ".o");

src/bootstrap/src/core/build_steps/dist.rs

+73-64
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,7 @@ impl Step for Extended {
16441644
.arg(pkg.join(component))
16451645
.arg("--nopayload")
16461646
.arg(pkg.join(component).with_extension("pkg"));
1647-
builder.run(&mut cmd);
1647+
builder.run(cmd);
16481648
};
16491649

16501650
let prepare = |name: &str| {
@@ -1687,7 +1687,7 @@ impl Step for Extended {
16871687
.arg("--package-path")
16881688
.arg(&pkg);
16891689
let _time = timeit(builder);
1690-
builder.run(&mut cmd);
1690+
builder.run(cmd);
16911691
}
16921692

16931693
if target.is_windows() {
@@ -1743,9 +1743,9 @@ impl Step for Extended {
17431743
let light = wix.join("bin/light.exe");
17441744

17451745
let heat_flags = ["-nologo", "-gg", "-sfrag", "-srd", "-sreg"];
1746-
builder.run(
1747-
Command::new(&heat)
1748-
.current_dir(&exe)
1746+
builder.run({
1747+
let mut cmd = Command::new(&heat);
1748+
cmd.current_dir(&exe)
17491749
.arg("dir")
17501750
.arg("rustc")
17511751
.args(heat_flags)
@@ -1756,12 +1756,13 @@ impl Step for Extended {
17561756
.arg("-var")
17571757
.arg("var.RustcDir")
17581758
.arg("-out")
1759-
.arg(exe.join("RustcGroup.wxs")),
1760-
);
1759+
.arg(exe.join("RustcGroup.wxs"));
1760+
cmd
1761+
});
17611762
if built_tools.contains("rust-docs") {
1762-
builder.run(
1763-
Command::new(&heat)
1764-
.current_dir(&exe)
1763+
builder.run({
1764+
let mut cmd = Command::new(&heat);
1765+
cmd.current_dir(&exe)
17651766
.arg("dir")
17661767
.arg("rust-docs")
17671768
.args(heat_flags)
@@ -1774,12 +1775,13 @@ impl Step for Extended {
17741775
.arg("-out")
17751776
.arg(exe.join("DocsGroup.wxs"))
17761777
.arg("-t")
1777-
.arg(etc.join("msi/squash-components.xsl")),
1778-
);
1778+
.arg(etc.join("msi/squash-components.xsl"));
1779+
cmd
1780+
});
17791781
}
1780-
builder.run(
1781-
Command::new(&heat)
1782-
.current_dir(&exe)
1782+
builder.run({
1783+
let mut cmd = Command::new(&heat);
1784+
cmd.current_dir(&exe)
17831785
.arg("dir")
17841786
.arg("cargo")
17851787
.args(heat_flags)
@@ -1792,11 +1794,12 @@ impl Step for Extended {
17921794
.arg("-out")
17931795
.arg(exe.join("CargoGroup.wxs"))
17941796
.arg("-t")
1795-
.arg(etc.join("msi/remove-duplicates.xsl")),
1796-
);
1797-
builder.run(
1798-
Command::new(&heat)
1799-
.current_dir(&exe)
1797+
.arg(etc.join("msi/remove-duplicates.xsl"));
1798+
cmd
1799+
});
1800+
builder.run({
1801+
let mut cmd = Command::new(&heat);
1802+
cmd.current_dir(&exe)
18001803
.arg("dir")
18011804
.arg("rust-std")
18021805
.args(heat_flags)
@@ -1807,12 +1810,13 @@ impl Step for Extended {
18071810
.arg("-var")
18081811
.arg("var.StdDir")
18091812
.arg("-out")
1810-
.arg(exe.join("StdGroup.wxs")),
1811-
);
1813+
.arg(exe.join("StdGroup.wxs"));
1814+
cmd
1815+
});
18121816
if built_tools.contains("rust-analyzer") {
1813-
builder.run(
1814-
Command::new(&heat)
1815-
.current_dir(&exe)
1817+
builder.run({
1818+
let mut cmd = Command::new(&heat);
1819+
cmd.current_dir(&exe)
18161820
.arg("dir")
18171821
.arg("rust-analyzer")
18181822
.args(heat_flags)
@@ -1825,13 +1829,14 @@ impl Step for Extended {
18251829
.arg("-out")
18261830
.arg(exe.join("RustAnalyzerGroup.wxs"))
18271831
.arg("-t")
1828-
.arg(etc.join("msi/remove-duplicates.xsl")),
1829-
);
1832+
.arg(etc.join("msi/remove-duplicates.xsl"));
1833+
cmd
1834+
});
18301835
}
18311836
if built_tools.contains("clippy") {
1832-
builder.run(
1833-
Command::new(&heat)
1834-
.current_dir(&exe)
1837+
builder.run({
1838+
let mut cmd = Command::new(&heat);
1839+
cmd.current_dir(&exe)
18351840
.arg("dir")
18361841
.arg("clippy")
18371842
.args(heat_flags)
@@ -1844,13 +1849,14 @@ impl Step for Extended {
18441849
.arg("-out")
18451850
.arg(exe.join("ClippyGroup.wxs"))
18461851
.arg("-t")
1847-
.arg(etc.join("msi/remove-duplicates.xsl")),
1848-
);
1852+
.arg(etc.join("msi/remove-duplicates.xsl"));
1853+
cmd
1854+
});
18491855
}
18501856
if built_tools.contains("rust-demangler") {
1851-
builder.run(
1852-
Command::new(&heat)
1853-
.current_dir(&exe)
1857+
builder.run({
1858+
let mut cmd = Command::new(&heat);
1859+
cmd.current_dir(&exe)
18541860
.arg("dir")
18551861
.arg("rust-demangler")
18561862
.args(heat_flags)
@@ -1863,13 +1869,14 @@ impl Step for Extended {
18631869
.arg("-out")
18641870
.arg(exe.join("RustDemanglerGroup.wxs"))
18651871
.arg("-t")
1866-
.arg(etc.join("msi/remove-duplicates.xsl")),
1867-
);
1872+
.arg(etc.join("msi/remove-duplicates.xsl"));
1873+
cmd
1874+
});
18681875
}
18691876
if built_tools.contains("miri") {
1870-
builder.run(
1871-
Command::new(&heat)
1872-
.current_dir(&exe)
1877+
builder.run({
1878+
let mut cmd = Command::new(&heat);
1879+
cmd.current_dir(&exe)
18731880
.arg("dir")
18741881
.arg("miri")
18751882
.args(heat_flags)
@@ -1882,12 +1889,13 @@ impl Step for Extended {
18821889
.arg("-out")
18831890
.arg(exe.join("MiriGroup.wxs"))
18841891
.arg("-t")
1885-
.arg(etc.join("msi/remove-duplicates.xsl")),
1886-
);
1892+
.arg(etc.join("msi/remove-duplicates.xsl"));
1893+
cmd
1894+
});
18871895
}
1888-
builder.run(
1889-
Command::new(&heat)
1890-
.current_dir(&exe)
1896+
builder.run({
1897+
let mut cmd = Command::new(&heat);
1898+
cmd.current_dir(&exe)
18911899
.arg("dir")
18921900
.arg("rust-analysis")
18931901
.args(heat_flags)
@@ -1900,24 +1908,25 @@ impl Step for Extended {
19001908
.arg("-out")
19011909
.arg(exe.join("AnalysisGroup.wxs"))
19021910
.arg("-t")
1903-
.arg(etc.join("msi/remove-duplicates.xsl")),
1904-
);
1911+
.arg(etc.join("msi/remove-duplicates.xsl"));
1912+
cmd
1913+
});
19051914
if target.ends_with("windows-gnu") {
1906-
builder.run(
1907-
Command::new(&heat)
1908-
.current_dir(&exe)
1909-
.arg("dir")
1910-
.arg("rust-mingw")
1911-
.args(heat_flags)
1912-
.arg("-cg")
1913-
.arg("GccGroup")
1914-
.arg("-dr")
1915-
.arg("Gcc")
1916-
.arg("-var")
1917-
.arg("var.GccDir")
1918-
.arg("-out")
1919-
.arg(exe.join("GccGroup.wxs")),
1920-
);
1915+
let mut cmd = Command::new(&heat);
1916+
cmd.current_dir(&exe)
1917+
.arg("dir")
1918+
.arg("rust-mingw")
1919+
.args(heat_flags)
1920+
.arg("-cg")
1921+
.arg("GccGroup")
1922+
.arg("-dr")
1923+
.arg("Gcc")
1924+
.arg("-var")
1925+
.arg("var.GccDir")
1926+
.arg("-out")
1927+
.arg(exe.join("GccGroup.wxs"));
1928+
1929+
builder.run(cmd);
19211930
}
19221931

19231932
let candle = |input: &Path| {
@@ -1955,7 +1964,7 @@ impl Step for Extended {
19551964
if target.ends_with("windows-gnu") {
19561965
cmd.arg("-dGccDir=rust-mingw");
19571966
}
1958-
builder.run(&mut cmd);
1967+
builder.run(cmd);
19591968
};
19601969
candle(&xform(&etc.join("msi/rust.wxs")));
19611970
candle(&etc.join("msi/ui.wxs"));
@@ -2030,7 +2039,7 @@ impl Step for Extended {
20302039
cmd.arg("-sice:ICE57");
20312040

20322041
let _time = timeit(builder);
2033-
builder.run(&mut cmd);
2042+
builder.run(cmd);
20342043

20352044
if !builder.config.dry_run() {
20362045
t!(move_file(exe.join(&filename), distdir(builder).join(&filename)));

src/bootstrap/src/core/build_steps/doc.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ impl<P: Step> Step for RustbookSrc<P> {
151151
builder.info(&format!("Rustbook ({target}) - {name}"));
152152
let _ = fs::remove_dir_all(&out);
153153

154-
builder.run(rustbook_cmd.arg("build").arg(src).arg("-d").arg(out));
154+
rustbook_cmd.arg("build").arg(src).arg("-d").arg(out);
155+
builder.run(rustbook_cmd);
155156
}
156157

157158
if self.parent.is_some() {
@@ -283,7 +284,7 @@ fn invoke_rustdoc(
283284
cmd.arg("-Z").arg("unstable-options").arg("--disable-minification");
284285
}
285286

286-
builder.run(&mut cmd);
287+
builder.run(cmd);
287288
}
288289

289290
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -377,7 +378,8 @@ impl Step for Standalone {
377378
} else {
378379
cmd.arg("--markdown-css").arg("rust.css");
379380
}
380-
builder.run(&mut cmd);
381+
382+
builder.run(cmd);
381383
}
382384

383385
// We open doc/index.html as the default if invoked as `x.py doc --open`
@@ -476,7 +478,7 @@ impl Step for Releases {
476478
cmd.arg("--disable-minification");
477479
}
478480

479-
builder.run(&mut cmd);
481+
builder.run(cmd);
480482
}
481483

482484
// We open doc/RELEASES.html as the default if invoked as `x.py doc --open RELEASES.md`
@@ -720,7 +722,7 @@ fn doc_std(
720722
format!("library{} in {} format", crate_description(requested_crates), format.as_str());
721723
let _guard = builder.msg_doc(compiler, description, target);
722724

723-
builder.run(&mut cargo.into());
725+
builder.run(cargo.into());
724726
builder.cp_link_r(&out_dir, out);
725727
}
726728

@@ -845,7 +847,7 @@ impl Step for Rustc {
845847
let proc_macro_out_dir = builder.stage_out(compiler, Mode::Rustc).join("doc");
846848
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
847849

848-
builder.run(&mut cargo.into());
850+
builder.run(cargo.into());
849851

850852
if !builder.config.dry_run() {
851853
// Sanity check on linked compiler crates
@@ -976,7 +978,7 @@ macro_rules! tool_doc {
976978
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
977979

978980
let _guard = builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
979-
builder.run(&mut cargo.into());
981+
builder.run(cargo.into());
980982

981983
if !builder.config.dry_run() {
982984
// Sanity check on linked doc directories
@@ -1068,7 +1070,7 @@ impl Step for ErrorIndex {
10681070
index.arg(out);
10691071
index.arg(&builder.version);
10701072

1071-
builder.run(&mut index);
1073+
builder.run(index);
10721074
}
10731075
}
10741076

@@ -1104,7 +1106,7 @@ impl Step for UnstableBookGen {
11041106
cmd.arg(builder.src.join("src"));
11051107
cmd.arg(out);
11061108

1107-
builder.run(&mut cmd);
1109+
builder.run(cmd);
11081110
}
11091111
}
11101112

@@ -1199,7 +1201,7 @@ impl Step for RustcBook {
11991201
self.compiler.host,
12001202
self.target,
12011203
);
1202-
builder.run(&mut cmd);
1204+
builder.run(cmd);
12031205
drop(doc_generator_guard);
12041206

12051207
// Run rustbook/mdbook to generate the HTML pages.

src/bootstrap/src/core/build_steps/install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn install_sh(
113113
.arg(format!("--libdir={}", prepare_dir(&destdir_env, libdir)))
114114
.arg(format!("--mandir={}", prepare_dir(&destdir_env, mandir)))
115115
.arg("--disable-ldconfig");
116-
builder.run(&mut cmd);
116+
builder.run(cmd);
117117
t!(fs::remove_dir_all(&empty_dir));
118118
}
119119

0 commit comments

Comments
 (0)