From c4bc358a2ffb0df3378ed8ae56d0cfc472cce58d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 9 Oct 2026 12:24:38 +0200 Subject: [PATCH] Add a future incompat warning for #[no_link] This is a pre-1.0 attribute that accidentally got stabilized. It was only meant for compiler plugins which we no longer support, not for regular crates. It is rather fragile and can easily lead to linker errors depending on where rustc decides to codegen functions and statics, which varies between rustc versions. It might also be unsound if a crate for example expects a global constructor it defined to run. Using it doesn't have an effect on the size of the produced binaries except when it defines a `#[used]` static given that we remove all unused functions and statics at link time already. --- .../src/attributes/no_link.rs | 6 + .../rustc_attr_parsing/src/diagnostics.rs | 4 + compiler/rustc_lint_defs/src/builtin.rs | 33 +++ tests/ui/attributes/malformed-attrs.rs | 2 + tests/ui/attributes/malformed-attrs.stderr | 37 ++- .../no_link/auxiliary/no_link-crate.rs | 1 + tests/ui/attributes/no_link/no-link-struct.rs | 4 + .../attributes/no_link/no-link-struct.stderr | 31 ++ ...sue-43106-gating-of-builtin-attrs-error.rs | 31 ++ ...43106-gating-of-builtin-attrs-error.stderr | 273 +++++++++++++++--- tests/ui/lint/unused/unused-attr-duplicate.rs | 2 + .../lint/unused/unused-attr-duplicate.stderr | 91 +++--- tests/ui/macros/macro-crate-def-only.rs | 3 + tests/ui/macros/macro-crate-def-only.stderr | 31 ++ tests/ui/macros/macro-export-inner-module.rs | 4 + .../macros/macro-export-inner-module.stderr | 31 ++ 16 files changed, 505 insertions(+), 79 deletions(-) create mode 100644 tests/ui/attributes/no_link/no-link-struct.stderr create mode 100644 tests/ui/macros/macro-crate-def-only.stderr create mode 100644 tests/ui/macros/macro-export-inner-module.stderr diff --git a/compiler/rustc_attr_parsing/src/attributes/no_link.rs b/compiler/rustc_attr_parsing/src/attributes/no_link.rs index 772ebb6b34f69..f35204a4c4be1 100644 --- a/compiler/rustc_attr_parsing/src/attributes/no_link.rs +++ b/compiler/rustc_attr_parsing/src/attributes/no_link.rs @@ -1,6 +1,8 @@ use rustc_feature::AttributeStability; +use rustc_lint_defs::builtin::NO_LINK_ATTRIBUTES; use super::prelude::*; +use crate::diagnostics::NoLinkAttrUsed; pub(crate) struct NoLinkParser; impl NoArgsAttributeParser for NoLinkParser { @@ -14,4 +16,8 @@ impl NoArgsAttributeParser for NoLinkParser { ]); const STABILITY: AttributeStability = AttributeStability::Stable; const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoLink; + + fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) { + cx.emit_lint(NO_LINK_ATTRIBUTES, NoLinkAttrUsed, attr_span); + } } diff --git a/compiler/rustc_attr_parsing/src/diagnostics.rs b/compiler/rustc_attr_parsing/src/diagnostics.rs index b55d7e476896b..88e19bb6d22eb 100644 --- a/compiler/rustc_attr_parsing/src/diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/diagnostics.rs @@ -2166,3 +2166,7 @@ pub(crate) struct Unused { #[subdiagnostic] pub note: UnusedNote, } + +#[derive(Diagnostic)] +#[diag("use of deprecated `no_link` attribute")] +pub(crate) struct NoLinkAttrUsed; diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 133da278dd343..d6e4b3b0bac7b 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -83,6 +83,7 @@ pub mod hardwired { NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE, NON_CONTIGUOUS_RANGE_ENDPOINTS, NON_EXHAUSTIVE_OMITTED_PATTERNS, + NO_LINK_ATTRIBUTES, OUT_OF_SCOPE_MACRO_CALLS, OVERLAPPING_RANGE_ENDPOINTS, PARTIAL_STACK_PROTECTOR, @@ -6019,3 +6020,35 @@ declare_lint! { r#"detects default field values on types that have const parameters"#, @feature_gate = default_field_values; } + +declare_lint! { + /// The `no_link_attributes` lint detects that you used `#[no_link]` on an + /// `extern crate` item. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// #[no_link] + /// extern crate std; + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// This is a pre-1.0 attribute that accidentally got stabilized. It was only meant + /// for compiler plugins which we no longer support, not for regular crates. It is + /// rather fragile and can easily lead to linker errors depending on where rustc + /// decides to codegen functions and statics, which varies between rustc versions. It + /// might also be unsound if a crate for example expects a global constructor it + /// defined to run. Using it doesn't have an effect on the size of the produced + /// binaries except when it defines a `#[used]` static given that we remove all unused + /// functions and statics at link time already. + pub NO_LINK_ATTRIBUTES, + Deny, + "detects usage of `#[no_link]` on `extern crate` items", + @future_incompatible = FutureIncompatibleInfo { + reason: fcw!(FutureReleaseError #164032), + report_in_deps: true, + }; +} diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 9156f86b88066..e29e9786647b4 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -207,6 +207,8 @@ static mut TLS: u8 = 42; #[no_link()] //~^ ERROR malformed +//~| ERROR use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler #[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 e2c56722b1311..8d01e13a2d380 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:212:1 + --> $DIR/malformed-attrs.rs:214:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate @@ -783,7 +783,7 @@ LL + #[no_link] | error[E0539]: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:210:3 + --> $DIR/malformed-attrs.rs:212:3 | LL | #[macro_use = 1] | ^^^^^^^^^^--- @@ -801,7 +801,7 @@ LL + #[macro_use(name1, name2, ...)] | error[E0539]: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:215:3 + --> $DIR/malformed-attrs.rs:217:3 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^---- @@ -818,7 +818,7 @@ LL + #[macro_export(local_inner_macros)] | error[E0658]: the `allow_internal_unsafe` attribute side-steps the `unsafe_code` lint - --> $DIR/malformed-attrs.rs:217:3 + --> $DIR/malformed-attrs.rs:219:3 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^ @@ -827,7 +827,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:217:3 + --> $DIR/malformed-attrs.rs:219:3 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^--- @@ -964,8 +964,18 @@ LL | #[automatically_derived = 18] = help: the `automatically_derived` attribute can only be applied to trait impl blocks = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +error: use of deprecated `no_link` attribute + --> $DIR/malformed-attrs.rs:208:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:224:3 + --> $DIR/malformed-attrs.rs:226:3 | LL | #[ignore = 1] | ^^^^^^^^^^ @@ -984,7 +994,7 @@ LL | #[coroutine = 63] || {} = note: expected unit type `()` found coroutine `{coroutine@$DIR/malformed-attrs.rs:117:23: 117:25}` -error: aborting due to 74 previous errors; 8 warnings emitted +error: aborting due to 75 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`. @@ -1010,9 +1020,20 @@ LL | #[ignore()] = note: for more information, see issue #57571 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/malformed-attrs.rs:208:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + Future breakage diagnostic: error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:224:3 + --> $DIR/malformed-attrs.rs:226:3 | LL | #[ignore = 1] | ^^^^^^^^^^ diff --git a/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs b/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs index 1c3af5431cc6e..fbe4d2c1fb2c2 100644 --- a/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs +++ b/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs @@ -1,6 +1,7 @@ //@ no-prefer-dynamic #![crate_type = "rlib"] +#![warn(no_link_attributes)] #[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/no-link-struct.rs b/tests/ui/attributes/no_link/no-link-struct.rs index 40b0c53185f98..66c537d96044e 100644 --- a/tests/ui/attributes/no_link/no-link-struct.rs +++ b/tests/ui/attributes/no_link/no-link-struct.rs @@ -1,7 +1,11 @@ //@ check-pass //@ aux-build:empty-struct.rs +#![warn(no_link_attributes)] + #[no_link] +//~^ WARN use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler extern crate empty_struct; fn main() { diff --git a/tests/ui/attributes/no_link/no-link-struct.stderr b/tests/ui/attributes/no_link/no-link-struct.stderr new file mode 100644 index 0000000000000..05ebb4492d230 --- /dev/null +++ b/tests/ui/attributes/no_link/no-link-struct.stderr @@ -0,0 +1,31 @@ +warning: use of deprecated `no_link` attribute + --> $DIR/no-link-struct.rs:6:1 + | +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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/no-link-struct.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +warning: use of deprecated `no_link` attribute + --> $DIR/no-link-struct.rs:6:1 + | +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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/no-link-struct.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ + 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 3cc404416839e..3c8c3c28e1b6e 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 @@ -29,6 +29,10 @@ //~| WARN previously accepted #![no_link] //~^ ERROR: the `no_link` attribute cannot be used on crates +//~| ERROR use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler +//~| NOTE `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default +//~| NOTE for more information, see issue #164032 #![export_name = "2200"] //~^ ERROR: attribute cannot be used on //~| NOTE takes precedence @@ -58,38 +62,65 @@ mod inline { #[no_link] //~^ ERROR the `no_link` attribute cannot be used on modules +//~| ERROR use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler +//~| NOTE for more information, see issue #164032 mod no_link { mod inner { #![no_link] } //~^ ERROR the `no_link` attribute cannot be used on modules + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 #[no_link] fn f() { //~^ ERROR the `no_link` attribute cannot be used on functions + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 match () { #[no_link] //~^ WARN the `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! + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 _ => () } } #[no_link] //~^ ERROR the `no_link` attribute cannot be used on structs + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 struct S { #[no_link] //~^ WARN the `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! + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 field: () } #[no_link]type T = S; //~^ ERROR the `no_link` attribute cannot be used on type aliases + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 #[no_link] impl S { } //~^ ERROR the `no_link` attribute cannot be used on inherent impl blocks + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 #[no_link] //~^ WARN the `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! + //~| ERROR use of deprecated `no_link` attribute + //~| WARN this was previously accepted by the compiler + //~| NOTE for more information, see issue #164032 macro_rules! m{() => {}} } 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 44f7d6942a3a1..900e7f196f5e5 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 @@ -57,7 +57,7 @@ LL | #![no_link] = help: the `no_link` attribute can only be applied to extern crates error: the `export_name` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:4 | LL | #![export_name = "2200"] | ^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | #![export_name = "2200"] = help: the `export_name` attribute can be applied to functions and statics error: the `inline` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:35:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:39:4 | LL | #![inline] | ^^^^^^ @@ -73,7 +73,7 @@ LL | #![inline] = help: the `inline` attribute can only be applied to functions error: the `inline` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:37:3 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:41:3 | LL | #[inline] | ^^^^^^ @@ -81,7 +81,7 @@ LL | #[inline] = help: the `inline` attribute can only be applied to functions error: the `inline` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:20 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:44:20 | LL | mod inner { #![inline] } | ^^^^^^ @@ -89,7 +89,7 @@ LL | mod inner { #![inline] } = help: the `inline` attribute can only be applied to functions error: the `inline` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:49:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:53:7 | LL | #[inline] struct S; | ^^^^^^ @@ -97,7 +97,7 @@ LL | #[inline] struct S; = help: the `inline` attribute can only be applied to functions error: the `inline` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:7 | LL | #[inline] type T = S; | ^^^^^^ @@ -105,7 +105,7 @@ LL | #[inline] type T = S; = help: the `inline` attribute can only be applied to functions error: the `inline` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:55:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:7 | LL | #[inline] impl S { } | ^^^^^^ @@ -113,7 +113,7 @@ LL | #[inline] impl S { } = help: the `inline` attribute can only be applied to functions error: the `no_link` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:3 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:63:3 | LL | #[no_link] | ^^^^^^^ @@ -121,7 +121,7 @@ LL | #[no_link] = help: the `no_link` attribute can only be applied to extern crates error: the `no_link` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:62:20 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:69:20 | LL | mod inner { #![no_link] } | ^^^^^^^ @@ -129,7 +129,7 @@ LL | mod inner { #![no_link] } = help: the `no_link` attribute can only be applied to extern crates error: the `no_link` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:7 | LL | #[no_link] fn f() { | ^^^^^^^ @@ -137,7 +137,7 @@ LL | #[no_link] fn f() { = help: the `no_link` attribute can only be applied to extern crates error: the `no_link` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:7 | LL | #[no_link] | ^^^^^^^ @@ -145,7 +145,7 @@ LL | #[no_link] = help: the `no_link` attribute can only be applied to extern crates error: the `no_link` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:84:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:7 | LL | #[no_link]type T = S; | ^^^^^^^ @@ -153,7 +153,7 @@ LL | #[no_link]type T = S; = help: the `no_link` attribute can only be applied to extern crates error: the `no_link` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:87:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:7 | LL | #[no_link] impl S { } | ^^^^^^^ @@ -161,7 +161,7 @@ LL | #[no_link] impl S { } = help: the `no_link` attribute can only be applied to extern crates error: the `export_name` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:3 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:3 | LL | #[export_name = "2200"] | ^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL | #[export_name = "2200"] = help: the `export_name` attribute can be applied to functions and statics error: the `export_name` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:99:20 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:130:20 | LL | mod inner { #![export_name="2200"] } | ^^^^^^^^^^^ @@ -177,7 +177,7 @@ LL | mod inner { #![export_name="2200"] } = help: the `export_name` attribute can be applied to functions and statics error: the `export_name` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:104:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:135:7 | LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^ @@ -185,7 +185,7 @@ LL | #[export_name = "2200"] struct S; = help: the `export_name` attribute can be applied to functions and statics error: the `export_name` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:107:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:138:7 | LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL | #[export_name = "2200"] type T = S; = help: the `export_name` attribute can be applied to functions and statics error: the `export_name` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:110:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:7 | LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^ @@ -201,7 +201,7 @@ LL | #[export_name = "2200"] impl S { } = help: the `export_name` attribute can be applied to functions and statics error: the `export_name` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:114:11 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:11 | LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^ @@ -209,7 +209,7 @@ LL | #[export_name = "2200"] fn foo(); = help: the `export_name` attribute can be applied to functions with a body and statics error: the `repr(C)` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:121:3 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:152:3 | LL | #[repr(C)] | ^^^^^^^ @@ -217,7 +217,7 @@ LL | #[repr(C)] = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:124:20 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:20 | LL | mod inner { #![repr(C)] } | ^^^^^^^ @@ -225,7 +225,7 @@ LL | mod inner { #![repr(C)] } = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:158:7 | LL | #[repr(C)] fn f() { } | ^^^^^^^ @@ -233,7 +233,7 @@ LL | #[repr(C)] fn f() { } = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:132:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:163:7 | LL | #[repr(C)] type T = S; | ^^^^^^^ @@ -241,7 +241,7 @@ LL | #[repr(C)] type T = S; = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:135:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:166:7 | LL | #[repr(C)] impl S { } | ^^^^^^^ @@ -249,7 +249,7 @@ LL | #[repr(C)] impl S { } = help: the `repr(C)` attribute can only be applied to data types error: the `repr(Rust)` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:140:3 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:171:3 | LL | #[repr(Rust)] | ^^^^^^^^^^ @@ -257,7 +257,7 @@ LL | #[repr(Rust)] = help: the `repr(Rust)` attribute can only be applied to data types error: the `repr(Rust)` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:20 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:174:20 | LL | mod inner { #![repr(Rust)] } | ^^^^^^^^^^ @@ -265,7 +265,7 @@ LL | mod inner { #![repr(Rust)] } = help: the `repr(Rust)` attribute can only be applied to data types error: the `repr(Rust)` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:146:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:177:7 | LL | #[repr(Rust)] fn f() { } | ^^^^^^^^^^ @@ -273,7 +273,7 @@ LL | #[repr(Rust)] fn f() { } = help: the `repr(Rust)` attribute can only be applied to data types error: the `repr(Rust)` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:182:7 | LL | #[repr(Rust)] type T = S; | ^^^^^^^^^^ @@ -281,7 +281,7 @@ LL | #[repr(Rust)] type T = S; = help: the `repr(Rust)` attribute can only be applied to data types error: the `repr(Rust)` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:154:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:185:7 | LL | #[repr(Rust)] impl S { } | ^^^^^^^^^^ @@ -295,7 +295,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:36:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -322,8 +322,18 @@ LL | #![no_mangle] = help: the `no_mangle` attribute 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: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + error: valid forms for the attribute are `inline`, `inline(always)`, and `inline(never)` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:47:7 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^ @@ -332,8 +342,35 @@ 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 +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:63:1 + | +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! + = note: for more information, see issue #164032 + +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:69:17 + | +LL | mod inner { #![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! + = note: for more information, see issue #164032 + +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:5 + | +LL | #[no_link] fn f() { + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + warning: the `no_link` attribute cannot be used on match arms - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:68:15 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:81:15 | LL | #[no_link] | ^^^^^^^ @@ -341,8 +378,26 @@ LL | #[no_link] = help: the `no_link` attribute 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! +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:81: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! + = note: for more information, see issue #164032 + +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91: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! + = note: for more information, see issue #164032 + warning: the `no_link` attribute cannot be used on struct fields - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:11 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:97:11 | LL | #[no_link] | ^^^^^^^ @@ -350,8 +405,35 @@ LL | #[no_link] = help: the `no_link` attribute 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! +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:97: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! + = note: for more information, see issue #164032 + +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5 + | +LL | #[no_link]type T = S; + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:5 + | +LL | #[no_link] impl S { } + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + warning: the `no_link` attribute cannot be used on macro defs - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:118:7 | LL | #[no_link] | ^^^^^^^ @@ -359,12 +441,32 @@ LL | #[no_link] = help: the `no_link` attribute 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! -error: aborting due to 37 previous errors; 6 warnings emitted +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:118: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! + = note: for more information, see issue #164032 + +error: aborting due to 47 previous errors; 6 warnings emitted For more information about this error, try `rustc --explain E0658`. Future incompatibility report: Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: error: valid forms for the attribute are `inline`, `inline(always)`, and `inline(never)` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:47:7 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^ @@ -373,3 +475,102 @@ 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 +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:63:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:69:17 + | +LL | mod inner { #![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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:5 + | +LL | #[no_link] fn f() { + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:81: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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91: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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:97: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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5 + | +LL | #[no_link]type T = S; + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:5 + | +LL | #[no_link] impl S { } + | ^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:118: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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs index c62fc6036f60f..033edc241afd1 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.rs +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs @@ -34,6 +34,8 @@ #![no_builtins] //~ ERROR unused attribute #[no_link] +//~^ ERROR use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler #[no_link] //~ ERROR unused attribute extern crate lint_unused_extern_crate; diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index feb1a79bf9b92..97a1dca61be44 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -17,7 +17,7 @@ LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ warning: `#[repr(..)]` attribute is specified more than once - --> $DIR/unused-attr-duplicate.rs:67:8 + --> $DIR/unused-attr-duplicate.rs:69:8 | LL | #[repr(C)] | ^ @@ -117,7 +117,7 @@ LL | #![no_builtins] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:37:1 + --> $DIR/unused-attr-duplicate.rs:39:1 | LL | #[no_link] | ^^^^^^^^^^ help: remove this attribute @@ -128,204 +128,225 @@ note: attribute also specified here LL | #[no_link] | ^^^^^^^^^^ +error: use of deprecated `no_link` attribute + --> $DIR/unused-attr-duplicate.rs:36:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default + error: unused attribute - --> $DIR/unused-attr-duplicate.rs:41:1 + --> $DIR/unused-attr-duplicate.rs:43:1 | LL | #[macro_use] | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:40:1 + --> $DIR/unused-attr-duplicate.rs:42:1 | LL | #[macro_use] | ^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:44:5 + --> $DIR/unused-attr-duplicate.rs:46:5 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:43:5 + --> $DIR/unused-attr-duplicate.rs:45:5 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:51:1 + --> $DIR/unused-attr-duplicate.rs:53:1 | LL | #[path = "bar.rs"] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:50:1 + --> $DIR/unused-attr-duplicate.rs:52:1 | LL | #[path = "auxiliary/lint_unused_extern_crate.rs"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:57:1 + --> $DIR/unused-attr-duplicate.rs:59:1 | LL | #[ignore = "some text"] | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:56:1 + --> $DIR/unused-attr-duplicate.rs:58:1 | LL | #[ignore] | ^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:59:1 + --> $DIR/unused-attr-duplicate.rs:61:1 | LL | #[should_panic(expected = "values don't match")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:58:1 + --> $DIR/unused-attr-duplicate.rs:60:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:64:1 + --> $DIR/unused-attr-duplicate.rs:66:1 | LL | #[must_use = "some message"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:63:1 + --> $DIR/unused-attr-duplicate.rs:65:1 | LL | #[must_use] | ^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:70:1 + --> $DIR/unused-attr-duplicate.rs:72:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:69:1 + --> $DIR/unused-attr-duplicate.rs:71:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:76:1 + --> $DIR/unused-attr-duplicate.rs:78:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:75:1 + --> $DIR/unused-attr-duplicate.rs:77:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:80:1 + --> $DIR/unused-attr-duplicate.rs:82:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:79:1 + --> $DIR/unused-attr-duplicate.rs:81:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:83:1 + --> $DIR/unused-attr-duplicate.rs:85:1 | LL | #[cold] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:82:1 + --> $DIR/unused-attr-duplicate.rs:84:1 | LL | #[cold] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:85:1 + --> $DIR/unused-attr-duplicate.rs:87:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:84:1 + --> $DIR/unused-attr-duplicate.rs:86:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:99:1 + --> $DIR/unused-attr-duplicate.rs:101:1 | LL | #[export_name = "exported_symbol_name2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:98:1 + --> $DIR/unused-attr-duplicate.rs:100:1 | LL | #[export_name = "exported_symbol_name"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:104:1 + --> $DIR/unused-attr-duplicate.rs:106:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:103:1 + --> $DIR/unused-attr-duplicate.rs:105:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:108:1 + --> $DIR/unused-attr-duplicate.rs:110:1 | LL | #[used] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:107:1 + --> $DIR/unused-attr-duplicate.rs:109:1 | LL | #[used] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:112:1 + --> $DIR/unused-attr-duplicate.rs:114:1 | LL | #[link_section = "__DATA,__mod_init_func"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:111:1 + --> $DIR/unused-attr-duplicate.rs:113:1 | LL | #[link_section = "__TEXT,__text"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:93:5 + --> $DIR/unused-attr-duplicate.rs:95:5 | LL | #[link_name = "rust_dbg_extern_identity_u32"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:92:5 + --> $DIR/unused-attr-duplicate.rs:94:5 | LL | #[link_name = "this_does_not_exist"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 25 previous errors; 1 warning emitted +error: aborting due to 26 previous errors; 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +error: use of deprecated `no_link` attribute + --> $DIR/unused-attr-duplicate.rs:36:1 + | +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! + = note: for more information, see issue #164032 + = note: `#[deny(no_link_attributes)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/macros/macro-crate-def-only.rs b/tests/ui/macros/macro-crate-def-only.rs index f15394df35765..df0cfaa0c8cfe 100644 --- a/tests/ui/macros/macro-crate-def-only.rs +++ b/tests/ui/macros/macro-crate-def-only.rs @@ -1,8 +1,11 @@ //@ run-pass //@ aux-build:macro_crate_def_only.rs +#![warn(no_link_attributes)] #[macro_use] #[no_link] +//~^ WARN use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler extern crate macro_crate_def_only; pub fn main() { diff --git a/tests/ui/macros/macro-crate-def-only.stderr b/tests/ui/macros/macro-crate-def-only.stderr new file mode 100644 index 0000000000000..0895d69cdbcc5 --- /dev/null +++ b/tests/ui/macros/macro-crate-def-only.stderr @@ -0,0 +1,31 @@ +warning: use of deprecated `no_link` attribute + --> $DIR/macro-crate-def-only.rs:6:14 + | +LL | #[macro_use] #[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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/macro-crate-def-only.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +warning: use of deprecated `no_link` attribute + --> $DIR/macro-crate-def-only.rs:6:14 + | +LL | #[macro_use] #[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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/macro-crate-def-only.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/macros/macro-export-inner-module.rs b/tests/ui/macros/macro-export-inner-module.rs index 6eccc90dc67ec..a41143fdc031a 100644 --- a/tests/ui/macros/macro-export-inner-module.rs +++ b/tests/ui/macros/macro-export-inner-module.rs @@ -1,7 +1,11 @@ //@ run-pass //@aux-build:macro_export_inner_module.rs +#![warn(no_link_attributes)] + #[macro_use] #[no_link] +//~^ WARN use of deprecated `no_link` attribute +//~| WARN this was previously accepted by the compiler extern crate macro_export_inner_module; pub fn main() { diff --git a/tests/ui/macros/macro-export-inner-module.stderr b/tests/ui/macros/macro-export-inner-module.stderr new file mode 100644 index 0000000000000..cb20afa27058e --- /dev/null +++ b/tests/ui/macros/macro-export-inner-module.stderr @@ -0,0 +1,31 @@ +warning: use of deprecated `no_link` attribute + --> $DIR/macro-export-inner-module.rs:6:14 + | +LL | #[macro_use] #[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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/macro-export-inner-module.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + +Future incompatibility report: Future breakage diagnostic: +warning: use of deprecated `no_link` attribute + --> $DIR/macro-export-inner-module.rs:6:14 + | +LL | #[macro_use] #[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! + = note: for more information, see issue #164032 +note: the lint level is defined here + --> $DIR/macro-export-inner-module.rs:4:9 + | +LL | #![warn(no_link_attributes)] + | ^^^^^^^^^^^^^^^^^^ +