Skip to content

Commit 43b7b2f

Browse files
Kobzollqd
authored andcommitted
Add test for unstable values of -Clink-self-contained
1 parent 071297e commit 43b7b2f

10 files changed

+36
-4
lines changed

tests/run-make/rust-lld/rmake.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Test linking using `cc` with `rust-lld`, using the unstable CLI described in MCP 510
2-
// see https://github.com/rust-lang/compiler-team/issues/510 for more info
1+
// Test linking using `cc` with `rust-lld`, using the `-Clinker-features` and
2+
// `-Clink-self-contained` CLI flags.
33

44
//@ needs-rust-lld
55
//@ ignore-s390x lld does not yet support s390x as target
@@ -14,7 +14,7 @@ fn main() {
1414
rustc().arg("-Clinker-features=+lld").arg("-Clink-self-contained=+linker").input("main.rs"),
1515
);
1616

17-
// It should not be used when we explicitly opt-out of lld.
17+
// It should not be used when we explicitly opt out of lld.
1818
assert_rustc_doesnt_use_lld(rustc().arg("-Clinker-features=-lld").input("main.rs"));
1919

2020
// While we're here, also check that the last linker feature flag "wins" when passed multiple
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Checks that values for `-Clink-self-contained` other than the blanket enable/disable and
2+
// `+/-linker` require `-Zunstable-options`.
3+
4+
//@ check-fail
5+
//@ revisions: crto libc unwind sanitizers mingw
6+
//@ [crto] compile-flags: -Clink-self-contained=+crto
7+
//@ [libc] compile-flags: -Clink-self-contained=-libc
8+
//@ [unwind] compile-flags: -Clink-self-contained=+unwind
9+
//@ [sanitizers] compile-flags: -Clink-self-contained=-sanitizers
10+
//@ [mingw] compile-flags: -Clink-self-contained=+mingw
11+
12+
fn main() {}
13+
14+
//[crto]~? ERROR only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
15+
//[libc]~? ERROR only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
16+
//[unwind]~? ERROR only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
17+
//[sanitizers]~? ERROR only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
18+
//[mingw]~? ERROR only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: only `-C link-self-contained` values `y`/`yes`/`on`/`n`/`no`/`off`/`-linker`/`+linker` are stable, the `-Z unstable-options` flag must also be passed to use the unstable values
2+

tests/ui/linking/linker-features-lld-disallowed-target.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66

77
#![feature(no_core)]
88
#![no_core]
9+
10+
//~? ERROR `-C linker-features` with lld are unstable for the `x86_64-unknown-linux-musl` target, the `-Z unstable-options` flag must also be passed to use it on this target
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: `-C linker-features` with lld are unstable for the `x86_64-unknown-linux-musl target, ` the `-Z unstable-options` flag must also be passed to use it on this target
1+
error: `-C linker-features` with lld are unstable for the `x86_64-unknown-linux-musl` target, the `-Z unstable-options` flag must also be passed to use it on this target
22

tests/ui/linking/linker-features-unstable-cc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66

77
#![feature(no_core)]
88
#![no_core]
9+
10+
//~? ERROR incorrect value `+cc` for codegen option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

0 commit comments

Comments
 (0)