diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 7ea4c7fc6fe73..a87c057e10542 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -58,7 +58,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 d067db5df81e6..0000000000000 --- a/compiler/rustc_attr_parsing/src/attributes/no_link.rs +++ /dev/null @@ -1,17 +0,0 @@ -use rustc_feature::AttributeStability; - -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 STABILITY: AttributeStability = AttributeStability::Stable; - 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 e3f376fa341ef..53547470f9b99 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -46,7 +46,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 a0adfd8814b72..a209aa310e396 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -114,7 +114,6 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[ // ABI, linking, symbols, and FFI sym::link, sym::link_name, - sym::no_link, sym::repr, // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity sym::rustc_align, diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index bdb181087122d..a25323e959128 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -1146,9 +1146,6 @@ pub enum AttributeKind { /// Represents `#[no_implicit_prelude]` NoImplicitPrelude, - /// 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 da03f039b8617..89f96941265fb 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -71,7 +71,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 d18764bc6814a..e45d848cb9f28 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -1333,11 +1333,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 5540008e5180c..73f501eeb71fc 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -293,7 +293,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 b7b84c173f418..08dd832a251fa 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 4185b7b018954..bee43746696d1 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 @@ -186,7 +186,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 df513dd8fdedc..6aa4692cbb28b 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 @@ -261,7 +261,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")), @@ -353,7 +353,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 7bb2606d5e61f..d2a85763c508e 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 084697f3a5d88..610d6fd6eb358 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -206,8 +206,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 7d8bd3700d4bb..73be65e201fd3 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -23,7 +23,7 @@ LL | #[cfg_attr(predicate, attr1, attr2, ...)] | ++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:213:1 + --> $DIR/malformed-attrs.rs:211:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate @@ -770,22 +770,8 @@ LL - #[thread_local()] LL + #[thread_local] | -error[E0565]: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:209:1 - | -LL | #[no_link()] - | ^^^^^^^^^--^ - | | - | didn't expect any arguments here - | -help: must be of the form - | -LL - #[no_link()] -LL + #[no_link] - | - error[E0539]: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:211:1 + --> $DIR/malformed-attrs.rs:209:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^---^ @@ -803,7 +789,7 @@ LL + #[macro_use] | error[E0539]: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:216:1 + --> $DIR/malformed-attrs.rs:214:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^----^ @@ -820,7 +806,7 @@ LL + #[macro_export] | error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:218:1 + --> $DIR/malformed-attrs.rs:216:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -829,7 +815,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:218:1 + --> $DIR/malformed-attrs.rs:216:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -967,7 +953,7 @@ LL | #[automatically_derived = 18] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:225:1 + --> $DIR/malformed-attrs.rs:223:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -986,7 +972,7 @@ LL | #[coroutine = 63] || {} = note: expected unit type `()` found coroutine `{coroutine@$DIR/malformed-attrs.rs:118:23: 118:25}` -error: aborting due to 74 previous errors; 8 warnings emitted +error: aborting due to 73 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`. @@ -1014,7 +1000,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:225:1 + --> $DIR/malformed-attrs.rs:223: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-struct.rs b/tests/ui/attributes/no_link/no-link-struct.rs deleted file mode 100644 index 40b0c53185f98..0000000000000 --- a/tests/ui/attributes/no_link/no-link-struct.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass -//@ aux-build:empty-struct.rs - -#[no_link] -extern crate empty_struct; - -fn main() { - empty_struct::XEmpty {}; -} 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/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index d11326d994f23..25c7f884a0101 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 @@ -56,43 +54,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 da8c9095a8163..b50cc6ec3f40d 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 @@ -48,16 +48,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"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +57,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] | ^^^^^^^^^^ @@ -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:37:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:35:1 | LL | #[inline] | ^^^^^^^^^ @@ -81,7 +73,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:40:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:38:17 | LL | mod inner { #![inline] } | ^^^^^^^^^^ @@ -89,7 +81,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:49:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:47:5 | LL | #[inline] struct S; | ^^^^^^^^^ @@ -97,7 +89,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:52:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5 | LL | #[inline] type T = S; | ^^^^^^^^^ @@ -105,63 +97,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:55:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:53: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:59: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:62: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:65: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:75: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:84: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:87: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:96:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:57:1 | LL | #[export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +113,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:99:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:60:17 | LL | mod inner { #![export_name="2200"] } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -177,7 +121,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:104:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:5 | LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +129,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:107:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:68:5 | LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +137,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:110:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:71:5 | LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -201,7 +145,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:114:9 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:9 | LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -209,7 +153,7 @@ LL | #[export_name = "2200"] fn foo(); = help: `#[export_name]` can be applied to functions with a body and statics error: `#[repr(C)]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:121:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:1 | LL | #[repr(C)] | ^^^^^^^^^^ @@ -217,7 +161,7 @@ LL | #[repr(C)] = help: `#[repr(C)]` can only be applied to data types error: `#[repr(C)]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:124:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:85:17 | LL | mod inner { #![repr(C)] } | ^^^^^^^^^^^ @@ -225,7 +169,7 @@ LL | mod inner { #![repr(C)] } = help: `#[repr(C)]` can only be applied to data types error: `#[repr(C)]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:88:5 | LL | #[repr(C)] fn f() { } | ^^^^^^^^^^ @@ -233,7 +177,7 @@ LL | #[repr(C)] fn f() { } = help: `#[repr(C)]` can only be applied to data types error: `#[repr(C)]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:132:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:93:5 | LL | #[repr(C)] type T = S; | ^^^^^^^^^^ @@ -241,7 +185,7 @@ LL | #[repr(C)] type T = S; = help: `#[repr(C)]` can only be applied to data types error: `#[repr(C)]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:135:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5 | LL | #[repr(C)] impl S { } | ^^^^^^^^^^ @@ -249,7 +193,7 @@ LL | #[repr(C)] impl S { } = help: `#[repr(C)]` can only be applied to data types error: `#[repr(Rust)]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:140:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:101:1 | LL | #[repr(Rust)] | ^^^^^^^^^^^^^ @@ -257,7 +201,7 @@ LL | #[repr(Rust)] = help: `#[repr(Rust)]` can only be applied to data types error: `#[repr(Rust)]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:104:17 | LL | mod inner { #![repr(Rust)] } | ^^^^^^^^^^^^^^ @@ -265,7 +209,7 @@ LL | mod inner { #![repr(Rust)] } = help: `#[repr(Rust)]` can only be applied to data types error: `#[repr(Rust)]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:146:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:107:5 | LL | #[repr(Rust)] fn f() { } | ^^^^^^^^^^^^^ @@ -273,7 +217,7 @@ LL | #[repr(Rust)] fn f() { } = help: `#[repr(Rust)]` can only be applied to data types error: `#[repr(Rust)]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:5 | LL | #[repr(Rust)] type T = S; | ^^^^^^^^^^^^^ @@ -281,7 +225,7 @@ LL | #[repr(Rust)] type T = S; = help: `#[repr(Rust)]` can only be applied to data types error: `#[repr(Rust)]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:154:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:5 | LL | #[repr(Rust)] impl S { } | ^^^^^^^^^^^^^ @@ -295,7 +239,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"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -306,7 +250,7 @@ LL - #![no_mangle] | error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:41:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ @@ -315,33 +259,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:68:13 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - -warning: `#[no_link]` attribute cannot be used on struct fields - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:9 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - -warning: `#[no_link]` attribute cannot be used on macro defs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:5 - | -LL | #[no_link] - | ^^^^^^^^^^ - | - = help: `#[no_link]` can only be applied to extern crates - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1 | @@ -359,12 +276,12 @@ LL | #![no_mangle] = help: `#[no_mangle]` can be applied to functions and statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -error: aborting due to 37 previous errors; 6 warnings emitted +error: aborting due to 30 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0658`. 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:43:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:41: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 54c040f4bcac4..4112f4bb887fa 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 f25263e9cef90..a5675d29b19c9 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() {