Skip to content
Open
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
1 change: 0 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub(crate) mod macro_attrs;
pub(crate) mod must_not_suspend;
pub(crate) mod must_use;
pub(crate) mod no_implicit_prelude;
pub(crate) mod no_link;
pub(crate) mod non_exhaustive;
pub(crate) mod path;
pub(crate) mod pin_v2;
Expand Down
14 changes: 0 additions & 14 deletions compiler/rustc_attr_parsing/src/attributes/no_link.rs

This file was deleted.

2 changes: 0 additions & 2 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use crate::attributes::macro_attrs::*;
use crate::attributes::must_not_suspend::*;
use crate::attributes::must_use::*;
use crate::attributes::no_implicit_prelude::*;
use crate::attributes::no_link::*;
use crate::attributes::non_exhaustive::*;
use crate::attributes::path::PathParser as PathAttributeParser;
use crate::attributes::pin_v2::*;
Expand Down Expand Up @@ -252,7 +251,6 @@ attribute_parsers!(
Single<WithoutArgs<NoBuiltinsParser>>,
Single<WithoutArgs<NoCoreParser>>,
Single<WithoutArgs<NoImplicitPreludeParser>>,
Single<WithoutArgs<NoLinkParser>>,
Single<WithoutArgs<NoMainParser>>,
Single<WithoutArgs<NoMangleParser>>,
Single<WithoutArgs<NoStdParser>>,
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 @@ -628,11 +628,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"),
FutureWarnPreceding, EncodeCrossCrate::Yes
),
ungated!(
no_link, Normal,
template!(Word, "https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
repr, Normal,
template!(
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,6 @@ pub enum AttributeKind {
/// Represents `#[no_implicit_prelude]`
NoImplicitPrelude(Span),

/// Represents `#[no_link]`
NoLink,

/// Represents `#[no_main]`
NoMain,

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl AttributeKind {
NoBuiltins => Yes,
NoCore(..) => No,
NoImplicitPrelude(..) => No,
NoLink => No,
NoMain => No,
NoMangle(..) => Yes, // Needed for rustdoc
NoStd(..) => No,
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,11 +1283,7 @@ impl CStore {
}
None => ident.name,
};
let dep_kind = if attr::contains_name(&item.attrs, sym::no_link) {
CrateDepKind::MacrosOnly
} else {
CrateDepKind::Unconditional
};
let dep_kind = CrateDepKind::Unconditional;

let cnum =
self.resolve_crate(tcx, name, item.span, dep_kind, CrateOrigin::Extern)?;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| AttributeKind::NoBuiltins
| AttributeKind::NoCore { .. }
| AttributeKind::NoImplicitPrelude(..)
| AttributeKind::NoLink
| AttributeKind::NoMain
| AttributeKind::NoMangle(..)
| AttributeKind::NoStd { .. }
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/clippy_lints/src/empty_line_after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ impl Stop {
sym::must_use |
// Should be applied to a foreign function or static
sym::link_name | sym::link_ordinal | sym::link_section |
// Should be applied to an `extern crate` item
sym::no_link |
// Should be applied to a free function, impl method or static
sym::export_name | sym::no_mangle |
// Should be applied to a `static` variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
DuplicatesOk,
),
ungated!(link_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
ungated!(no_link, Normal, template!(Word), WarnFollowing),
ungated!(repr, Normal, template!(List: "C"), DuplicatesOk, @only_local: true),
ungated!(export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
ungated!(link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static KIND_TO_ATTRIBUTES: LazyLock<FxHashMap<SyntaxKind, &[&str]>> = LazyLock::
(ITEM_LIST, attrs!(item, "no_implicit_prelude")),
(MACRO_RULES, attrs!(item, "macro_export", "macro_use")),
(MACRO_DEF, attrs!(item)),
(EXTERN_CRATE, attrs!(item, "macro_use", "no_link")),
(EXTERN_CRATE, attrs!(item, "macro_use")),
(USE, attrs!(item)),
(TYPE_ALIAS, attrs!(item)),
(STRUCT, attrs!(item, adt, "non_exhaustive")),
Expand Down Expand Up @@ -368,7 +368,6 @@ const ATTRIBUTES: &[AttrCompletion] = &[
attr("macro_use", None, None),
attr(r#"must_use"#, Some("must_use"), Some(r#"must_use"#)),
attr("no_implicit_prelude", None, None).prefer_inner(),
attr("no_link", None, None).prefer_inner(),
attr("no_main", None, None).prefer_inner(),
attr("no_mangle", None, None),
attr("no_std", None, None).prefer_inner(),
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rustfmt/tests/target/issue_4573.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
// post inner attribute comment

#[cfg(not(miri))] // inline comment
#[no_link]
#[cfg(true)]
extern crate foo;

// before attributes
#[no_link]
#[cfg(true)]
// between attributes
#[cfg(not(miri))] // inline comment
extern crate foo as bar;
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/attributes/malformed-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ enum Slenum {
//~^ ERROR malformed
static mut TLS: u8 = 42;

#[no_link()]
//~^ ERROR malformed
#[macro_use = 1]
//~^ ERROR malformed
extern crate wloop;
Expand Down
25 changes: 8 additions & 17 deletions tests/ui/attributes/malformed-attrs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LL | #[cfg_attr]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

error[E0463]: can't find crate for `wloop`
--> $DIR/malformed-attrs.rs:214:1
--> $DIR/malformed-attrs.rs:212:1
|
LL | extern crate wloop;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
Expand Down Expand Up @@ -125,7 +125,7 @@ LL | #[proc_macro_derive]
| ^^^^^^^^^^^^^^^^^^^^

error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
--> $DIR/malformed-attrs.rs:219:1
--> $DIR/malformed-attrs.rs:217:1
|
LL | #[allow_internal_unsafe = 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -631,17 +631,8 @@ LL | #[thread_local()]
| | didn't expect any arguments here
| help: must be of the form: `#[thread_local]`

error[E0565]: malformed `no_link` attribute input
--> $DIR/malformed-attrs.rs:210:1
|
LL | #[no_link()]
| ^^^^^^^^^--^
| | |
| | didn't expect any arguments here
| help: must be of the form: `#[no_link]`

error[E0539]: malformed `macro_use` attribute input
--> $DIR/malformed-attrs.rs:212:1
--> $DIR/malformed-attrs.rs:210:1
|
LL | #[macro_use = 1]
| ^^^^^^^^^^^^---^
Expand All @@ -659,7 +650,7 @@ LL + #[macro_use]
|

error[E0539]: malformed `macro_export` attribute input
--> $DIR/malformed-attrs.rs:217:1
--> $DIR/malformed-attrs.rs:215:1
|
LL | #[macro_export = 18]
| ^^^^^^^^^^^^^^^----^
Expand All @@ -676,7 +667,7 @@ LL + #[macro_export]
|

error[E0565]: malformed `allow_internal_unsafe` attribute input
--> $DIR/malformed-attrs.rs:219:1
--> $DIR/malformed-attrs.rs:217:1
|
LL | #[allow_internal_unsafe = 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^---^
Expand Down Expand Up @@ -826,7 +817,7 @@ LL | #[automatically_derived = 18]
= help: `#[automatically_derived]` can only be applied to trait impl blocks

error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:226:1
--> $DIR/malformed-attrs.rs:224:1
|
LL | #[ignore = 1]
| ^^^^^^^^^^^^^
Expand All @@ -845,7 +836,7 @@ LL | #[coroutine = 63] || {}
= note: expected unit type `()`
found coroutine `{coroutine@$DIR/malformed-attrs.rs:115:23: 115:25}`

error: aborting due to 75 previous errors; 8 warnings emitted
error: aborting due to 74 previous errors; 8 warnings emitted

Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
For more information about an error, try `rustc --explain E0308`.
Expand Down Expand Up @@ -873,7 +864,7 @@ LL | #[ignore()]

Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:226:1
--> $DIR/malformed-attrs.rs:224:1
|
LL | #[ignore = 1]
| ^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/attributes/no_link/auxiliary/no_link-crate.rs

This file was deleted.

17 changes: 0 additions & 17 deletions tests/ui/attributes/no_link/multiple-crates-and-no_link.rs

This file was deleted.

19 changes: 0 additions & 19 deletions tests/ui/attributes/no_link/no-link-unknown-crate.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/attributes/no_link/no-link-unknown-crate.stderr

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/empty/no-link.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
//~| NOTE requested on the command line
//~| WARN cannot be used on crates
//~| WARN previously accepted
#![no_link]
//~^ ERROR: `#[no_link]` attribute cannot be used on crates
#![export_name = "2200"]
//~^ ERROR: attribute cannot be used on
//~| NOTE takes precedence
Expand Down Expand Up @@ -58,43 +56,6 @@ mod inline {
//~^ ERROR attribute cannot be used on
}

#[no_link]
//~^ ERROR `#[no_link]` attribute cannot be used on modules
mod no_link {
mod inner { #![no_link] }
//~^ ERROR `#[no_link]` attribute cannot be used on modules

#[no_link] fn f() {
//~^ ERROR `#[no_link]` attribute cannot be used on functions
match () {
#[no_link]
//~^ WARN `#[no_link]` attribute cannot be used on match arms [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
_ => ()
}
}

#[no_link]
//~^ ERROR `#[no_link]` attribute cannot be used on structs
struct S {
#[no_link]
//~^ WARN `#[no_link]` attribute cannot be used on struct fields [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
field: ()
}

#[no_link]type T = S;
//~^ ERROR `#[no_link]` attribute cannot be used on type aliases

#[no_link] impl S { }
//~^ ERROR `#[no_link]` attribute cannot be used on inherent impl blocks

#[no_link]
//~^ WARN `#[no_link]` attribute cannot be used on macro defs
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
macro_rules! m{() => {}}
}

#[export_name = "2200"]
//~^ ERROR attribute cannot be used on
mod export_name {
Expand Down
Loading
Loading