-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #8441 - reitermarkus:linkarg, r=alexcrichton
Finish implementation of `-Zextra-link-arg`. This is a continuation of #7811, which adds tests and a warning if the `-Zextra-link-arg` flag is not specified. Also moved the documentation into `unstable.md`.
- Loading branch information
Showing
7 changed files
with
211 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//! Tests for -Zextra-link-arg. | ||
use cargo_test_support::{basic_bin_manifest, project}; | ||
|
||
#[cargo_test] | ||
fn build_script_extra_link_arg_bin() { | ||
let p = project() | ||
.file("Cargo.toml", &basic_bin_manifest("foo")) | ||
.file("src/main.rs", "fn main() {}") | ||
.file( | ||
"build.rs", | ||
r#" | ||
fn main() { | ||
println!("cargo:rustc-link-arg-bins=--this-is-a-bogus-flag"); | ||
} | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.cargo("build -Zextra-link-arg -v") | ||
.masquerade_as_nightly_cargo() | ||
.without_status() | ||
.with_stderr_contains( | ||
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]", | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn build_script_extra_link_arg() { | ||
let p = project() | ||
.file("Cargo.toml", &basic_bin_manifest("foo")) | ||
.file("src/main.rs", "fn main() {}") | ||
.file( | ||
"build.rs", | ||
r#" | ||
fn main() { | ||
println!("cargo:rustc-link-arg=--this-is-a-bogus-flag"); | ||
} | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.cargo("build -Zextra-link-arg -v") | ||
.masquerade_as_nightly_cargo() | ||
.without_status() | ||
.with_stderr_contains( | ||
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]", | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn build_script_extra_link_arg_warn_without_flag() { | ||
let p = project() | ||
.file("Cargo.toml", &basic_bin_manifest("foo")) | ||
.file("src/main.rs", "fn main() {}") | ||
.file( | ||
"build.rs", | ||
r#" | ||
fn main() { | ||
println!("cargo:rustc-link-arg=--this-is-a-bogus-flag"); | ||
} | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.cargo("build -v") | ||
.with_status(0) | ||
.with_stderr_contains("warning: cargo:rustc-link-arg requires -Zextra-link-arg flag") | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters