Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove attribute #[link_args] #83820

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,15 +1411,10 @@ fn add_link_script(cmd: &mut dyn Linker, sess: &Session, tmpdir: &Path, crate_ty
}
}

/// Add arbitrary "user defined" args defined from command line and by `#[link_args]` attributes.
/// Add arbitrary "user defined" args defined from command line.
/// FIXME: Determine where exactly these args need to be inserted.
fn add_user_defined_link_args(
cmd: &mut dyn Linker,
sess: &Session,
codegen_results: &CodegenResults,
) {
fn add_user_defined_link_args(cmd: &mut dyn Linker, sess: &Session) {
cmd.args(&sess.opts.cg.link_args);
cmd.args(&*codegen_results.crate_info.link_args);
}

/// Add arbitrary "late link" args defined by the target spec.
Expand Down Expand Up @@ -1761,7 +1756,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
add_rpath_args(cmd, sess, codegen_results, out_filename);

// OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT
add_user_defined_link_args(cmd, sess, codegen_results);
add_user_defined_link_args(cmd, sess);

// NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
cmd.finalize();
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ impl CrateInfo {
is_no_builtins: Default::default(),
native_libraries: Default::default(),
used_libraries: tcx.native_libraries(LOCAL_CRATE).iter().map(Into::into).collect(),
link_args: tcx.link_args(LOCAL_CRATE),
crate_name: Default::default(),
used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic),
used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ pub struct CrateInfo {
pub native_libraries: FxHashMap<CrateNum, Vec<NativeLib>>,
pub crate_name: FxHashMap<CrateNum, String>,
pub used_libraries: Vec<NativeLib>,
pub link_args: Lrc<Vec<String>>,
pub used_crate_source: FxHashMap<CrateNum, Lrc<CrateSource>>,
pub used_crates_static: Vec<(CrateNum, LibSource)>,
pub used_crates_dynamic: Vec<(CrateNum, LibSource)>,
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ declare_features! (
// feature-group-start: actual feature gates
// -------------------------------------------------------------------------

/// Allows using the `#[link_args]` attribute.
(active, link_args, "1.0.0", Some(29596), None),

/// Allows defining identifiers beyond ASCII.
(active, non_ascii_idents, "1.0.0", Some(55467), None),

Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[

// Linking:
gated!(naked, AssumedUsed, template!(Word), naked_functions, experimental!(naked)),
gated!(
link_args, Normal, template!(NameValueStr: "args"),
"the `link_args` attribute is experimental and not portable across platforms, \
it is recommended to use `#[link(name = \"foo\")] instead",
),
gated!(
link_ordinal, AssumedUsed, template!(List: "ordinal"), raw_dylib,
experimental!(link_ordinal)
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ declare_features! (
/// Allows comparing raw pointers during const eval.
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
Some("cannot be allowed in const eval in any meaningful way")),
/// Allows using the `#[link_args]` attribute.
(removed, link_args, "1.53.0", Some(29596), None,
Some("removed in favor of using `-C link-arg=ARG` on command line, \
which is available from cargo build scripts with `cargo:rustc-link-arg` now")),

// -------------------------------------------------------------------------
// feature-group-end: removed features
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub use rmeta::{provide, provide_extern};

mod dependency_format;
mod foreign_modules;
mod link_args;
mod native_libs;
mod rmeta;

Expand Down
57 changes: 0 additions & 57 deletions compiler/rustc_metadata/src/link_args.rs

This file was deleted.

5 changes: 0 additions & 5 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::creader::{CStore, LoadedMacro};
use crate::foreign_modules;
use crate::link_args;
use crate::native_libs;
use crate::rmeta::{self, encoder};

Expand Down Expand Up @@ -295,10 +294,6 @@ pub fn provide(providers: &mut Providers) {
foreign_modules::collect(tcx).into_iter().map(|m| (m.def_id, m)).collect();
Lrc::new(modules)
},
link_args: |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
Lrc::new(link_args::collect(tcx))
},

// Returns a map from a sufficiently visible external item (i.e., an
// external item that is visible from at least one local module) to a
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,11 +1253,6 @@ rustc_queries! {
desc { |tcx| "native_library_kind({})", tcx.def_path_str(def_id) }
}

query link_args(_: CrateNum) -> Lrc<Vec<String>> {
eval_always
desc { "looking up link arguments for a crate" }
}

/// Does lifetime resolution, but does not descend into trait items. This
/// should only be used for resolving lifetimes of on trait definitions,
/// and is used to avoid cycles. Importantly, `resolve_lifetimes` still visits
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@
#![feature(intra_doc_pointers)]
#![feature(iter_zip)]
#![feature(lang_items)]
#![feature(link_args)]
#![feature(linkage)]
#![feature(llvm_asm)]
#![feature(log_syntax)]
Expand Down
32 changes: 0 additions & 32 deletions src/doc/unstable-book/src/language-features/link-args.md

This file was deleted.

16 changes: 0 additions & 16 deletions src/test/incremental/hashes/extern_mods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#![allow(warnings)]
#![feature(rustc_attrs)]
#![feature(unboxed_closures)]
#![feature(link_args)]
#![crate_type = "rlib"]

// Change function name --------------------------------------------------------
Expand Down Expand Up @@ -146,21 +145,6 @@ extern "C" {
pub fn add_function2();
}

// Change link-args ------------------------------------------------------------
#[cfg(cfail1)]
#[link_args = "-foo -bar"]
extern "C" {
pub fn change_link_args(c: i32);
}

#[cfg(not(cfail1))]
#[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg = "cfail3")]
#[link_args = "-foo -bar -baz"]
extern "C" {
pub fn change_link_args(c: i32);
}

// Change link-name ------------------------------------------------------------
#[cfg(cfail1)]
#[link(name = "foo")]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/link-args-order/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args=
RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f

all:
$(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f" "g"'
$(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"'
$(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"'
5 changes: 0 additions & 5 deletions src/test/run-make-fulldeps/link-args-order/empty.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
#![feature(link_args)]

#[link_args = "g"]
extern "C" {}

fn main() {}
17 changes: 0 additions & 17 deletions src/test/ui/feature-gates/feature-gate-link_args.rs

This file was deleted.

30 changes: 0 additions & 30 deletions src/test/ui/feature-gates/feature-gate-link_args.stderr

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/issues/issue-15487.rs

This file was deleted.

14 changes: 0 additions & 14 deletions src/test/ui/linkage-attr/invalid-link-args.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// compile-flags: -Clink-arg=-nostartfiles
// ignore-macos
// ignore-windows

#![feature(lang_items, link_args, start, libc)]
#![link_args = "-nostartfiles"]
#![feature(lang_items, start, libc)]
#![no_std]

use core::panic::PanicInfo;
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/empty_loop_no_std.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// compile-flags: -Clink-arg=-nostartfiles
// ignore-macos
// ignore-windows

#![warn(clippy::empty_loop)]
#![feature(lang_items, link_args, start, libc)]
#![link_args = "-nostartfiles"]
#![feature(lang_items, start, libc)]
#![no_std]

use core::panic::PanicInfo;
Expand Down