Skip to content

Commit

Permalink
Auto merge of rust-lang#8648 - Fogapod:rustc-args, r=ehuss
Browse files Browse the repository at this point in the history
Add spaces after -C and -Z flags for consistency

Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.
  • Loading branch information
bors authored and ehuss committed Aug 28, 2020
1 parent 2ceb172 commit 84aa127
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
13 changes: 7 additions & 6 deletions src/cargo/core/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc<dyn Executor>) -> Car

rustc.args(cx.bcx.rustflags_args(unit));
if cx.bcx.config.cli_unstable().binary_dep_depinfo {
rustc.arg("-Zbinary-dep-depinfo");
rustc.arg("-Z").arg("binary-dep-depinfo");
}
let mut output_options = OutputOptions::new(cx, unit);
let package_id = unit.pkg.package_id();
Expand Down Expand Up @@ -533,7 +533,7 @@ fn prepare_rustc(
if cx.bcx.config.cli_unstable().jobserver_per_rustc {
let client = cx.new_jobserver()?;
base.inherit_jobserver(&client);
base.arg("-Zjobserver-token-requests");
base.arg("-Z").arg("jobserver-token-requests");
assert!(cx.rustc_clients.insert(unit.clone(), client).is_none());
} else {
base.inherit_jobserver(&cx.jobserver);
Expand Down Expand Up @@ -809,10 +809,10 @@ fn build_base_args(
}
lto::Lto::ObjectAndBitcode => {} // this is rustc's default
lto::Lto::OnlyBitcode => {
cmd.arg("-Clinker-plugin-lto");
cmd.arg("-C").arg("linker-plugin-lto");
}
lto::Lto::OnlyObject => {
cmd.arg("-Cembed-bitcode=no");
cmd.arg("-C").arg("embed-bitcode=no");
}
}

Expand Down Expand Up @@ -862,7 +862,7 @@ fn build_base_args(
// will simply not be needed when the behavior is stabilized in the Rust
// compiler itself.
if *panic == PanicStrategy::Abort {
cmd.arg("-Zpanic-abort-tests");
cmd.arg("-Z").arg("panic-abort-tests");
}
} else if test {
cmd.arg("--cfg").arg("test");
Expand Down Expand Up @@ -922,7 +922,8 @@ fn build_base_args(
// any non-public crate in the sysroot).
//
// RUSTC_BOOTSTRAP allows unstable features on stable.
cmd.arg("-Zforce-unstable-if-unmarked")
cmd.arg("-Z")
.arg("force-unstable-if-unmarked")
.env("RUSTC_BOOTSTRAP", "1");
}

Expand Down
60 changes: 31 additions & 29 deletions tests/testsuite/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn with_deps() {
.file("src/main.rs", "extern crate bar; fn main() {}")
.build();
p.cargo("build -v --release")
.with_stderr_contains("[..]`rustc[..]--crate-name bar[..]-Clinker-plugin-lto[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name bar[..]-C linker-plugin-lto[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name test[..]-C lto[..]`")
.run();
}
Expand Down Expand Up @@ -83,7 +83,7 @@ fn build_dep_not_ltod() {
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("build -v --release")
.with_stderr_contains("[..]`rustc[..]--crate-name bar[..]-Cembed-bitcode=no[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name bar[..]-C embed-bitcode=no[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name test[..]-C lto[..]`")
.run();
}
Expand Down Expand Up @@ -188,30 +188,32 @@ fn complicated() {
p.cargo("build -v --release")
// normal deps and their transitive dependencies do not need object
// code, so they should have linker-plugin-lto specified
.with_stderr_contains("[..]`rustc[..]--crate-name dep_normal2 [..]-Clinker-plugin-lto[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name dep_normal [..]-Clinker-plugin-lto[..]`")
.with_stderr_contains(
"[..]`rustc[..]--crate-name dep_normal2 [..]-C linker-plugin-lto[..]`",
)
.with_stderr_contains("[..]`rustc[..]--crate-name dep_normal [..]-C linker-plugin-lto[..]`")
// build dependencies and their transitive deps don't need any bitcode,
// so embedding should be turned off
.with_stderr_contains("[..]`rustc[..]--crate-name dep_build2 [..]-Cembed-bitcode=no[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name dep_build [..]-Cembed-bitcode=no[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name dep_build2 [..]-C embed-bitcode=no[..]`")
.with_stderr_contains("[..]`rustc[..]--crate-name dep_build [..]-C embed-bitcode=no[..]`")
.with_stderr_contains(
"[..]`rustc[..]--crate-name build_script_build [..]-Cembed-bitcode=no[..]`",
"[..]`rustc[..]--crate-name build_script_build [..]-C embed-bitcode=no[..]`",
)
// proc macro deps are the same as build deps here
.with_stderr_contains(
"[..]`rustc[..]--crate-name dep_proc_macro2 [..]-Cembed-bitcode=no[..]`",
"[..]`rustc[..]--crate-name dep_proc_macro2 [..]-C embed-bitcode=no[..]`",
)
.with_stderr_contains(
"[..]`rustc[..]--crate-name dep_proc_macro [..]-Cembed-bitcode=no[..]`",
"[..]`rustc[..]--crate-name dep_proc_macro [..]-C embed-bitcode=no[..]`",
)
.with_stderr_contains("[..]`rustc[..]--crate-name test [..]--crate-type bin[..]-C lto[..]`")
.with_stderr_contains(
"[..]`rustc[..]--crate-name test [..]--crate-type cdylib[..]-C lto[..]`",
)
.with_stderr_contains("[..]`rustc[..]--crate-name dep_shared [..]`")
.with_stderr_does_not_contain("[..]--crate-name dep_shared[..]-C lto[..]")
.with_stderr_does_not_contain("[..]--crate-name dep_shared[..]-Clinker-plugin-lto[..]")
.with_stderr_does_not_contain("[..]--crate-name dep_shared[..]-Cembed-bitcode[..]")
.with_stderr_does_not_contain("[..]--crate-name dep_shared[..]-C linker-plugin-lto[..]")
.with_stderr_does_not_contain("[..]--crate-name dep_shared[..]-C embed-bitcode[..]")
.run();
}

Expand Down Expand Up @@ -252,9 +254,9 @@ fn off_in_manifest_works() {
[DOWNLOADING] [..]
[DOWNLOADED] [..]
[COMPILING] bar v0.0.1
[RUNNING] `rustc --crate-name bar [..]--crate-type lib [..]-Cembed-bitcode=no[..]
[RUNNING] `rustc --crate-name bar [..]--crate-type lib [..]-C embed-bitcode=no[..]
[COMPILING] test [..]
[RUNNING] `rustc --crate-name test [..]--crate-type lib [..]-Cembed-bitcode=no[..]
[RUNNING] `rustc --crate-name test [..]--crate-type lib [..]-C embed-bitcode=no[..]
[RUNNING] `rustc --crate-name test src/main.rs [..]--crate-type bin [..]-C lto=off[..]
[FINISHED] [..]
",
Expand Down Expand Up @@ -283,7 +285,7 @@ fn between_builds() {
.with_stderr(
"\
[COMPILING] test [..]
[RUNNING] `rustc [..]--crate-type lib[..]-Clinker-plugin-lto[..]
[RUNNING] `rustc [..]--crate-type lib[..]-C linker-plugin-lto[..]
[FINISHED] [..]
",
)
Expand Down Expand Up @@ -447,9 +449,9 @@ fn verify_lto(output: &Output, krate: &str, krate_info: &str, expected_lto: Lto)
}
} else if line.contains("-C lto") {
Lto::Run(None)
} else if line.contains("-Clinker-plugin-lto") {
} else if line.contains("-C linker-plugin-lto") {
Lto::OnlyBitcode
} else if line.contains("-Cembed-bitcode=no") {
} else if line.contains("-C embed-bitcode=no") {
Lto::OnlyObject
} else {
Lto::ObjectAndBitcode
Expand Down Expand Up @@ -491,8 +493,8 @@ fn cdylib_and_rlib() {
[FRESH] registry-shared v0.0.1
[FRESH] bar v0.0.0 [..]
[COMPILING] foo [..]
[RUNNING] `rustc --crate-name foo [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name a [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name foo [..]-C embed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name a [..]-C embed-bitcode=no --test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
Expand All @@ -515,8 +517,8 @@ fn cdylib_and_rlib() {
[FRESH] registry v0.0.1
[FRESH] registry-shared v0.0.1
[COMPILING] bar [..]
[RUNNING] `rustc --crate-name bar [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name b [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name bar [..]-C embed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name b [..]-C embed-bitcode=no --test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
Expand Down Expand Up @@ -547,8 +549,8 @@ fn dylib() {
[FRESH] registry-shared v0.0.1
[FRESH] bar v0.0.0 [..]
[COMPILING] foo [..]
[RUNNING] `rustc --crate-name foo [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name a [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name foo [..]-C embed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name a [..]-C embed-bitcode=no --test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
Expand All @@ -560,9 +562,9 @@ fn dylib() {
"\
[COMPILING] registry-shared v0.0.1
[FRESH] registry v0.0.1
[RUNNING] `rustc --crate-name registry_shared [..]-Cembed-bitcode=no[..]
[RUNNING] `rustc --crate-name registry_shared [..]-C embed-bitcode=no[..]
[COMPILING] bar [..]
[RUNNING] `rustc --crate-name bar [..]--crate-type dylib [..]-Cembed-bitcode=no[..]
[RUNNING] `rustc --crate-name bar [..]--crate-type dylib [..]-C embed-bitcode=no[..]
[FINISHED] [..]
",
)
Expand All @@ -573,8 +575,8 @@ fn dylib() {
[FRESH] registry-shared v0.0.1
[FRESH] registry v0.0.1
[COMPILING] bar [..]
[RUNNING] `rustc --crate-name bar [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name b [..]-Cembed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name bar [..]-C embed-bitcode=no --test[..]
[RUNNING] `rustc --crate-name b [..]-C embed-bitcode=no --test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
Expand Down Expand Up @@ -625,7 +627,7 @@ fn test_profile() {
[COMPILING] bar v0.0.1
[RUNNING] `rustc --crate-name bar [..]crate-type lib[..]
[COMPILING] foo [..]
[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no[..]
[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no[..]
[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -C lto=thin [..]--test[..]
[FINISHED] [..]
[RUNNING] [..]
Expand Down Expand Up @@ -678,8 +680,8 @@ fn dev_profile() {
[COMPILING] bar v0.0.1
[RUNNING] `rustc --crate-name bar [..]crate-type lib[..]
[COMPILING] foo [..]
[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -Clinker-plugin-lto [..]
[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -Cembed-bitcode=no [..]--test[..]
[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -C linker-plugin-lto [..]
[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -C embed-bitcode=no [..]--test[..]
[FINISHED] [..]
[RUNNING] [..]
[DOCTEST] foo
Expand Down

0 comments on commit 84aa127

Please sign in to comment.