From a8ee1f3a4f6ee7f788ad53e28e2945e0cb7a1cce Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 8 Apr 2022 18:20:57 +0300 Subject: [PATCH] Stabilize the `bundle` native library modifier --- compiler/rustc_codegen_ssa/src/back/link.rs | 4 +-- .../src/error_codes/E0060.md | 4 +-- compiler/rustc_feature/src/accepted.rs | 2 ++ compiler/rustc_feature/src/active.rs | 4 --- compiler/rustc_feature/src/removed.rs | 3 ++ compiler/rustc_metadata/src/native_libs.rs | 19 ------------ compiler/rustc_session/src/config.rs | 20 +------------ library/unwind/src/lib.rs | 2 +- src/doc/rustc/src/command-line-arguments.md | 20 +++++++++++++ .../native-link-modifiers-bundle.md | 19 ------------ .../static-nobundle/Makefile | 23 --------------- .../run-make-fulldeps/static-nobundle/bbb.rs | 13 --------- .../run-make-fulldeps/static-nobundle/ccc.rs | 13 --------- .../run-make-fulldeps/static-nobundle/ddd.rs | 7 ----- src/test/run-make-fulldeps/tools.mk | 2 +- .../native-link-modifier-bundle/Makefile | 29 +++++++++++++++++++ .../native-link-modifier-bundle/bundled.rs | 11 +++++++ .../cdylib-bundled.rs | 1 + .../cdylib-non-bundled.rs | 1 + .../native-staticlib.c} | 0 .../non-bundled.rs | 11 +++++++ .../Makefile | 4 +-- .../native_lib_in_src.rs | 2 -- ...ure-gate-native_link_modifiers_bundle-2.rs | 9 ------ ...ure-gate-native_link_modifiers_bundle-3.rs | 3 -- ...gate-native_link_modifiers_bundle-3.stderr | 2 -- ...ature-gate-native_link_modifiers_bundle.rs | 5 ---- ...e-gate-native_link_modifiers_bundle.stderr | 12 -------- .../feature-gate-static-nobundle-2.rs | 4 --- .../feature-gate-static-nobundle-2.stderr | 2 -- .../feature-gate-static-nobundle.rs | 6 ---- .../feature-gate-static-nobundle.stderr | 18 ------------ .../mix-bundle-and-whole-archive-link-attr.rs | 2 -- .../modifiers-override.rs | 2 -- .../modifiers-override.stderr | 8 ++--- 35 files changed, 91 insertions(+), 196 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md delete mode 100644 src/test/run-make-fulldeps/static-nobundle/Makefile delete mode 100644 src/test/run-make-fulldeps/static-nobundle/bbb.rs delete mode 100644 src/test/run-make-fulldeps/static-nobundle/ccc.rs delete mode 100644 src/test/run-make-fulldeps/static-nobundle/ddd.rs create mode 100644 src/test/run-make/native-link-modifier-bundle/Makefile create mode 100644 src/test/run-make/native-link-modifier-bundle/bundled.rs create mode 100644 src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs create mode 100644 src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs rename src/test/{run-make-fulldeps/static-nobundle/aaa.c => run-make/native-link-modifier-bundle/native-staticlib.c} (100%) create mode 100644 src/test/run-make/native-link-modifier-bundle/non-bundled.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-static-nobundle.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-static-nobundle.stderr diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index fc30679be03cb..1f5e2b76bf0dc 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1952,7 +1952,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>( add_local_native_libraries(cmd, sess, codegen_results); } - // Upstream rust libraries and their nobundle static libraries + // Upstream rust libraries and their non-bundled static libraries add_upstream_rust_crates::(cmd, sess, codegen_results, crate_type, tmpdir); // Upstream dynamic native libraries linked with `#[link]` attributes at and `-l` @@ -2237,7 +2237,7 @@ fn add_local_native_libraries( } } -/// # Linking Rust crates and their nobundle static libraries +/// # Linking Rust crates and their non-bundled static libraries /// /// Rust crates are not considered at all when creating an rlib output. All dependencies will be /// linked when producing the final output (instead of the intermediate rlib version). diff --git a/compiler/rustc_error_codes/src/error_codes/E0060.md b/compiler/rustc_error_codes/src/error_codes/E0060.md index e6906d72367d8..54b10c886ccce 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0060.md +++ b/compiler/rustc_error_codes/src/error_codes/E0060.md @@ -16,10 +16,10 @@ Using this declaration, it must be called with at least one argument, so simply calling `printf()` is invalid. But the following uses are allowed: ``` -# #![feature(static_nobundle)] # use std::os::raw::{c_char, c_int}; # #[cfg_attr(all(windows, target_env = "msvc"), -# link(name = "legacy_stdio_definitions", kind = "static-nobundle"))] +# link(name = "legacy_stdio_definitions", +# kind = "static", modifiers = "-bundle"))] # extern "C" { fn printf(_: *const c_char, ...) -> c_int; } # fn main() { unsafe { diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 071e88e07fd1e..0abd45c621d24 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -219,6 +219,8 @@ declare_features! ( (accepted, move_ref_pattern, "1.49.0", Some(68354), None), /// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]` (accepted, native_link_modifiers, "1.61.0", Some(81490), None), + /// Allows specifying the bundle link modifier + (accepted, native_link_modifiers_bundle, "1.63.0", Some(81490), None), /// Allows specifying the whole-archive link modifier (accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490), None), /// Allows using non lexical lifetimes (RFC 2094). diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 1803f665013ad..1798bf8d42823 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -451,8 +451,6 @@ declare_features! ( (active, naked_functions, "1.9.0", Some(32408), None), /// Allows specifying the as-needed link modifier (active, native_link_modifiers_as_needed, "1.53.0", Some(81490), None), - /// Allows specifying the bundle link modifier - (active, native_link_modifiers_bundle, "1.53.0", Some(81490), None), /// Allows specifying the verbatim link modifier (active, native_link_modifiers_verbatim, "1.53.0", Some(81490), None), /// Allow negative trait implementations. @@ -502,8 +500,6 @@ declare_features! ( (active, simd_ffi, "1.0.0", Some(27731), None), /// Allows specialization of implementations (RFC 1210). (incomplete, specialization, "1.7.0", Some(31844), None), - /// Allows `#[link(kind="static-nobundle"...)]`. - (active, static_nobundle, "1.16.0", Some(37403), None), /// Allows attributes on expressions and non-item statements. (active, stmt_expr_attributes, "1.6.0", Some(15701), None), /// Allows lints part of the strict provenance effort. diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index b546662dc1496..7194416cd1d60 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -169,6 +169,9 @@ declare_features! ( (removed, sanitizer_runtime, "1.17.0", None, None, None), (removed, simd, "1.0.0", Some(27731), None, Some("removed in favor of `#[repr(simd)]`")), + /// Allows `#[link(kind = "static-nobundle", ...)]`. + (removed, static_nobundle, "1.16.0", Some(37403), None, + Some(r#"subsumed by `#[link(kind = "static", modifiers = "-bundle", ...)]`"#)), (removed, struct_inherit, "1.0.0", None, None, None), (removed, test_removed_feature, "1.0.0", None, None, None), /// Allows using items which are missing stability attributes diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 95892d8341479..c33219e470050 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -97,24 +97,6 @@ impl<'tcx> Collector<'tcx> { let span = item.name_value_literal_span().unwrap(); let link_kind = match link_kind.as_str() { "static" => NativeLibKind::Static { bundle: None, whole_archive: None }, - "static-nobundle" => { - sess.struct_span_warn( - span, - "link kind `static-nobundle` has been superseded by specifying \ - modifier `-bundle` with link kind `static`", - ) - .emit(); - if !features.static_nobundle { - feature_err( - &sess.parse_sess, - sym::static_nobundle, - span, - "link kind `static-nobundle` is unstable", - ) - .emit(); - } - NativeLibKind::Static { bundle: Some(false), whole_archive: None } - } "dylib" => NativeLibKind::Dylib { as_needed: None }, "framework" => { if !sess.target.is_like_osx { @@ -264,7 +246,6 @@ impl<'tcx> Collector<'tcx> { }; match (modifier, &mut kind) { ("bundle", Some(NativeLibKind::Static { bundle, .. })) => { - report_unstable_modifier!(native_link_modifiers_bundle); assign_modifier(bundle) } ("bundle", _) => { diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index cabaf321f80c3..c4a67006504fd 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1920,21 +1920,6 @@ fn parse_native_lib_kind( let kind = match kind { "static" => NativeLibKind::Static { bundle: None, whole_archive: None }, - "static-nobundle" => { - early_warn( - error_format, - "library kind `static-nobundle` has been superseded by specifying \ - modifier `-bundle` with library kind `static`. Try `static:-bundle`", - ); - if !nightly_options::match_is_nightly_build(matches) { - early_error( - error_format, - "library kind `static-nobundle` is unstable \ - and only accepted on the nightly compiler", - ); - } - NativeLibKind::Static { bundle: Some(false), whole_archive: None } - } "dylib" => NativeLibKind::Dylib { as_needed: None }, "framework" => NativeLibKind::Framework { as_needed: None }, _ => early_error( @@ -1987,10 +1972,7 @@ fn parse_native_lib_modifiers( } }; match (modifier, &mut kind) { - ("bundle", NativeLibKind::Static { bundle, .. }) => { - report_unstable_modifier(); - assign_modifier(bundle) - } + ("bundle", NativeLibKind::Static { bundle, .. }) => assign_modifier(bundle), ("bundle", _) => early_error( error_format, "linking modifier `bundle` is only compatible with `static` linking kind", diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 15254bc755bea..52d737de7aef8 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] #![feature(link_cfg)] -#![feature(native_link_modifiers_bundle)] +#![cfg_attr(bootstrap, feature(native_link_modifiers_bundle))] #![feature(staged_api)] #![feature(c_unwind)] #![feature(cfg_target_abi)] diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 73e7764a11d37..bc04dfd4433f6 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -84,6 +84,26 @@ The default for this modifier is `-whole-archive`. \ NOTE: The default may currently be different in some cases for backward compatibility, but it is not guaranteed. If you need whole archive semantics use `+whole-archive` explicitly. +### Linking modifiers: `bundle` + +This modifier is only compatible with the `static` linking kind. +Using any other kind will result in a compiler error. + +When building a rlib or staticlib `+bundle` means that all object files from the native static +library will be added to the rlib or staticlib archive, and then used from it during linking of +the final binary. + +When building a rlib `-bundle` means that the native static library is registered as a dependency +of that rlib "by name", and object files from it are included only during linking of the final +binary, the file search by that name is also performed during final linking. \ +When building a staticlib `-bundle` means that the native static library is simply not included +into the archive and some higher level build system will need to add it later during linking of +the final binary. + +This modifier has no effect when building other targets like executables or dynamic libraries. + +The default for this modifier is `+bundle`. + ## `--crate-type`: a list of types of crates for the compiler to emit diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md deleted file mode 100644 index ac192cff13a3d..0000000000000 --- a/src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md +++ /dev/null @@ -1,19 +0,0 @@ -# `native_link_modifiers_bundle` - -The tracking issue for this feature is: [#81490] - -[#81490]: https://github.com/rust-lang/rust/issues/81490 - ------------------------- - -The `native_link_modifiers_bundle` feature allows you to use the `bundle` modifier. - -Only compatible with the `static` linking kind. Using any other kind will result in a compiler error. - -`+bundle` means objects from the static library are bundled into the produced crate (a rlib, for example) and are used from this crate later during linking of the final binary. - -`-bundle` means the static library is included into the produced rlib "by name" and object files from it are included only during linking of the final binary, the file search by that name is also performed during final linking. - -This modifier is supposed to supersede the `static-nobundle` linking kind defined by [RFC 1717](https://github.com/rust-lang/rfcs/pull/1717). - -The default for this modifier is currently `+bundle`, but it could be changed later on some future edition boundary. diff --git a/src/test/run-make-fulldeps/static-nobundle/Makefile b/src/test/run-make-fulldeps/static-nobundle/Makefile deleted file mode 100644 index 001081798a6e4..0000000000000 --- a/src/test/run-make-fulldeps/static-nobundle/Makefile +++ /dev/null @@ -1,23 +0,0 @@ --include ../tools.mk - -# aaa is a native static library -# bbb is a rlib -# ccc is a dylib -# ddd is an executable - -all: $(call NATIVE_STATICLIB,aaa) - $(RUSTC) bbb.rs --crate-type=rlib - - # Check that bbb does NOT contain the definition of `native_func` - # We're using the llvm-nm instead of the system nm to ensure it - # is compatible with the LLVM bitcode generated by rustc. - "$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbbb.rlib | $(CGREP) -ve "T _*native_func" - "$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbbb.rlib | $(CGREP) -e "U _*native_func" - - # Check that aaa gets linked (either as `-l aaa` or `aaa.lib`) when building ccc. - $(RUSTC) ccc.rs -C prefer-dynamic --crate-type=dylib --print link-args | $(CGREP) -e '-l[" ]*aaa|aaa\.lib' - - # Check that aaa does NOT get linked when building ddd. - $(RUSTC) ddd.rs --print link-args | $(CGREP) -ve '-l[" ]*aaa|aaa\.lib' - - $(call RUN,ddd) diff --git a/src/test/run-make-fulldeps/static-nobundle/bbb.rs b/src/test/run-make-fulldeps/static-nobundle/bbb.rs deleted file mode 100644 index 69d1668d4f643..0000000000000 --- a/src/test/run-make-fulldeps/static-nobundle/bbb.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "rlib"] -#![feature(static_nobundle)] - -#[link(name = "aaa", kind = "static-nobundle")] -extern "C" { - pub fn native_func(); -} - -pub fn wrapped_func() { - unsafe { - native_func(); - } -} diff --git a/src/test/run-make-fulldeps/static-nobundle/ccc.rs b/src/test/run-make-fulldeps/static-nobundle/ccc.rs deleted file mode 100644 index a1f875a52d514..0000000000000 --- a/src/test/run-make-fulldeps/static-nobundle/ccc.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "dylib"] - -extern crate bbb; - -pub fn do_work() { - unsafe { bbb::native_func(); } - bbb::wrapped_func(); -} - -pub fn do_work_generic() { - unsafe { bbb::native_func(); } - bbb::wrapped_func(); -} diff --git a/src/test/run-make-fulldeps/static-nobundle/ddd.rs b/src/test/run-make-fulldeps/static-nobundle/ddd.rs deleted file mode 100644 index 50b41211ff02b..0000000000000 --- a/src/test/run-make-fulldeps/static-nobundle/ddd.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate ccc; - -fn main() { - ccc::do_work(); - ccc::do_work_generic::(); - ccc::do_work_generic::(); -} diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk index 9655d09df0f2a..a14f6e3ab95a5 100644 --- a/src/test/run-make-fulldeps/tools.mk +++ b/src/test/run-make-fulldeps/tools.mk @@ -120,7 +120,7 @@ else # So we end up with the following hack: we link use static:-bundle to only # link the parts of libstdc++ that we actually use, which doesn't include # the dependency on the pthreads DLL. - EXTRARSCXXFLAGS := -l static:-bundle=stdc++ -Z unstable-options + EXTRARSCXXFLAGS := -l static:-bundle=stdc++ endif else ifeq ($(UNAME),Darwin) diff --git a/src/test/run-make/native-link-modifier-bundle/Makefile b/src/test/run-make/native-link-modifier-bundle/Makefile new file mode 100644 index 0000000000000..723bb4689fe40 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/Makefile @@ -0,0 +1,29 @@ +# ignore-cross-compile +# ignore-windows-msvc + +-include ../../run-make-fulldeps/tools.mk + +all: $(call NATIVE_STATICLIB,native-staticlib) + # Build a staticlib and a rlib, the `native_func` symbol will be bundled into them + $(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib + nm $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func" + nm $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func" + nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func" + nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func" + + # Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it + $(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib + nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func" + nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func" + nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func" + nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func" + + # Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously + # The cdylib will contain the `native_func` symbol in the end + $(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib' + nm $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func" + + # Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously + # The cdylib will contain the `native_func` symbol in the end + $(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib' + nm $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func" diff --git a/src/test/run-make/native-link-modifier-bundle/bundled.rs b/src/test/run-make/native-link-modifier-bundle/bundled.rs new file mode 100644 index 0000000000000..0bbae8752d7b3 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/bundled.rs @@ -0,0 +1,11 @@ +#[link(name = "native-staticlib", kind = "static", modifiers = "+bundle")] +extern "C" { + pub fn native_func(); +} + +#[no_mangle] +pub extern "C" fn wrapped_func() { + unsafe { + native_func(); + } +} diff --git a/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs b/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs new file mode 100644 index 0000000000000..7291309168a48 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs @@ -0,0 +1 @@ +extern crate bundled; diff --git a/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs b/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs new file mode 100644 index 0000000000000..1df81fd101f75 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs @@ -0,0 +1 @@ +extern crate non_bundled; diff --git a/src/test/run-make-fulldeps/static-nobundle/aaa.c b/src/test/run-make/native-link-modifier-bundle/native-staticlib.c similarity index 100% rename from src/test/run-make-fulldeps/static-nobundle/aaa.c rename to src/test/run-make/native-link-modifier-bundle/native-staticlib.c diff --git a/src/test/run-make/native-link-modifier-bundle/non-bundled.rs b/src/test/run-make/native-link-modifier-bundle/non-bundled.rs new file mode 100644 index 0000000000000..8181e6387c5c7 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/non-bundled.rs @@ -0,0 +1,11 @@ +#[link(name = "native-staticlib", kind = "static", modifiers = "-bundle")] +extern "C" { + pub fn native_func(); +} + +#[no_mangle] +pub extern "C" fn wrapped_func() { + unsafe { + native_func(); + } +} diff --git a/src/test/run-make/native-link-modifier-whole-archive/Makefile b/src/test/run-make/native-link-modifier-whole-archive/Makefile index 799b5f6f5fc6f..3b49d1188ae6b 100644 --- a/src/test/run-make/native-link-modifier-whole-archive/Makefile +++ b/src/test/run-make/native-link-modifier-whole-archive/Makefile @@ -17,7 +17,7 @@ all: $(TMPDIR)/$(call BIN,directly_linked) $(TMPDIR)/$(call BIN,indirectly_linke # Native lib linked directly into executable $(TMPDIR)/$(call BIN,directly_linked): $(call NATIVE_STATICLIB,c_static_lib_with_constructor) - $(RUSTC) directly_linked.rs -Z unstable-options -l static:+whole-archive=c_static_lib_with_constructor + $(RUSTC) directly_linked.rs -l static:+whole-archive=c_static_lib_with_constructor # Native lib linked into RLIB via `-l static:-bundle,+whole-archive`, RLIB linked into executable $(TMPDIR)/$(call BIN,indirectly_linked): $(TMPDIR)/librlib_with_cmdline_native_lib.rlib @@ -29,7 +29,7 @@ $(TMPDIR)/$(call BIN,indirectly_linked_via_attr): $(TMPDIR)/libnative_lib_in_src # Native lib linked into rlib with via commandline $(TMPDIR)/librlib_with_cmdline_native_lib.rlib: $(call NATIVE_STATICLIB,c_static_lib_with_constructor) - $(RUSTC) rlib_with_cmdline_native_lib.rs -Z unstable-options --crate-type=rlib -l static:-bundle,+whole-archive=c_static_lib_with_constructor + $(RUSTC) rlib_with_cmdline_native_lib.rs --crate-type=rlib -l static:-bundle,+whole-archive=c_static_lib_with_constructor # Native lib linked into rlib via `#[link()]` attribute on extern block. $(TMPDIR)/libnative_lib_in_src.rlib: $(call NATIVE_STATICLIB,c_static_lib_with_constructor) diff --git a/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs b/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs index 2436c36e6ebfb..971f3be7a61e9 100644 --- a/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs +++ b/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs @@ -1,5 +1,3 @@ -#![feature(native_link_modifiers_bundle)] - use std::io::Write; #[link(name = "c_static_lib_with_constructor", 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 deleted file mode 100644 index e229564950fcf..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Test native_link_modifiers_bundle don't need static-nobundle -// check-pass - -#![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 deleted file mode 100644 index 3da943ee4a963..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index 743bcc9a1b381..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: linking modifier `bundle` is unstable and only accepted on the nightly compiler - diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs deleted file mode 100644 index c1d5a31aaa4df..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[link(name = "foo", kind = "static", modifiers = "+bundle")] -//~^ ERROR: linking modifier `bundle` is unstable -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr deleted file mode 100644 index dcaa7fcc64f02..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: linking modifier `bundle` is unstable - --> $DIR/feature-gate-native_link_modifiers_bundle.rs:1:51 - | -LL | #[link(name = "foo", kind = "static", modifiers = "+bundle")] - | ^^^^^^^^^ - | - = note: see issue #81490 for more information - = help: add `#![feature(native_link_modifiers_bundle)]` 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-2.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs deleted file mode 100644 index ad0662b6892d2..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs +++ /dev/null @@ -1,4 +0,0 @@ -// 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 deleted file mode 100644 index 782d9e3945615..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -warning: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static`. Try `static:-bundle` - diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs deleted file mode 100644 index 50f1b7ff3fc48..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[link(name = "foo", kind = "static-nobundle")] -//~^ WARNING: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static` -//~^^ ERROR: link kind `static-nobundle` is unstable -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr deleted file mode 100644 index 094661aeb57af..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static` - --> $DIR/feature-gate-static-nobundle.rs:1:29 - | -LL | #[link(name = "foo", kind = "static-nobundle")] - | ^^^^^^^^^^^^^^^^^ - -error[E0658]: link kind `static-nobundle` is unstable - --> $DIR/feature-gate-static-nobundle.rs:1:29 - | -LL | #[link(name = "foo", kind = "static-nobundle")] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #37403 for more information - = help: add `#![feature(static_nobundle)]` to the crate attributes to enable - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs index b153ef94626a3..066048795c8a2 100644 --- a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs +++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs @@ -2,8 +2,6 @@ // build-fail // error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs -#![feature(native_link_modifiers_bundle)] - #[link(name = "mylib", kind = "static", modifiers = "+bundle,+whole-archive")] extern "C" { } diff --git a/src/test/ui/native-library-link-flags/modifiers-override.rs b/src/test/ui/native-library-link-flags/modifiers-override.rs index 3912ac9f13d6c..42cdb5004adcb 100644 --- a/src/test/ui/native-library-link-flags/modifiers-override.rs +++ b/src/test/ui/native-library-link-flags/modifiers-override.rs @@ -1,7 +1,5 @@ // compile-flags:-ldylib:+as-needed=foo -lstatic=bar -Zunstable-options -#![feature(native_link_modifiers_bundle)] - #[link(name = "foo")] #[link( name = "bar", diff --git a/src/test/ui/native-library-link-flags/modifiers-override.stderr b/src/test/ui/native-library-link-flags/modifiers-override.stderr index 55362910e71c6..eb3ab55c31044 100644 --- a/src/test/ui/native-library-link-flags/modifiers-override.stderr +++ b/src/test/ui/native-library-link-flags/modifiers-override.stderr @@ -1,23 +1,23 @@ error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/modifiers-override.rs:11:5 + --> $DIR/modifiers-override.rs:9:5 | LL | modifiers = "+bundle" | ^^^^^^^^^^^^^^^^^^^^^ error: multiple `whole-archive` modifiers in a single `modifiers` argument - --> $DIR/modifiers-override.rs:9:17 + --> $DIR/modifiers-override.rs:7:17 | LL | modifiers = "+whole-archive,-whole-archive", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:14:1 + --> $DIR/modifiers-override.rs:12:1 | LL | extern "C" {} | ^^^^^^^^^^^^^ error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:14:1 + --> $DIR/modifiers-override.rs:12:1 | LL | extern "C" {} | ^^^^^^^^^^^^^