diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 0d328d5cc6a70..00419cdd7464c 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -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; diff --git a/compiler/rustc_attr_parsing/src/attributes/no_link.rs b/compiler/rustc_attr_parsing/src/attributes/no_link.rs deleted file mode 100644 index 43cd1c5406e98..0000000000000 --- a/compiler/rustc_attr_parsing/src/attributes/no_link.rs +++ /dev/null @@ -1,14 +0,0 @@ -use super::prelude::*; - -pub(crate) struct NoLinkParser; -impl NoArgsAttributeParser for NoLinkParser { - const PATH: &[Symbol] = &[sym::no_link]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn; - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[ - Allow(Target::ExternCrate), - Warn(Target::Field), - Warn(Target::Arm), - Warn(Target::MacroDef), - ]); - const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoLink; -} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index a0c672778ac12..410bf8797ad99 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -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::*; @@ -252,7 +251,6 @@ attribute_parsers!( Single>, Single>, Single>, - Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index db8f459ef0451..dfec0b345410c 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -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!( diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index b8f3c898ed07f..0c612a2bdc177 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -1024,9 +1024,6 @@ pub enum AttributeKind { /// Represents `#[no_implicit_prelude]` NoImplicitPrelude(Span), - /// Represents `#[no_link]` - NoLink, - /// Represents `#[no_main]` NoMain, diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index 86eafb984121d..c2e385c7817cb 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -72,7 +72,6 @@ impl AttributeKind { NoBuiltins => Yes, NoCore(..) => No, NoImplicitPrelude(..) => No, - NoLink => No, NoMain => No, NoMangle(..) => Yes, // Needed for rustdoc NoStd(..) => No, diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 4000f12459a90..b9944a6a2a0d1 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -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)?; diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 11c9ee9d61aee..a1eae89f3391f 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -273,7 +273,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | AttributeKind::NoBuiltins | AttributeKind::NoCore { .. } | AttributeKind::NoImplicitPrelude(..) - | AttributeKind::NoLink | AttributeKind::NoMain | AttributeKind::NoMangle(..) | AttributeKind::NoStd { .. } diff --git a/src/tools/clippy/clippy_lints/src/empty_line_after.rs b/src/tools/clippy/clippy_lints/src/empty_line_after.rs index 76e67b1154be1..449b0ca53914f 100644 --- a/src/tools/clippy/clippy_lints/src/empty_line_after.rs +++ b/src/tools/clippy/clippy_lints/src/empty_line_after.rs @@ -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 diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs index 6dec2c5b32812..4cd6ce6280c6c 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs @@ -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), diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs index 20776f6c49f69..c8d31f8e67382 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute.rs @@ -276,7 +276,7 @@ static KIND_TO_ATTRIBUTES: LazyLock> = 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")), @@ -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(), diff --git a/src/tools/rustfmt/tests/target/issue_4573.rs b/src/tools/rustfmt/tests/target/issue_4573.rs index 82cfe4f535981..6b6f6c1986514 100644 --- a/src/tools/rustfmt/tests/target/issue_4573.rs +++ b/src/tools/rustfmt/tests/target/issue_4573.rs @@ -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; diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 6193a101918bd..c61b357280b95 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -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; diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 01e70adf4ee99..1b72c7f17ef0a 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -21,7 +21,7 @@ LL | #[cfg_attr] = note: for more information, visit 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 @@ -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] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -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] | ^^^^^^^^^^^^---^ @@ -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] | ^^^^^^^^^^^^^^^----^ @@ -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] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -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] | ^^^^^^^^^^^^^ @@ -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`. @@ -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] | ^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs b/tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs deleted file mode 100644 index 8bd2b3353b8f3..0000000000000 --- a/tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "dylib"] diff --git a/tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs b/tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs deleted file mode 100644 index 1adaf2b0379d2..0000000000000 --- a/tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ no-prefer-dynamic - -#![crate_type = "rlib"] diff --git a/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs b/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs deleted file mode 100644 index 1c3af5431cc6e..0000000000000 --- a/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ no-prefer-dynamic - -#![crate_type = "rlib"] - -#[macro_use] #[no_link] extern crate empty_crate_1 as t1; -#[macro_use] extern crate empty_crate_2 as t2; diff --git a/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs b/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs deleted file mode 100644 index 0e6f1deb21729..0000000000000 --- a/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! Regression test for #13560. Previously, it was possible to -//! trigger an assert in crate numbering if a series of crates -//! being loaded included a "syntax-only" extern crate. -//! But it appears we don't mess with crate numbering for -//! `#[no_link]` crates anymore, so this test doesn't seem -//! to test anything now. - -//@ run-pass -//@ needs-crate-type: dylib -//@ aux-build:empty-crate-1.rs -//@ aux-build:empty-crate-2.rs -//@ aux-build:no_link-crate.rs - -extern crate empty_crate_2 as t2; -extern crate no_link_crate as t3; - -fn main() {} diff --git a/tests/ui/attributes/no_link/no-link-unknown-crate.rs b/tests/ui/attributes/no_link/no-link-unknown-crate.rs deleted file mode 100644 index 3a91fa27ee3ba..0000000000000 --- a/tests/ui/attributes/no_link/no-link-unknown-crate.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Unfortunately the development of `#[phase]` and `#[no_link]` -//! predates Zulip, and thus has been lost in the sands of time. -//! Understanding the true nature of this test has been left as -//! an exercise for the reader. -//! -//! But we guess from the git history that originally this -//! test was supposed to check that we error if we can't find -//! an extern crate annotated with `#[phase(syntax)]`, -//! see `macro-crate-unknown-crate.rs` in -//! . Later, we changed -//! `#[phase]` to `#![feature(plugin)]` and added a `#[no_link]`. -//! -//! I suppose that this now tests that we still error if we can't -//! find a `#[no_link]` extern crate? - -#[no_link] -extern crate doesnt_exist; //~ ERROR can't find crate - -fn main() {} diff --git a/tests/ui/attributes/no_link/no-link-unknown-crate.stderr b/tests/ui/attributes/no_link/no-link-unknown-crate.stderr deleted file mode 100644 index 999b013866cd6..0000000000000 --- a/tests/ui/attributes/no_link/no-link-unknown-crate.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0463]: can't find crate for `doesnt_exist` - --> $DIR/no-link-unknown-crate.rs:17:1 - | -LL | extern crate doesnt_exist; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0463`. diff --git a/tests/ui/empty/no-link.rs b/tests/ui/empty/no-link.rs deleted file mode 100644 index 9f78714b7694a..0000000000000 --- a/tests/ui/empty/no-link.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass -//@ aux-build:empty-struct.rs - -#[no_link] -extern crate empty_struct; - -fn main() { - empty_struct::XEmpty1 {}; -} diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index 1560f2b5f4a77..7ea14f1ebfba8 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs @@ -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 @@ -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 { diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index 662776e580267..30b73950b976a 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -40,16 +40,8 @@ LL | #![automatically_derived] | = help: `#[automatically_derived]` can only be applied to trait impl blocks -error: `#[no_link]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 - | -LL | #![no_link] - | ^^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - error: `#[export_name]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -57,7 +49,7 @@ LL | #![export_name = "2200"] = help: `#[export_name]` can be applied to functions and statics error: `#[inline]` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:35:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:33:1 | LL | #![inline] | ^^^^^^^^^^ @@ -65,7 +57,7 @@ LL | #![inline] = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:37:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:35:1 | LL | #[inline] | ^^^^^^^^^ @@ -73,7 +65,7 @@ LL | #[inline] = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:42:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:17 | LL | mod inner { #![inline] } | ^^^^^^^^^^ @@ -81,7 +73,7 @@ LL | mod inner { #![inline] } = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:51:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:49:5 | LL | #[inline] struct S; | ^^^^^^^^^ @@ -89,7 +81,7 @@ LL | #[inline] struct S; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5 | LL | #[inline] type T = S; | ^^^^^^^^^ @@ -97,63 +89,15 @@ LL | #[inline] type T = S; = help: `#[inline]` can only be applied to functions error: `#[inline]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:57:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:55:5 | LL | #[inline] impl S { } | ^^^^^^^^^ | = help: `#[inline]` can only be applied to functions -error: `#[no_link]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:61:1 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - -error: `#[no_link]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:64:17 - | -LL | mod inner { #![no_link] } - | ^^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - -error: `#[no_link]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:67:5 - | -LL | #[no_link] fn f() { - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - -error: `#[no_link]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:77:5 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - -error: `#[no_link]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:86:5 - | -LL | #[no_link]type T = S; - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - -error: `#[no_link]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:89:5 - | -LL | #[no_link] impl S { } - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - error: `#[export_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:98:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:1 | LL | #[export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -161,7 +105,7 @@ LL | #[export_name = "2200"] = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:101:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:62:17 | LL | mod inner { #![export_name="2200"] } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +113,7 @@ LL | mod inner { #![export_name="2200"] } = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:67:5 | LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -177,7 +121,7 @@ LL | #[export_name = "2200"] struct S; = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:70:5 | LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +129,7 @@ LL | #[export_name = "2200"] type T = S; = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:73:5 | LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +137,7 @@ LL | #[export_name = "2200"] impl S { } = help: `#[export_name]` can be applied to functions and statics error: `#[export_name]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:116:9 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:77:9 | LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -201,7 +145,7 @@ LL | #[export_name = "2200"] fn foo(); = help: `#[export_name]` can be applied to functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:123:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:84:8 | LL | #[repr(C)] | ^ @@ -214,7 +158,7 @@ LL | | } | |_- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:108:8 | LL | #[repr(Rust)] | ^^^^ @@ -233,7 +177,7 @@ LL | #![no_mangle] | ^^^^^^^^^^^^^ `#[no_mangle]` is ignored | note: `#[export_name]` takes precedence - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -259,55 +203,55 @@ LL + #[repr()] | error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:88:25 | LL | mod inner { #![repr(C)] } | --------------------^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:131:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:92:12 | LL | #[repr(C)] fn f() { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:98:12 | LL | #[repr(C)] type T = S; | ^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:12 | LL | #[repr(C)] impl S { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:25 | LL | mod inner { #![repr(Rust)] } | --------------------^^^^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:116:12 | LL | #[repr(Rust)] fn f() { } | ^^^^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:161:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:122:12 | LL | #[repr(Rust)] type T = S; | ^^^^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:165:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:126:12 | LL | #[repr(Rust)] impl S { } | ^^^^ ---------- not a struct, enum, or union error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:45:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ @@ -316,33 +260,6 @@ LL | #[inline = "2100"] fn f() { } = note: for more information, see issue #57571 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default -warning: `#[no_link]` attribute cannot be used on match arms - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:70:13 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_link]` can only be applied to extern crates - -warning: `#[no_link]` attribute cannot be used on struct fields - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:80:9 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_link]` can only be applied to extern crates - -warning: `#[no_link]` attribute cannot be used on macro defs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:92:5 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[no_link]` can only be applied to extern crates - warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1 | @@ -360,13 +277,13 @@ LL | #![no_mangle] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -error: aborting due to 37 previous errors; 6 warnings emitted +error: aborting due to 30 previous errors; 3 warnings emitted Some errors have detailed explanations: E0517, E0658. For more information about an error, try `rustc --explain E0517`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:45:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs index a334c49788cb2..8ca739eb36da9 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.rs +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs @@ -33,8 +33,8 @@ #![no_builtins] #![no_builtins] //~ ERROR unused attribute -#[no_link] -#[no_link] //~ ERROR unused attribute +#[macro_use] +#[macro_use] //~ ERROR unused attribute extern crate lint_unused_extern_crate; #[macro_use] diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index 351645f4a783f..b1ab5c4e7833a 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -19,14 +19,14 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/unused-attr-duplicate.rs:37:1 | -LL | #[no_link] - | ^^^^^^^^^^ help: remove this attribute +LL | #[macro_use] + | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:36:1 | -LL | #[no_link] - | ^^^^^^^^^^ +LL | #[macro_use] + | ^^^^^^^^^^^^ error: unused attribute --> $DIR/unused-attr-duplicate.rs:41:1 diff --git a/tests/ui/macros/macro-crate-def-only.rs b/tests/ui/macros/macro-crate-def-only.rs deleted file mode 100644 index f15394df35765..0000000000000 --- a/tests/ui/macros/macro-crate-def-only.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ aux-build:macro_crate_def_only.rs - - -#[macro_use] #[no_link] -extern crate macro_crate_def_only; - -pub fn main() { - assert_eq!(5, make_a_5!()); -} diff --git a/tests/ui/macros/macro-export-inner-module.rs b/tests/ui/macros/macro-export-inner-module.rs index 6eccc90dc67ec..baf1b7b065262 100644 --- a/tests/ui/macros/macro-export-inner-module.rs +++ b/tests/ui/macros/macro-export-inner-module.rs @@ -1,7 +1,7 @@ //@ run-pass //@aux-build:macro_export_inner_module.rs -#[macro_use] #[no_link] +#[macro_use] extern crate macro_export_inner_module; pub fn main() {