diff options
| author | bors <bors@rust-lang.org> | 2021-08-09 03:59:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-09 03:59:30 +0000 |
| commit | 7b52ad00cb492f65855014b2aab9f2abe9be3324 (patch) | |
| tree | 419c7b35a8898f80f4a3ae488f72fb9983f66970 /src | |
| parent | d3928b183db1023c023f8afb4f5dfbee34994051 (diff) | |
| parent | d935a14f4c766bf3014ad5ab0c55ad087c799adb (diff) | |
Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkov
Fix feature gate checking of static-nobundle and native_link_modifiers Feature native_link_modifiers_bundle don't need feature static-nobundle to work. Also check the feature gates when using native_link_modifiers from command line options. Current nighly compiler don't check those feature gate. ``` > touch lib.rs > rustc +nightly lib.rs -L /usr/lib -l static:+bundle=dl --crate-type=rlib > rustc +nightly lib.rs -L /usr/lib -l dylib:+as-needed=dl --crate-type=dylib -Ctarget-feature=-crt-static > rustc +nightly lib.rs -L /usr/lib -l static:-bundle=dl --crate-type=rlib error[E0658]: kind="static-nobundle" is unstable | = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information = help: add `#![feature(static_nobundle)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. ``` First found this in https://github.com/rust-lang/rust/pull/85600#discussion_r676612655
Diffstat (limited to 'src')
6 files changed, 18 insertions, 13 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs new file mode 100644 index 00000000000..1b5fa78ee55 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs @@ -0,0 +1,10 @@ +// Test native_link_modifiers_bundle don't need static-nobundle +// check-pass + +#![feature(native_link_modifiers)] +#![feature(native_link_modifiers_bundle)] + +#[link(name = "foo", kind = "static", modifiers = "-bundle")] +extern "C" {} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs new file mode 100644 index 00000000000..3da943ee4a9 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs @@ -0,0 +1,3 @@ +// compile-flags: -l static:-bundle=nonexistent + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr new file mode 100644 index 00000000000..86ccb4e860b --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr @@ -0,0 +1,2 @@ +error: linking modifiers are currently unstable, the `-Z unstable-options` flag must also be passed to use it + diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs index b6c8648a7d0..ad0662b6892 100644 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs +++ b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs @@ -1,6 +1,4 @@ -//~ ERROR kind="static-nobundle" is unstable -// Test the behavior of rustc when non-existent library is statically linked - +// check-pass // compile-flags: -l static-nobundle=nonexistent fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr index 301a1e1341e..76c317f7410 100644 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr @@ -1,10 +1,2 @@ warning: library kind `static-nobundle` has been superseded by specifying `-bundle` on library kind `static`. Try `static:-bundle` -error[E0658]: kind="static-nobundle" is unstable - | - = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information - = help: add `#![feature(static_nobundle)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr index 9695618207c..eaf2e0db511 100644 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr +++ b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr @@ -5,10 +5,10 @@ LL | #[link(name = "foo", kind = "static-nobundle")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: kind="static-nobundle" is unstable - --> $DIR/feature-gate-static-nobundle.rs:1:1 + --> $DIR/feature-gate-static-nobundle.rs:1:22 | LL | #[link(name = "foo", kind = "static-nobundle")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information = help: add `#![feature(static_nobundle)]` to the crate attributes to enable |
