Skip to content

Commit 5839bff

Browse files
committed
Remove attribute #[link_args]
1 parent 97717a5 commit 5839bff

File tree

21 files changed

+12
-219
lines changed

21 files changed

+12
-219
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,15 +1411,10 @@ fn add_link_script(cmd: &mut dyn Linker, sess: &Session, tmpdir: &Path, crate_ty
14111411
}
14121412
}
14131413

1414-
/// Add arbitrary "user defined" args defined from command line and by `#[link_args]` attributes.
1414+
/// Add arbitrary "user defined" args defined from command line.
14151415
/// FIXME: Determine where exactly these args need to be inserted.
1416-
fn add_user_defined_link_args(
1417-
cmd: &mut dyn Linker,
1418-
sess: &Session,
1419-
codegen_results: &CodegenResults,
1420-
) {
1416+
fn add_user_defined_link_args(cmd: &mut dyn Linker, sess: &Session) {
14211417
cmd.args(&sess.opts.cg.link_args);
1422-
cmd.args(&*codegen_results.crate_info.link_args);
14231418
}
14241419

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

17631758
// OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT
1764-
add_user_defined_link_args(cmd, sess, codegen_results);
1759+
add_user_defined_link_args(cmd, sess);
17651760

17661761
// NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
17671762
cmd.finalize();

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ impl CrateInfo {
754754
is_no_builtins: Default::default(),
755755
native_libraries: Default::default(),
756756
used_libraries: tcx.native_libraries(LOCAL_CRATE).iter().map(Into::into).collect(),
757-
link_args: tcx.link_args(LOCAL_CRATE),
758757
crate_name: Default::default(),
759758
used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic),
760759
used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic),

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ pub struct CrateInfo {
139139
pub native_libraries: FxHashMap<CrateNum, Vec<NativeLib>>,
140140
pub crate_name: FxHashMap<CrateNum, String>,
141141
pub used_libraries: Vec<NativeLib>,
142-
pub link_args: Lrc<Vec<String>>,
143142
pub used_crate_source: FxHashMap<CrateNum, Lrc<CrateSource>>,
144143
pub used_crates_static: Vec<(CrateNum, LibSource)>,
145144
pub used_crates_dynamic: Vec<(CrateNum, LibSource)>,

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ declare_features! (
258258
// feature-group-start: actual feature gates
259259
// -------------------------------------------------------------------------
260260

261-
/// Allows using the `#[link_args]` attribute.
262-
(active, link_args, "1.0.0", Some(29596), None),
263-
264261
/// Allows defining identifiers beyond ASCII.
265262
(active, non_ascii_idents, "1.0.0", Some(55467), None),
266263

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
279279

280280
// Linking:
281281
gated!(naked, AssumedUsed, template!(Word), naked_functions, experimental!(naked)),
282-
gated!(
283-
link_args, Normal, template!(NameValueStr: "args"),
284-
"the `link_args` attribute is experimental and not portable across platforms, \
285-
it is recommended to use `#[link(name = \"foo\")] instead",
286-
),
287282
gated!(
288283
link_ordinal, AssumedUsed, template!(List: "ordinal"), raw_dylib,
289284
experimental!(link_ordinal)

compiler/rustc_feature/src/removed.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ declare_features! (
128128
/// Allows comparing raw pointers during const eval.
129129
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
130130
Some("cannot be allowed in const eval in any meaningful way")),
131+
/// Allows using the `#[link_args]` attribute.
132+
(removed, link_args, "1.53.0", Some(29596), None,
133+
Some("removed in favor of using `-C link-arg=ARG` on command line, \
134+
which is available from cargo build scripts with `cargo:rustc-link-arg` now")),
131135

132136
// -------------------------------------------------------------------------
133137
// feature-group-end: removed features

compiler/rustc_metadata/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub use rmeta::{provide, provide_extern};
2626

2727
mod dependency_format;
2828
mod foreign_modules;
29-
mod link_args;
3029
mod native_libs;
3130
mod rmeta;
3231

compiler/rustc_metadata/src/link_args.rs

Lines changed: 0 additions & 57 deletions
This file was deleted.

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::creader::{CStore, LoadedMacro};
22
use crate::foreign_modules;
3-
use crate::link_args;
43
use crate::native_libs;
54
use crate::rmeta::{self, encoder};
65

@@ -295,10 +294,6 @@ pub fn provide(providers: &mut Providers) {
295294
foreign_modules::collect(tcx).into_iter().map(|m| (m.def_id, m)).collect();
296295
Lrc::new(modules)
297296
},
298-
link_args: |tcx, cnum| {
299-
assert_eq!(cnum, LOCAL_CRATE);
300-
Lrc::new(link_args::collect(tcx))
301-
},
302297

303298
// Returns a map from a sufficiently visible external item (i.e., an
304299
// external item that is visible from at least one local module) to a

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,11 +1253,6 @@ rustc_queries! {
12531253
desc { |tcx| "native_library_kind({})", tcx.def_path_str(def_id) }
12541254
}
12551255

1256-
query link_args(_: CrateNum) -> Lrc<Vec<String>> {
1257-
eval_always
1258-
desc { "looking up link arguments for a crate" }
1259-
}
1260-
12611256
/// Does lifetime resolution, but does not descend into trait items. This
12621257
/// should only be used for resolving lifetimes of on trait definitions,
12631258
/// and is used to avoid cycles. Importantly, `resolve_lifetimes` still visits

0 commit comments

Comments
 (0)