From decf37ef92e4fbc17e3cea3f54b96d08bec2a8f0 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Tue, 22 Sep 2026 23:02:37 +0200 Subject: [PATCH] Raise some occurrences of unused attributes to deny by default --- .../src/attributes/codegen_attrs.rs | 24 +- .../src/attributes/crate_level.rs | 8 +- .../src/attributes/inline.rs | 2 +- .../src/attributes/instruction_set.rs | 2 +- .../src/attributes/link_attrs.rs | 12 +- .../rustc_attr_parsing/src/attributes/mod.rs | 9 +- .../src/attributes/must_use.rs | 2 +- .../src/attributes/non_exhaustive.rs | 8 +- .../rustc_attr_parsing/src/attributes/path.rs | 2 +- .../src/attributes/prelude.rs | 2 +- .../rustc_attr_parsing/src/attributes/repr.rs | 16 +- .../src/attributes/test_attrs.rs | 2 +- compiler/rustc_attr_parsing/src/context.rs | 14 +- .../rustc_attr_parsing/src/target_checking.rs | 38 +- compiler/rustc_lint_defs/src/builtin.rs | 47 ++ compiler/rustc_passes/src/check_attr.rs | 15 +- .../ui/derive_partial_eq_without_eq.fixed | 1 + .../tests/ui/derive_partial_eq_without_eq.rs | 1 + .../ui/derive_partial_eq_without_eq.stderr | 4 +- .../issue-rust-86261/src/lib.rs | 2 +- src/tools/tidy/src/issues.txt | 2 +- tests/codegen-llvm/issues/issue-32031.rs | 2 - tests/ui/attributes/attr-on-mac-call.rs | 30 +- tests/ui/attributes/attr-on-mac-call.stderr | 43 +- .../codegen_attr_on_required_trait_method.rs | 2 +- ...degen_attr_on_required_trait_method.stderr | 1 + tests/ui/attributes/link-name-on-static.rs | 4 +- .../ui/attributes/link-name-on-static.stderr | 8 +- tests/ui/attributes/malformed-attrs.rs | 4 +- tests/ui/attributes/malformed-attrs.stderr | 7 +- .../mixed_export_name_and_no_mangle.fixed | 6 +- .../mixed_export_name_and_no_mangle.rs | 6 +- .../mixed_export_name_and_no_mangle.stderr | 20 +- ...mixed_export_name_and_no_mangle_2024.fixed | 5 +- .../mixed_export_name_and_no_mangle_2024.rs | 5 +- ...ixed_export_name_and_no_mangle_2024.stderr | 20 +- tests/ui/attributes/positions/link-section.rs | 3 +- .../attributes/positions/link-section.stderr | 8 +- .../cfg_attr-attr-syntax-validation.rs | 2 +- .../cfg_attr-attr-syntax-validation.stderr | 6 +- tests/ui/extern/extern-no-mangle.rs | 10 +- tests/ui/extern/extern-no-mangle.stderr | 20 +- tests/ui/extern/issue-47725.rs | 8 +- tests/ui/extern/issue-47725.stderr | 16 +- ... issue-43106-gating-of-builtin-attrs-2.rs} | 12 +- ...ue-43106-gating-of-builtin-attrs-2.stderr} | 99 ++-- .../issue-43106-gating-of-builtin-attrs.rs | 98 ++-- ...issue-43106-gating-of-builtin-attrs.stderr | 501 +++++++++--------- tests/ui/lint/harmful_unused_attributes.rs | 9 + .../lint/unused/unused-attr-duplicate.stderr | 1 + tests/ui/malformed/malformed-regressions.rs | 4 +- .../ui/malformed/malformed-regressions.stderr | 8 +- .../param-attrs-builtin-attrs.rs | 16 +- .../param-attrs-builtin-attrs.stderr | 19 +- 54 files changed, 635 insertions(+), 581 deletions(-) rename tests/ui/feature-gates/{issue-43106-gating-of-builtin-attrs-error.rs => issue-43106-gating-of-builtin-attrs-2.rs} (93%) rename tests/ui/feature-gates/{issue-43106-gating-of-builtin-attrs-error.stderr => issue-43106-gating-of-builtin-attrs-2.stderr} (77%) create mode 100644 tests/ui/lint/harmful_unused_attributes.rs diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index bff7d7ad81cb9..c1f533ed8c285 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -111,7 +111,7 @@ pub(crate) struct ExportNameParser; impl SingleAttributeParser for ExportNameParser { const PATH: &[rustc_span::Symbol] = &[sym::export_name]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::DenyAndFutureError; const SAFETY: AttributeSafety = AttributeSafety::Unsafe { note: "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them", unsafe_since: Some(Edition2024), @@ -122,10 +122,10 @@ impl SingleAttributeParser for ExportNameParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::Method(MethodKind::Trait { body: true })), Allow(Target::Method(MethodKind::TraitImpl)), - Warn(Target::Field), - Warn(Target::Arm), - Warn(Target::MacroDef), - Warn(Target::MacroCall), + Deny(Target::Field), + Deny(Target::Arm), + Deny(Target::MacroDef), + Deny(Target::MacroCall), ]); const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name"); const STABILITY: AttributeStability = AttributeStability::Stable; @@ -233,7 +233,7 @@ impl AttributeParser for NakedParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::Method(MethodKind::Trait { body: true })), Allow(Target::Method(MethodKind::TraitImpl)), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]); fn finalize(self, cx: &FinalizeContext<'_, '_>) -> Option { @@ -386,7 +386,7 @@ impl NoArgsAttributeParser for NoMangleParser { note: "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them", unsafe_since: Some(Edition2024), }; - const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[ + const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListDenyRest(&[ Allow(Target::Fn), Allow(Target::Static), Allow(Target::Method(MethodKind::Inherent)), @@ -556,11 +556,11 @@ impl CombineAttributeParser for TargetFeatureParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::Method(MethodKind::Trait { body: true })), Allow(Target::Method(MethodKind::TraitImpl)), - Warn(Target::Statement), - Warn(Target::Field), - Warn(Target::Arm), - Warn(Target::MacroDef), - Warn(Target::MacroCall), + Deny(Target::Statement), + Deny(Target::Field), + Deny(Target::Arm), + Deny(Target::MacroDef), + Deny(Target::MacroCall), ]); const STABILITY: AttributeStability = AttributeStability::Stable; diff --git a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs index 3a1c7858f030b..ac82cdbce4562 100644 --- a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs +++ b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs @@ -15,7 +15,7 @@ pub(crate) struct CrateNameParser; impl SingleAttributeParser for CrateNameParser { const PATH: &[Symbol] = &[sym::crate_name]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name"); const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]); @@ -78,7 +78,7 @@ pub(crate) struct RecursionLimitParser; impl SingleAttributeParser for RecursionLimitParser { const PATH: &[Symbol] = &[sym::recursion_limit]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const TEMPLATE: AttributeTemplate = template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute"); const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]); @@ -110,7 +110,7 @@ pub(crate) struct TypeLengthLimitParser; impl SingleAttributeParser for TypeLengthLimitParser { const PATH: &[Symbol] = &[sym::type_length_limit]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const TEMPLATE: AttributeTemplate = template!(NameValueStr: "N"); const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]); @@ -185,7 +185,7 @@ pub(crate) struct WindowsSubsystemParser; impl SingleAttributeParser for WindowsSubsystemParser { const PATH: &[Symbol] = &[sym::windows_subsystem]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]); const TEMPLATE: AttributeTemplate = template!(NameValueStr: ["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute"); diff --git a/compiler/rustc_attr_parsing/src/attributes/inline.rs b/compiler/rustc_attr_parsing/src/attributes/inline.rs index f3e305ea266a1..ec987224e4480 100644 --- a/compiler/rustc_attr_parsing/src/attributes/inline.rs +++ b/compiler/rustc_attr_parsing/src/attributes/inline.rs @@ -9,7 +9,7 @@ pub(crate) struct InlineParser; impl SingleAttributeParser for InlineParser { const PATH: &[Symbol] = &[sym::inline]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[ Allow(Target::Fn), Allow(Target::Method(MethodKind::Inherent)), diff --git a/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs b/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs index 6c470f0587732..fc677795b8a23 100644 --- a/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs +++ b/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs @@ -8,7 +8,7 @@ pub(crate) struct InstructionSetParser; impl SingleAttributeParser for InstructionSetParser { const PATH: &[Symbol] = &[sym::instruction_set]; - const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[ + const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListDenyRest(&[ Allow(Target::Fn), Allow(Target::Closure), Allow(Target::Method(MethodKind::Inherent)), diff --git a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs index a00e5af00c2eb..85b3e6974d718 100644 --- a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs @@ -26,8 +26,8 @@ pub(crate) struct LinkNameParser; impl SingleAttributeParser for LinkNameParser { const PATH: &[Symbol] = &[sym::link_name]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; - const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[ + const ON_DUPLICATE: OnDuplicate = OnDuplicate::DenyAndFutureError; + const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListDenyRest(&[ Allow(Target::ForeignFn), Allow(Target::ForeignStatic), ]); @@ -72,7 +72,7 @@ impl CombineAttributeParser for LinkParser { r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#, ], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute"); const ALLOWED_TARGETS: AllowedTargets<'_> = - AllowedTargets::AllowListWarnRest(&[Allow(Target::ForeignMod)]); + AllowedTargets::AllowListDenyRest(&[Allow(Target::ForeignMod)]); const STABILITY: AttributeStability = AttributeStability::Stable; fn extend( @@ -494,13 +494,13 @@ fn check_link_section_macho(name: Symbol) -> Result<(), InvalidMachoSectionReaso impl SingleAttributeParser for LinkSectionParser { const PATH: &[Symbol] = &[sym::link_section]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::DenyAndFutureError; const SAFETY: AttributeSafety = AttributeSafety::Unsafe { note: "the program's behavior with overridden link sections on items is unpredictable and Rust cannot provide guarantees when you manually override them", unsafe_since: Some(Edition2024), }; const STABILITY: AttributeStability = AttributeStability::Stable; - const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[ + const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListDenyRest(&[ Allow(Target::Static), Allow(Target::Fn), Allow(Target::Method(MethodKind::Inherent)), @@ -612,7 +612,7 @@ impl SingleAttributeParser for LinkOrdinalParser { const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[ Allow(Target::ForeignFn), Allow(Target::ForeignStatic), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]); const TEMPLATE: AttributeTemplate = template!( List: &["ordinal"], diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 242b4a73b06a6..09b36a76fe56d 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -216,7 +216,11 @@ pub(crate) enum OnDuplicate { Warn, /// Duplicates will be a warning, with a note that this will be an error in the future. - WarnButFutureError, + WarnAndFutureError, + + /// Duplicates will be a deny by default warning, + /// with a note that this will be an error in the future. + DenyAndFutureError, /// Give a default error Error, @@ -234,7 +238,8 @@ impl OnDuplicate { ) { match self { OnDuplicate::Warn => cx.warn_unused_duplicate(used, unused), - OnDuplicate::WarnButFutureError => cx.warn_unused_duplicate_future_error(used, unused), + OnDuplicate::WarnAndFutureError => cx.warn_unused_duplicate_future_error(used, unused), + OnDuplicate::DenyAndFutureError => cx.deny_unused_duplicate_future_error(used, unused), OnDuplicate::Error => { cx.emit_err(UnusedMultiple { this: unused, diff --git a/compiler/rustc_attr_parsing/src/attributes/must_use.rs b/compiler/rustc_attr_parsing/src/attributes/must_use.rs index 62e75a2e7afd9..9934b6fee5f5d 100644 --- a/compiler/rustc_attr_parsing/src/attributes/must_use.rs +++ b/compiler/rustc_attr_parsing/src/attributes/must_use.rs @@ -6,7 +6,7 @@ pub(crate) struct MustUseParser; impl SingleAttributeParser for MustUseParser { const PATH: &[Symbol] = &[sym::must_use]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[ Allow(Target::Fn), Allow(Target::Enum), diff --git a/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs b/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs index 30fdadf95e4ce..4bf0b3f1c56e5 100644 --- a/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs +++ b/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs @@ -13,10 +13,10 @@ impl NoArgsAttributeParser for NonExhaustiveParser { Allow(Target::Enum), Allow(Target::Struct), Allow(Target::Variant), - Warn(Target::Field), - Warn(Target::Arm), - Warn(Target::MacroDef), - Warn(Target::MacroCall), + Deny(Target::Field), + Deny(Target::Arm), + Deny(Target::MacroDef), + Deny(Target::MacroCall), ]); const STABILITY: AttributeStability = AttributeStability::Stable; const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive; diff --git a/compiler/rustc_attr_parsing/src/attributes/path.rs b/compiler/rustc_attr_parsing/src/attributes/path.rs index a44414f5aead2..bf9dec16a0db0 100644 --- a/compiler/rustc_attr_parsing/src/attributes/path.rs +++ b/compiler/rustc_attr_parsing/src/attributes/path.rs @@ -6,7 +6,7 @@ pub(crate) struct PathParser; impl SingleAttributeParser for PathParser { const PATH: &[Symbol] = &[sym::path]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Mod), Error(Target::Crate)]); const TEMPLATE: AttributeTemplate = template!( diff --git a/compiler/rustc_attr_parsing/src/attributes/prelude.rs b/compiler/rustc_attr_parsing/src/attributes/prelude.rs index 76ce02833d797..f80c1a95e1c6a 100644 --- a/compiler/rustc_attr_parsing/src/attributes/prelude.rs +++ b/compiler/rustc_attr_parsing/src/attributes/prelude.rs @@ -20,7 +20,7 @@ pub(super) use crate::context::{AcceptContext, FinalizeCheckContext, FinalizeCon pub(super) use crate::parser::*; // target checking #[doc(hidden)] -pub(super) use crate::target_checking::Policy::{Allow, Error, Warn}; +pub(super) use crate::target_checking::Policy::{Allow, Deny, Error, Warn}; #[doc(hidden)] pub(super) use crate::target_checking::{ALL_TARGETS, AllowedTargets}; #[doc(hidden)] diff --git a/compiler/rustc_attr_parsing/src/attributes/repr.rs b/compiler/rustc_attr_parsing/src/attributes/repr.rs index 6115ed207d98c..57b8b8db6cdc0 100644 --- a/compiler/rustc_attr_parsing/src/attributes/repr.rs +++ b/compiler/rustc_attr_parsing/src/attributes/repr.rs @@ -44,7 +44,7 @@ impl CombineAttributeParser for ReprParser { Allow(Target::Struct), Allow(Target::Enum), Allow(Target::Union), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]), ); @@ -75,7 +75,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< ($arg: ident, $constructor: expr) => {{ cx.check_target( concat!("(", stringify!($arg), ")"), - &AllowedTargets::AllowList(&[Allow(Target::Enum), Warn(Target::MacroCall)]), + &AllowedTargets::AllowList(&[Allow(Target::Enum), Deny(Target::MacroCall)]), ); cx.expect_no_args(param.args())?; Some($constructor) @@ -90,7 +90,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< Allow(Target::Struct), Allow(Target::Enum), Allow(Target::Union), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]), ); let l = cx.expect_list(param.args(), param.span())?; @@ -102,7 +102,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< &AllowedTargets::AllowList(&[ Allow(Target::Struct), Allow(Target::Union), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]), ); match param.args() { @@ -122,7 +122,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< Allow(Target::Struct), Allow(Target::Enum), Allow(Target::Union), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]), ); cx.expect_no_args(param.args())?; @@ -135,7 +135,7 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< Allow(Target::Struct), Allow(Target::Enum), Allow(Target::Union), - Warn(Target::MacroCall), + Deny(Target::MacroCall), ]), ); cx.expect_no_args(param.args())?; @@ -161,8 +161,8 @@ fn parse_repr(cx: &mut AcceptContext<'_, '_>, param: &MetaItemParser) -> Option< &AllowedTargets::AllowList(&[ Allow(Target::Struct), Allow(Target::Enum), - Allow(Target::Union), // Feature gated in `rustc_attr_ir_analysis` - Warn(Target::MacroCall), + Allow(Target::Union), // Feature gated in `rustc_hir_analysis` + Deny(Target::MacroCall), ]), ); cx.expect_no_args(param.args())?; diff --git a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs index 9f2f7613b1c27..0523b48c8abf5 100644 --- a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs @@ -50,7 +50,7 @@ pub(crate) struct ShouldPanicParser; impl SingleAttributeParser for ShouldPanicParser { const PATH: &[Symbol] = &[sym::should_panic]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnAndFutureError; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[Allow(Target::Fn), Error(Target::WherePredicate)]); const TEMPLATE: AttributeTemplate = template!( diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index f936f5aab8265..e767c2c08e555 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -14,7 +14,7 @@ use rustc_attr_ir::{AttrPath, Attribute, AttributeKind}; use rustc_data_structures::sync::{DynSend, DynSync}; use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan}; use rustc_feature::AttributeStability; -use rustc_lint_defs::builtin::UNUSED_ATTRIBUTES; +use rustc_lint_defs::builtin::{HARMFUL_UNUSED_ATTRIBUTES, UNUSED_ATTRIBUTES}; use rustc_lint_defs::{Lint, LintId}; use rustc_parse::parser::Recovery; use rustc_session::Session; @@ -478,6 +478,18 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> { unused_span, ) } + + pub(crate) fn deny_unused_duplicate_future_error( + &mut self, + used_span: Span, + unused_span: Span, + ) { + self.emit_lint( + HARMFUL_UNUSED_ATTRIBUTES, + UnusedDuplicate { this: unused_span, other: used_span, warning: true }, + unused_span, + ) + } } impl<'f, 'sess: 'f> AcceptContext<'f, 'sess> { diff --git a/compiler/rustc_attr_parsing/src/target_checking.rs b/compiler/rustc_attr_parsing/src/target_checking.rs index 5fc0b248110f7..6772fab206606 100644 --- a/compiler/rustc_attr_parsing/src/target_checking.rs +++ b/compiler/rustc_attr_parsing/src/target_checking.rs @@ -6,7 +6,8 @@ use rustc_attr_ir::{AttrItem, Attribute, AttributeKind}; use rustc_errors::{DiagArgValue, MultiSpan, StashKey}; use rustc_feature::Features; use rustc_lint_defs::builtin::{ - MISPLACED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES, USELESS_DEPRECATED, + HARMFUL_UNUSED_ATTRIBUTES, MISPLACED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES, + USELESS_DEPRECATED, }; use rustc_span::{BytePos, FileName, RemapPathScopeComponents, Span, Symbol, sym}; @@ -22,6 +23,7 @@ use crate::{AttributeParser, ShouldEmit}; pub(crate) enum AllowedTargets<'a> { AllowList(&'a [Policy]), AllowListWarnRest(&'a [Policy]), + AllowListDenyRest(&'a [Policy]), /// This is useful for argument-dependent target checking. /// If debug assertions are enabled, /// this emits a delayed bug if the `cx.check_target(...)` method is not called during attribute parsing. @@ -31,6 +33,7 @@ pub(crate) enum AllowedTargets<'a> { pub(crate) enum AllowedResult { Allowed, Warn, + Deny, Error, } @@ -44,6 +47,8 @@ impl AllowedTargets<'_> { AllowedResult::Allowed } else if list.contains(&Policy::Warn(target)) { AllowedResult::Warn + } else if list.contains(&Policy::Deny(target)) { + AllowedResult::Deny } else { AllowedResult::Error } @@ -55,23 +60,40 @@ impl AllowedTargets<'_> { AllowedResult::Allowed } else if list.contains(&Policy::Error(target)) { AllowedResult::Error + } else if list.contains(&Policy::Deny(target)) { + AllowedResult::Deny } else { AllowedResult::Warn } } + AllowedTargets::AllowListDenyRest(list) => { + if list.contains(&Policy::Allow(target)) + || list.contains(&Policy::AllowSilent(target)) + { + AllowedResult::Allowed + } else if list.contains(&Policy::Warn(target)) { + AllowedResult::Warn + } else if list.contains(&Policy::Error(target)) { + AllowedResult::Error + } else { + AllowedResult::Deny + } + } AllowedTargets::ManuallyChecked => unreachable!(), } } pub(crate) fn allowed_targets(&self) -> Vec { match self { - AllowedTargets::AllowList(list) | AllowedTargets::AllowListWarnRest(list) => list, + AllowedTargets::AllowList(list) + | AllowedTargets::AllowListWarnRest(list) + | AllowedTargets::AllowListDenyRest(list) => list, AllowedTargets::ManuallyChecked => unreachable!(), } .iter() .filter_map(|target| match target { Policy::Allow(target) => Some(*target), - Policy::AllowSilent(_) | Policy::Warn(_) | Policy::Error(_) => None, + Policy::AllowSilent(_) | Policy::Warn(_) | Policy::Deny(_) | Policy::Error(_) => None, }) .collect() } @@ -88,6 +110,9 @@ pub(crate) enum Policy { /// Emits a FCW on this target. /// This is useful if the target was previously allowed but should not be. Warn(Target), + /// Emits a FCW on this target. + /// This is useful if the target was previously allowed but should not be. + Deny(Target), /// Emits an error on this target. Error(Target), } @@ -152,7 +177,8 @@ impl<'sess> AttributeParser<'sess> { applied: DiagArgValue::StrListSepByAnd(applied.into_iter().map(Cow::Owned).collect()), attribute_args: attribute_args.to_string(), help: Self::target_checking_help(attribute_args, cx), - previously_accepted: matches!(result, AllowedResult::Warn) && !is_diagnostic_attr, + previously_accepted: matches!(result, AllowedResult::Warn | AllowedResult::Deny) + && !is_diagnostic_attr, on_macro_call: matches!(cx.target, Target::MacroCall), }; @@ -179,6 +205,10 @@ impl<'sess> AttributeParser<'sess> { let attr_span = cx.attr_span; cx.emit_lint(lint, diag, attr_span); } + AllowedResult::Deny => { + let attr_span = cx.attr_span; + cx.emit_lint(HARMFUL_UNUSED_ATTRIBUTES, diag, attr_span); + } AllowedResult::Error => { cx.dcx().emit_err(diag); } diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 2a0901e0243b6..e0743b7812685 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -52,6 +52,7 @@ pub mod hardwired { FLOAT_LITERAL_F32_FALLBACK, FORBIDDEN_LINT_GROUPS, FUNCTION_ITEM_REFERENCES, + HARMFUL_UNUSED_ATTRIBUTES, HIDDEN_GLOB_REEXPORTS, ILL_FORMED_ATTRIBUTE_INPUT, INCOMPLETE_INCLUDE, @@ -878,6 +879,52 @@ declare_lint! { "detects attributes that were not used by the compiler" } +declare_lint! { + /// The `harmful_unused_attributes` lint detects [attributes] that were not used by + /// the compiler and whose unusedness can lead to dangerous bugs and mistakes. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// macro_rules! produce_struct { + /// ($name: ident) => { + /// pub struct $name {} + /// }; + /// } + /// + /// #[repr(align(64))] + /// produce_struct!(Foo); + /// + /// unsafe extern "C" { + /// #[link_name = "foo"] + /// pub fn bar(); + /// + /// #[link(name = "foo")] + /// pub fn buz(); + /// } + /// + /// #[unsafe(export_name = "foo")] + /// #[unsafe(export_name = "bar")] + /// pub fn baz() {} + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// - Attributes applied to a macro invocation are applied on the macro invocation, they do *not* + /// apply to the macro's expansion. The above macro invocation produces a struct with + /// an alignment of 1, *not* 64. + /// - The declaration of `baz` declaration is ambiguous, the `link` attribute shall be used on + /// a extern block to specify the (name of a) native library to link to. + /// - Duplicate `export_name` attributes are ambiguous, only the first attribute is used. + /// + /// [attributes]: https://doc.rust-lang.org/reference/attributes.html + pub HARMFUL_UNUSED_ATTRIBUTES, + Deny, + "detects attributes that were not used by the compiler" +} + declare_lint! { /// The `unreachable_code` lint detects unreachable code paths. /// diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index f6bd780802401..efe09286ad0b6 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -29,9 +29,9 @@ use rustc_hir::{ find_attr, }; use rustc_lint_defs::builtin::{ - CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, MALFORMED_DIAGNOSTIC_ATTRIBUTES, - MALFORMED_DIAGNOSTIC_FORMAT_LITERALS, MISPLACED_DIAGNOSTIC_ATTRIBUTES, REPEATED_REPRS, - UNUSED_ATTRIBUTES, + CONFLICTING_REPR_HINTS, HARMFUL_UNUSED_ATTRIBUTES, INVALID_DOC_ATTRIBUTES, + MALFORMED_DIAGNOSTIC_ATTRIBUTES, MALFORMED_DIAGNOSTIC_FORMAT_LITERALS, + MISPLACED_DIAGNOSTIC_ATTRIBUTES, REPEATED_REPRS, UNUSED_ATTRIBUTES, }; use rustc_macros::Diagnostic; use rustc_middle::hir::nested_filter; @@ -1113,7 +1113,12 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return; } - self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr_span, diagnostics::Link); + self.tcx.emit_node_span_lint( + HARMFUL_UNUSED_ATTRIBUTES, + hir_id, + attr_span, + diagnostics::Link, + ); } /// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument. @@ -1537,7 +1542,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { }; self.tcx.emit_node_span_lint( - UNUSED_ATTRIBUTES, + HARMFUL_UNUSED_ATTRIBUTES, hir_id, no_mangle_span, diagnostics::MixedExportNameAndNoMangle { diff --git a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.fixed b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.fixed index 27886fed501c8..88cc5d38256d5 100644 --- a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.fixed +++ b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.fixed @@ -159,6 +159,7 @@ pub struct MissingEqNonExhaustive { #[derive(Debug, PartialEq)] pub struct MissingEqNonExhaustive1 { foo: u32, + #[expect(harmful_unused_attributes)] #[non_exhaustive] bar: String, } diff --git a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.rs b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.rs index daba28ec20769..dd5f7cdee7903 100644 --- a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.rs +++ b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.rs @@ -159,6 +159,7 @@ pub struct MissingEqNonExhaustive { #[derive(Debug, PartialEq)] pub struct MissingEqNonExhaustive1 { foo: u32, + #[expect(harmful_unused_attributes)] #[non_exhaustive] bar: String, } diff --git a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr index bead6bdcbd596..fed2cf8bf15c3 100644 --- a/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr +++ b/src/tools/clippy/tests/ui/derive_partial_eq_without_eq.stderr @@ -68,13 +68,13 @@ LL | #[derive(PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` error: you are deriving `PartialEq` and can implement `Eq` - --> tests/ui/derive_partial_eq_without_eq.rs:192:14 + --> tests/ui/derive_partial_eq_without_eq.rs:193:14 | LL | #[derive(PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` error: you are deriving `PartialEq` and can implement `Eq` - --> tests/ui/derive_partial_eq_without_eq.rs:201:14 + --> tests/ui/derive_partial_eq_without_eq.rs:202:14 | LL | #[derive(PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` diff --git a/src/tools/miri/test-cargo-miri/issue-rust-86261/src/lib.rs b/src/tools/miri/test-cargo-miri/issue-rust-86261/src/lib.rs index ab0fa8f013968..3f8315c2d90c7 100644 --- a/src/tools/miri/test-cargo-miri/issue-rust-86261/src/lib.rs +++ b/src/tools/miri/test-cargo-miri/issue-rust-86261/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(unused_imports, unused_attributes)] +#![allow(unused_imports, harmful_unused_attributes)] // Regression test for https://github.com/rust-lang/rust/issues/86261: // `#[no_mangle]` on a `use` item. diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 9b878307afc96..ebd5761da436c 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -966,7 +966,7 @@ ui/extern/issue-64655-extern-rust-must-allow-unwind.rs ui/extern/issue-80074.rs ui/extern/issue-95829.rs ui/feature-gates/issue-43106-gating-of-bench.rs -ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +ui/feature-gates/issue-43106-gating-of-builtin-attrs-2.rs ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs ui/feature-gates/issue-43106-gating-of-deprecated.rs ui/feature-gates/issue-43106-gating-of-derive-2.rs diff --git a/tests/codegen-llvm/issues/issue-32031.rs b/tests/codegen-llvm/issues/issue-32031.rs index 559e8d947fba5..763b527c73570 100644 --- a/tests/codegen-llvm/issues/issue-32031.rs +++ b/tests/codegen-llvm/issues/issue-32031.rs @@ -6,7 +6,6 @@ #![crate_type = "lib"] -#[no_mangle] pub struct F32(f32); // other: define{{.*}}float @add_newtype_f32(float %a, float %b) @@ -17,7 +16,6 @@ pub fn add_newtype_f32(a: F32, b: F32) -> F32 { F32(a.0 + b.0) } -#[no_mangle] pub struct F64(f64); // other: define{{.*}}double @add_newtype_f64(double %a, double %b) diff --git a/tests/ui/attributes/attr-on-mac-call.rs b/tests/ui/attributes/attr-on-mac-call.rs index 618e583d0af5e..0c72bd00a1d05 100644 --- a/tests/ui/attributes/attr-on-mac-call.rs +++ b/tests/ui/attributes/attr-on-mac-call.rs @@ -6,10 +6,10 @@ fn main() { #[export_name = "x"] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[unsafe(naked)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[track_caller] //~^ WARN attribute cannot be used on macro calls @@ -18,7 +18,7 @@ fn main() { //~^ WARN attribute cannot be used on macro calls //~| WARN previously accepted #[target_feature(enable = "x")] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[deprecated] //~^ WARN attribute cannot be used on macro calls @@ -27,16 +27,16 @@ fn main() { //~^ WARN attribute cannot be used on macro calls //~| WARN previously accepted #[link_name = "x"] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[link_section = "__TEXT,__text"] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[link_ordinal(42)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[non_exhaustive] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[proc_macro] //~^ WARN attribute cannot be used on macro calls @@ -45,7 +45,7 @@ fn main() { //~^ WARN attribute cannot be used on macro calls //~| WARN previously accepted #[no_mangle] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[deprecated] //~^ WARN attribute cannot be used on macro calls @@ -72,35 +72,35 @@ fn main() { //~^ WARN attribute cannot be used on macro calls //~| WARN previously accepted #[link_name = "x"] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted #[sanitize(address = "off")] //~^ ERROR attribute cannot be used on macro calls unreachable!(); #[repr()] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted //~| WARN unused attribute unreachable!(); #[repr(u8)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted unreachable!(); #[repr(align(8))] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted unreachable!(); #[repr(packed)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted unreachable!(); #[repr(C)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted unreachable!(); #[repr(Rust)] - //~^ WARN attribute cannot be used on macro calls + //~^ ERROR attribute cannot be used on macro calls //~| WARN previously accepted unreachable!(); #[repr(simd)] diff --git a/tests/ui/attributes/attr-on-mac-call.stderr b/tests/ui/attributes/attr-on-mac-call.stderr index aa158bee22768..ac8151da0cd3d 100644 --- a/tests/ui/attributes/attr-on-mac-call.stderr +++ b/tests/ui/attributes/attr-on-mac-call.stderr @@ -44,7 +44,7 @@ error: attribute value must be a literal LL | #[deprecated = concat!("woah", "dude")] | ^^^^^^^^^^^^^^^^^^^^^^^ -warning: the `export_name` attribute cannot be used on macro calls +error: the `export_name` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:8:7 | LL | #[export_name = "x"] @@ -53,13 +53,9 @@ LL | #[export_name = "x"] = help: the `export_name` 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! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -note: the lint level is defined here - --> $DIR/attr-on-mac-call.rs:3:9 - | -LL | #![warn(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: the `naked` attribute cannot be used on macro calls +error: the `naked` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:11:14 | LL | #[unsafe(naked)] @@ -78,6 +74,11 @@ LL | #[track_caller] = help: the `track_caller` attribute can only be applied to functions = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute +note: the lint level is defined here + --> $DIR/attr-on-mac-call.rs:3:9 + | +LL | #![warn(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ warning: the `used` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:17:7 @@ -89,7 +90,7 @@ LL | #[used] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `target_feature` attribute cannot be used on macro calls +error: the `target_feature` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:20:7 | LL | #[target_feature(enable = "x")] @@ -119,7 +120,7 @@ LL | #[inline] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `link_name` attribute cannot be used on macro calls +error: the `link_name` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:29:7 | LL | #[link_name = "x"] @@ -129,7 +130,7 @@ LL | #[link_name = "x"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `link_section` attribute cannot be used on macro calls +error: the `link_section` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:32:7 | LL | #[link_section = "__TEXT,__text"] @@ -139,7 +140,7 @@ 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! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `link_ordinal` attribute cannot be used on macro calls +error: the `link_ordinal` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:35:7 | LL | #[link_ordinal(42)] @@ -149,7 +150,7 @@ LL | #[link_ordinal(42)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `non_exhaustive` attribute cannot be used on macro calls +error: the `non_exhaustive` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:38:7 | LL | #[non_exhaustive] @@ -179,7 +180,7 @@ LL | #[cold] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `no_mangle` attribute cannot be used on macro calls +error: the `no_mangle` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:47:7 | LL | #[no_mangle] @@ -269,7 +270,7 @@ 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! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `link_name` attribute cannot be used on macro calls +error: the `link_name` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:74:7 | LL | #[link_name = "x"] @@ -279,7 +280,7 @@ LL | #[link_name = "x"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `repr()` attribute cannot be used on macro calls +error: the `repr()` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:81:7 | LL | #[repr()] @@ -297,7 +298,7 @@ LL | #[repr()] | = note: using `repr` with an empty list has no effect -warning: the `repr(u8)` attribute cannot be used on macro calls +error: the `repr(u8)` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:86:7 | LL | #[repr(u8)] @@ -307,7 +308,7 @@ LL | #[repr(u8)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `repr(align(...))` attribute cannot be used on macro calls +error: the `repr(align(...))` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:90:7 | LL | #[repr(align(8))] @@ -317,7 +318,7 @@ LL | #[repr(align(8))] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `repr(packed)` attribute cannot be used on macro calls +error: the `repr(packed)` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:94:7 | LL | #[repr(packed)] @@ -327,7 +328,7 @@ LL | #[repr(packed)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `repr(C)` attribute cannot be used on macro calls +error: the `repr(C)` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:98:7 | LL | #[repr(C)] @@ -337,7 +338,7 @@ LL | #[repr(C)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -warning: the `repr(Rust)` attribute cannot be used on macro calls +error: the `repr(Rust)` attribute cannot be used on macro calls --> $DIR/attr-on-mac-call.rs:102:7 | LL | #[repr(Rust)] @@ -347,6 +348,6 @@ LL | #[repr(Rust)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute -error: aborting due to 5 previous errors; 30 warnings emitted +error: aborting due to 20 previous errors; 15 warnings emitted For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/attributes/codegen_attr_on_required_trait_method.rs b/tests/ui/attributes/codegen_attr_on_required_trait_method.rs index 737ebf7f2b144..a4baa3a7c77a7 100644 --- a/tests/ui/attributes/codegen_attr_on_required_trait_method.rs +++ b/tests/ui/attributes/codegen_attr_on_required_trait_method.rs @@ -8,7 +8,7 @@ trait Test { //~| WARN previously accepted fn method1(&self); #[link_section = "__TEXT,__text"] - //~^ ERROR cannot be used on required trait methods [unused_attributes] + //~^ ERROR cannot be used on required trait methods [harmful_unused_attributes] //~| WARN previously accepted fn method2(&self); #[linkage = "common"] diff --git a/tests/ui/attributes/codegen_attr_on_required_trait_method.stderr b/tests/ui/attributes/codegen_attr_on_required_trait_method.stderr index b5452ba2882c0..3fcb321f63be8 100644 --- a/tests/ui/attributes/codegen_attr_on_required_trait_method.stderr +++ b/tests/ui/attributes/codegen_attr_on_required_trait_method.stderr @@ -28,6 +28,7 @@ LL | #[link_section = "__TEXT,__text"] | = help: the `link_section` attribute can be applied to functions with a body 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! + = note: `#[deny(harmful_unused_attributes)]` on by default error: aborting due to 3 previous errors diff --git a/tests/ui/attributes/link-name-on-static.rs b/tests/ui/attributes/link-name-on-static.rs index 85082d3a43fb4..baef1ade5ba24 100644 --- a/tests/ui/attributes/link-name-on-static.rs +++ b/tests/ui/attributes/link-name-on-static.rs @@ -1,11 +1,11 @@ #[link_name = "VALUE"] -//~^ WARN the `link_name` attribute cannot be used on statics +//~^ ERROR the `link_name` attribute cannot be used on statics //~| WARN this was previously accepted by the compiler but is being phased out static VALUE_DEFINITION: u8 = 0; #[unsafe(link_name = "UNSAFE_VALUE")] //~^ ERROR `link_name` is not an unsafe attribute -//~| WARN the `link_name` attribute cannot be used on statics +//~| ERROR the `link_name` attribute cannot be used on statics //~| WARN this was previously accepted by the compiler but is being phased out static UNSAFE_VALUE_DEFINITION: u8 = 0; diff --git a/tests/ui/attributes/link-name-on-static.stderr b/tests/ui/attributes/link-name-on-static.stderr index 2d768acd51bfb..dee07e95eb2d1 100644 --- a/tests/ui/attributes/link-name-on-static.stderr +++ b/tests/ui/attributes/link-name-on-static.stderr @@ -6,7 +6,7 @@ LL | #[unsafe(link_name = "UNSAFE_VALUE")] | = note: extraneous unsafe is not allowed in attributes -warning: the `link_name` attribute cannot be used on statics +error: the `link_name` attribute cannot be used on statics --> $DIR/link-name-on-static.rs:1:3 | LL | #[link_name = "VALUE"] @@ -14,14 +14,14 @@ LL | #[link_name = "VALUE"] | = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: requested on the command line with `-W unused-attributes` + = note: `#[deny(harmful_unused_attributes)]` on by default help: did you mean to use `#[export_name]`? | LL - #[link_name = "VALUE"] LL + #[unsafe(export_name = "VALUE")] | -warning: the `link_name` attribute cannot be used on statics +error: the `link_name` attribute cannot be used on statics --> $DIR/link-name-on-static.rs:6:10 | LL | #[unsafe(link_name = "UNSAFE_VALUE")] @@ -35,5 +35,5 @@ LL - #[unsafe(link_name = "UNSAFE_VALUE")] LL + #[unsafe(export_name = "UNSAFE_VALUE")] | -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 36ad21a54bd51..159ca1c03d406 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -84,11 +84,11 @@ //~^ ERROR malformed #[link] //~^ ERROR malformed -//~| WARN attribute cannot be used on +//~| ERROR attribute cannot be used on //~| WARN previously accepted #[link_name] //~^ ERROR malformed -//~| WARN cannot be used on functions +//~| ERROR cannot be used on functions //~| WARN previously accepted #[link_section] //~^ ERROR malformed diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 72e7776e09209..077678d0d575a 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -896,7 +896,7 @@ LL | | } | |_^ = note: requested on the command line with `-W unused-attributes` -warning: the `link` attribute cannot be used on functions +error: the `link` attribute cannot be used on functions --> $DIR/malformed-attrs.rs:85:3 | LL | #[link] @@ -904,8 +904,9 @@ LL | #[link] | = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: the `link_name` attribute cannot be used on functions +error: the `link_name` attribute cannot be used on functions --> $DIR/malformed-attrs.rs:89:3 | LL | #[link_name] @@ -984,7 +985,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 76 previous errors; 6 warnings emitted Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed index 55c196f6decaa..a7f0fed11c229 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed @@ -1,13 +1,11 @@ // issue: rust-lang/rust#47446 //@ run-rustfix -//@ check-pass -#![warn(unused_attributes)] -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ ERROR `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [harmful_unused_attributes] #[export_name = "foo"] pub fn bar() {} -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ ERROR `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [harmful_unused_attributes] #[export_name = "baz"] pub fn bak() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs index 79f1e5c19c544..062f2ee351fb8 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs @@ -1,15 +1,13 @@ // issue: rust-lang/rust#47446 //@ run-rustfix -//@ check-pass -#![warn(unused_attributes)] #[no_mangle] -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ ERROR `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [harmful_unused_attributes] #[export_name = "foo"] pub fn bar() {} #[unsafe(no_mangle)] -//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +//~^ ERROR `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [harmful_unused_attributes] #[export_name = "baz"] pub fn bak() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr index 1dcaa636800be..126c80a226314 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr @@ -1,32 +1,28 @@ -warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` - --> $DIR/mixed_export_name_and_no_mangle.rs:6:1 +error: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:4:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ `#[no_mangle]` is ignored | note: `#[export_name]` takes precedence - --> $DIR/mixed_export_name_and_no_mangle.rs:8:1 + --> $DIR/mixed_export_name_and_no_mangle.rs:6:1 | LL | #[export_name = "foo"] | ^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/mixed_export_name_and_no_mangle.rs:5:9 - | -LL | #![warn(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = note: `#[deny(harmful_unused_attributes)]` on by default help: remove the `#[no_mangle]` attribute | LL - #[no_mangle] | -warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` - --> $DIR/mixed_export_name_and_no_mangle.rs:11:1 +error: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:9:1 | LL | #[unsafe(no_mangle)] | ^^^^^^^^^^^^^^^^^^^^ `#[no_mangle]` is ignored | note: `#[export_name]` takes precedence - --> $DIR/mixed_export_name_and_no_mangle.rs:13:1 + --> $DIR/mixed_export_name_and_no_mangle.rs:11:1 | LL | #[export_name = "baz"] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -35,5 +31,5 @@ help: remove the `#[no_mangle]` attribute LL - #[unsafe(no_mangle)] | -warning: 2 warnings emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.fixed b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.fixed index 581cb200770ab..220f95be2c6cd 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.fixed +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.fixed @@ -1,14 +1,13 @@ // issue: rust-lang/rust#47446 //@ run-rustfix -//@ check-pass //@ edition:2024 #![warn(unused_attributes)] -//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [unused_attributes] +//~^ ERROR `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [harmful_unused_attributes] #[unsafe(export_name = "foo")] pub fn bar() {} -//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [unused_attributes] +//~^ ERROR `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [harmful_unused_attributes] #[unsafe(export_name = "baz")] pub fn bak() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.rs b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.rs index 1e4a06132f299..4ea5414c9a76a 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.rs +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.rs @@ -1,16 +1,15 @@ // issue: rust-lang/rust#47446 //@ run-rustfix -//@ check-pass //@ edition:2024 #![warn(unused_attributes)] #[unsafe(no_mangle)] -//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [unused_attributes] +//~^ ERROR `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [harmful_unused_attributes] #[unsafe(export_name = "foo")] pub fn bar() {} #[unsafe(no_mangle)] -//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [unused_attributes] +//~^ ERROR `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` [harmful_unused_attributes] #[unsafe(export_name = "baz")] pub fn bak() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.stderr b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.stderr index 09804f9f92b68..8ee803ca06e66 100644 --- a/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.stderr +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle_2024.stderr @@ -1,32 +1,28 @@ -warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` - --> $DIR/mixed_export_name_and_no_mangle_2024.rs:7:1 +error: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` + --> $DIR/mixed_export_name_and_no_mangle_2024.rs:6:1 | LL | #[unsafe(no_mangle)] | ^^^^^^^^^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored | note: `#[unsafe(export_name)]` takes precedence - --> $DIR/mixed_export_name_and_no_mangle_2024.rs:9:1 + --> $DIR/mixed_export_name_and_no_mangle_2024.rs:8:1 | LL | #[unsafe(export_name = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/mixed_export_name_and_no_mangle_2024.rs:6:9 - | -LL | #![warn(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = note: `#[deny(harmful_unused_attributes)]` on by default help: remove the `#[unsafe(no_mangle)]` attribute | LL - #[unsafe(no_mangle)] | -warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` - --> $DIR/mixed_export_name_and_no_mangle_2024.rs:12:1 +error: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[unsafe(export_name)]` + --> $DIR/mixed_export_name_and_no_mangle_2024.rs:11:1 | LL | #[unsafe(no_mangle)] | ^^^^^^^^^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored | note: `#[unsafe(export_name)]` takes precedence - --> $DIR/mixed_export_name_and_no_mangle_2024.rs:14:1 + --> $DIR/mixed_export_name_and_no_mangle_2024.rs:13:1 | LL | #[unsafe(export_name = "baz")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,5 +31,5 @@ help: remove the `#[unsafe(no_mangle)]` attribute LL - #[unsafe(no_mangle)] | -warning: 2 warnings emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/attributes/positions/link-section.rs b/tests/ui/attributes/positions/link-section.rs index a7d39b690664c..8fd907e13f37b 100644 --- a/tests/ui/attributes/positions/link-section.rs +++ b/tests/ui/attributes/positions/link-section.rs @@ -2,10 +2,9 @@ #![crate_type = "lib"] //@ edition:2024 -//@ check-pass // Regression test for . unsafe extern "C" { - #[unsafe(link_section = "__DATA,__buffer")] //~ WARN attribute cannot be used on foreign statics + #[unsafe(link_section = "__DATA,__buffer")] //~ ERROR attribute cannot be used on foreign statics //~| WARN previously accepted pub static mut a: [u8; 1024]; } diff --git a/tests/ui/attributes/positions/link-section.stderr b/tests/ui/attributes/positions/link-section.stderr index 56aa525e72387..257a28f6488a5 100644 --- a/tests/ui/attributes/positions/link-section.stderr +++ b/tests/ui/attributes/positions/link-section.stderr @@ -1,12 +1,12 @@ -warning: the `link_section` attribute cannot be used on foreign statics - --> $DIR/link-section.rs:8:14 +error: the `link_section` attribute cannot be used on foreign statics + --> $DIR/link-section.rs:7:14 | LL | #[unsafe(link_section = "__DATA,__buffer")] | ^^^^^^^^^^^^ | = help: the `link_section` 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! - = note: requested on the command line with `-W unused-attributes` + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs index 907e1b966766f..08b46eebfb135 100644 --- a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.rs @@ -42,7 +42,7 @@ struct S11; struct S12; #[cfg_attr(true, link_section)] //~ ERROR malformed `link_section` attribute input -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted struct S13; diff --git a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr index f21c791cdf7f4..b2d0673002569 100644 --- a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr @@ -174,7 +174,7 @@ LL | #[cfg_attr(true, inline(always))] LL | #[cfg_attr(true, inline(never))] | +++++ -warning: the `link_section` attribute cannot be used on structs +error: the `link_section` attribute cannot be used on structs --> $DIR/cfg_attr-attr-syntax-validation.rs:44:18 | LL | #[cfg_attr(true, link_section)] @@ -182,9 +182,9 @@ LL | #[cfg_attr(true, link_section)] | = help: the `link_section` 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! - = note: requested on the command line with `-W unused-attributes` + = note: `#[deny(harmful_unused_attributes)]` on by default -error: aborting due to 13 previous errors; 1 warning emitted +error: aborting due to 14 previous errors Some errors have detailed explanations: E0539, E0565, E0805. For more information about an error, try `rustc --explain E0539`. diff --git a/tests/ui/extern/extern-no-mangle.rs b/tests/ui/extern/extern-no-mangle.rs index 6f2d125b92306..835d3527903cc 100644 --- a/tests/ui/extern/extern-no-mangle.rs +++ b/tests/ui/extern/extern-no-mangle.rs @@ -1,20 +1,16 @@ -#![warn(unused_attributes)] - // Tests that placing the #[no_mangle] attribute on a foreign fn or static emits // a specialized warning. // The previous warning only talks about a "function or static" but foreign fns/statics // are also not allowed to have #[no_mangle] -//@ build-pass - extern "C" { #[no_mangle] - //~^ WARNING attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted pub static FOO: u8; #[no_mangle] - //~^ WARNING attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted pub fn bar(); } @@ -22,7 +18,7 @@ extern "C" { fn no_new_warn() { // Should emit the generic "not a function or static" warning #[no_mangle] - //~^ WARNING attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted let x = 0_u8; } diff --git a/tests/ui/extern/extern-no-mangle.stderr b/tests/ui/extern/extern-no-mangle.stderr index 210beb1e70929..a00672e908814 100644 --- a/tests/ui/extern/extern-no-mangle.stderr +++ b/tests/ui/extern/extern-no-mangle.stderr @@ -1,19 +1,15 @@ -warning: the `no_mangle` attribute cannot be used on statements - --> $DIR/extern-no-mangle.rs:24:7 +error: the `no_mangle` attribute cannot be used on statements + --> $DIR/extern-no-mangle.rs:20:7 | 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! -note: the lint level is defined here - --> $DIR/extern-no-mangle.rs:1:9 - | -LL | #![warn(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: the `no_mangle` attribute cannot be used on foreign statics - --> $DIR/extern-no-mangle.rs:11:7 +error: the `no_mangle` attribute cannot be used on foreign statics + --> $DIR/extern-no-mangle.rs:7:7 | LL | #[no_mangle] | ^^^^^^^^^ @@ -21,8 +17,8 @@ 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! -warning: the `no_mangle` attribute cannot be used on foreign functions - --> $DIR/extern-no-mangle.rs:16:7 +error: the `no_mangle` attribute cannot be used on foreign functions + --> $DIR/extern-no-mangle.rs:12:7 | LL | #[no_mangle] | ^^^^^^^^^ @@ -30,5 +26,5 @@ LL | #[no_mangle] = help: the `no_mangle` attribute can be applied to functions with a body 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! -warning: 3 warnings emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/extern/issue-47725.rs b/tests/ui/extern/issue-47725.rs index 6941508e6e5e4..ada950daa55ea 100644 --- a/tests/ui/extern/issue-47725.rs +++ b/tests/ui/extern/issue-47725.rs @@ -1,15 +1,15 @@ //@ reference: items.extern.attributes.link_name.allowed-positions -#![warn(unused_attributes)] //~ NOTE lint level is defined here #[link_name = "foo"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute +//~| NOTE `#[deny(harmful_unused_attributes)]` on by default struct Foo; #[link_name = "foobar"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -20,7 +20,7 @@ extern "C" { #[link_name] //~^ ERROR malformed `link_name` attribute input //~| HELP must be of the form -//~| WARN attribute cannot be used on +//~| ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP remove the attribute //~| HELP can be applied to diff --git a/tests/ui/extern/issue-47725.stderr b/tests/ui/extern/issue-47725.stderr index 2dd8a2191d89b..e426804e3d9c4 100644 --- a/tests/ui/extern/issue-47725.stderr +++ b/tests/ui/extern/issue-47725.stderr @@ -10,21 +10,17 @@ help: must be of the form LL | #[link_name = "name"] | ++++++++ -warning: the `link_name` attribute cannot be used on structs - --> $DIR/issue-47725.rs:4:3 +error: the `link_name` attribute cannot be used on structs + --> $DIR/issue-47725.rs:3:3 | LL | #[link_name = "foo"] | ^^^^^^^^^ | = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -note: the lint level is defined here - --> $DIR/issue-47725.rs:2:9 - | -LL | #![warn(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: the `link_name` attribute cannot be used on foreign modules +error: the `link_name` attribute cannot be used on foreign modules --> $DIR/issue-47725.rs:11:3 | LL | #[link_name = "foobar"] @@ -33,7 +29,7 @@ LL | #[link_name = "foobar"] = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on foreign modules +error: the `link_name` attribute cannot be used on foreign modules --> $DIR/issue-47725.rs:20:3 | LL | #[link_name] @@ -42,6 +38,6 @@ LL | #[link_name] = help: the `link_name` attribute can be applied to foreign functions and foreign 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 1 previous error; 3 warnings emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0539`. 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-2.rs similarity index 93% rename from tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs rename to tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-2.rs index 3cc404416839e..38d72e058292b 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-2.rs @@ -1,10 +1,5 @@ // This is testing whether various builtin attributes signals an // error or warning when put in "weird" places. -// -// (This file sits on its own because it actually signals an error, -// which would mess up the treatment of other cases in -// issue-43106-gating-of-builtin-attrs.rs) - #![macro_export] //~^ ERROR: the `macro_export` attribute cannot be used on crates @@ -17,15 +12,16 @@ //~^ ERROR: attribute cannot be used //~| WARN unused attribute //~| NOTE empty list has no effect +//~| NOTE requested on the command line with `-W unused-attributes` #![path = "3800"] //~^ ERROR: attribute cannot be used on #![automatically_derived] //~^ ERROR: attribute cannot be used on #![no_mangle] -//~^ WARN may not be used in combination with `#[export_name]` +//~^ ERROR may not be used in combination with `#[export_name]` //~| NOTE is ignored -//~| NOTE requested on the command line -//~| WARN cannot be used on crates +//~| NOTE `#[deny(harmful_unused_attributes)]` on by default +//~| ERROR cannot be used on crates //~| WARN previously accepted #![no_link] //~^ ERROR: the `no_link` attribute cannot be used on crates 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-2.stderr similarity index 77% rename from tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr rename to tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-2.stderr index 44f7d6942a3a1..652b63c38b819 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-2.stderr @@ -1,5 +1,5 @@ error: the `macro_export` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:9:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:4:4 | LL | #![macro_export] | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #![macro_export] = help: the `macro_export` attribute can only be applied to macro defs error[E0658]: use of an internal attribute - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:11:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:6:4 | LL | #![rustc_main] | ^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | #![rustc_main] = note: the `rustc_main` attribute is used internally to specify test entry point function error: the `rustc_main` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:11:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:6:4 | LL | #![rustc_main] | ^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | #![rustc_main] = help: the `rustc_main` attribute can only be applied to functions error: the `repr()` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:11:4 | LL | #![repr()] | ^^^^^^ @@ -33,7 +33,7 @@ LL | #![repr()] = help: the `repr()` attribute can only be applied to data types error: the `path` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:20:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:16:4 | LL | #![path = "3800"] | ^^^^ @@ -41,7 +41,7 @@ LL | #![path = "3800"] = help: the `path` attribute can only be applied to modules error: the `automatically_derived` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:22:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:18:4 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | #![automatically_derived] = help: the `automatically_derived` attribute can only be applied to trait impl blocks error: the `no_link` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:4 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:26:4 | LL | #![no_link] | ^^^^^^^ @@ -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-2.rs:28: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-2.rs:31: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-2.rs:33: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-2.rs:36: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-2.rs:45: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-2.rs:48: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-2.rs:51: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-2.rs:55: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-2.rs:58: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-2.rs:61: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-2.rs:71: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-2.rs:80: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-2.rs:83: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-2.rs:92: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-2.rs:95: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-2.rs:100: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-2.rs:103: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-2.rs:106: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-2.rs:110: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-2.rs:117: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-2.rs:120: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-2.rs:123: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-2.rs:128: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-2.rs:131: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-2.rs:136: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-2.rs:139: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-2.rs:142: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-2.rs:147:7 | LL | #[repr(Rust)] type T = S; | ^^^^^^^^^^ @@ -281,40 +281,41 @@ 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-2.rs:150:7 | LL | #[repr(Rust)] impl S { } | ^^^^^^^^^^ | = help: the `repr(Rust)` attribute can only be applied to data types -warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:24:1 +error: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:20:1 | 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-2.rs:28:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: requested on the command line with `-W unused-attributes` + = note: `#[deny(harmful_unused_attributes)]` on by default help: remove the `#[no_mangle]` attribute | LL - #![no_mangle] | warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:11:1 | LL | #![repr()] | ^^^^^^^^^^ help: remove this attribute | = note: using `repr` with an empty list has no effect + = note: requested on the command line with `-W unused-attributes` -warning: the `no_mangle` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:24:4 +error: the `no_mangle` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:20:4 | LL | #![no_mangle] | ^^^^^^^^^ @@ -323,7 +324,7 @@ 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! 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-2.rs:39:7 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^ @@ -333,7 +334,7 @@ LL | #[inline = "2100"] fn f() { } = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default 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-2.rs:64:15 | LL | #[no_link] | ^^^^^^^ @@ -342,7 +343,7 @@ 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! 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-2.rs:74:11 | LL | #[no_link] | ^^^^^^^ @@ -351,7 +352,7 @@ 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! 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-2.rs:86:7 | LL | #[no_link] | ^^^^^^^ @@ -359,12 +360,12 @@ 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: aborting due to 39 previous errors; 4 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`, `inline(always)`, and `inline(never)` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:7 + --> $DIR/issue-43106-gating-of-builtin-attrs-2.rs:39:7 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index adbf64e8b0f63..3b3e7ee3e1fed 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -1,36 +1,5 @@ -// This test enumerates as many compiler-builtin ungated attributes as -// possible (that is, all the mutually compatible ones), and checks -// that we get "expected" (*) warnings for each in the various weird -// places that users might put them in the syntax. -// -// (*): The word "expected" is in quotes above because the cases where -// warnings are and are not emitted might not match a user's intuition -// nor the rustc developers' intent. I am really just trying to -// capture today's behavior in a test, not so that it become enshrined -// as the absolute behavior going forward, but rather so that we do -// not change the behavior in the future without even being *aware* of -// the change when it happens. -// -// At the time of authoring, the attributes here are listed in the -// order that they occur in `librustc_feature`. -// -// Any builtin attributes that: -// -// - are not stable, or -// -// - could not be included here covering the same cases as the other -// attributes without raising an *error* from rustc (note though -// that warnings are of course expected) -// -// have their own test case referenced by filename in an inline -// comment. -// -// The test feeds numeric inputs to each attribute that accepts them -// without error. We do this for two reasons: (1.) to exercise how -// inputs are handled by each, and (2.) to ease searching for related -// occurrences in the source text. - -//@ check-pass +// This is testing whether various builtin attributes signals an +// error or warning when put in "weird" places. #![warn(unused_attributes, unknown_lints)] //~^ NOTE the lint level is defined here @@ -69,17 +38,17 @@ //~| WARN previously accepted //~| HELP can only be applied to //~| HELP remove the attribute -#![link(name = "x")] //~ WARN attribute cannot be used on +#![link(name = "x")] //~ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #![link_name = "1900"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #![link_section = ",1800"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -331,13 +300,13 @@ mod automatically_derived { } #[no_mangle] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute mod no_mangle { mod inner { #![no_mangle] } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -345,32 +314,32 @@ mod no_mangle { #[no_mangle] fn f() { } #[no_mangle] struct S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[no_mangle] type T = S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[no_mangle] impl S { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute trait Tr { #[no_mangle] fn foo(); - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[no_mangle] fn bar() {} - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -581,57 +550,57 @@ mod cold { } #[link_name = "1900"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute mod link_name { #[link_name = "1900"] - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute extern "C" { } mod inner { #![link_name="1900"] } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_name = "1900"] fn f() { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_name = "1900"] struct S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_name = "1900"] type T = S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_name = "1900"] impl S { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute } #[link_section = ",1800"] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute mod link_section { mod inner { #![link_section=",1800"] } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -639,31 +608,31 @@ mod link_section { #[link_section = ",1800"] fn f() { } #[link_section = ",1800"] struct S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_section = ",1800"] type T = S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_section = ",1800"] impl S { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute #[link_section = ",1800"] - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute trait Tr { #[link_section = ",1800"] - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN previously accepted //~| HELP can be applied to //~| HELP remove the attribute @@ -691,44 +660,45 @@ mod link_section { // Note that this is a `check-pass` test, so it will never invoke the linker. #[link(name = "x")] -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute mod link { mod inner { #![link(name = "x")] } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #[link(name = "x")] fn f() { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #[link(name = "x")] struct S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #[link(name = "x")] type T = S; - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #[link(name = "x")] impl S { } - //~^ WARN attribute cannot be used on + //~^ ERROR attribute cannot be used on //~| WARN this was previously accepted //~| HELP can only be applied to foreign modules //~| HELP remove the attribute #[link(name = "x")] extern "Rust" {} - //~^ WARN attribute should be applied to an `extern` block + //~^ ERROR attribute should be applied to an `extern` block //~| WARN this was previously accepted + //~| NOTE `#[deny(harmful_unused_attributes)]` on by default } struct StructForDeprecated; diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index a677339551153..3134ea3ac2bda 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -7,187 +7,187 @@ LL | mod inner { #![macro_escape] } = help: try an outer attribute: `#[macro_use]` warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:10:9 | LL | #![warn(x5400)] | ^^^^^ | note: the lint level is defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:35:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:4:28 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:42:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:11:10 | LL | #![allow(x5300)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:11 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:12:11 | LL | #![forbid(x5200)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:13:9 | LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:81:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:87:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:90:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:93:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:96:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:100:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:103:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:106:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:109:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:169:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:178:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:101:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:12 | LL | #![feature(rust1)] | ^^^^^ @@ -195,28 +195,29 @@ LL | #![feature(rust1)] = note: `#[warn(stable_features)]` on by default warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:226:9 | LL | #![path="3800"] | ^^^^^^^^^^^^^^^ help: remove this attribute | = note: `#[path]` is unused on this inline module note: the lint level is defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:35:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:4:9 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ -warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5 +error: attribute should be applied to an `extern` block with non-Rust ABI + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:698:5 | LL | #[link(name = "x")] extern "Rust" {} | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: `#[deny(harmful_unused_attributes)]` on by default warning: the `macro_use` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:14:4 | LL | #![macro_use] | ^^^^^^^^^ @@ -225,7 +226,7 @@ LL | #![macro_use] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `should_panic` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:20:4 | LL | #![should_panic] | ^^^^^^^^^^^^ @@ -234,7 +235,7 @@ 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! warning: the `ignore` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:24:4 | LL | #![ignore] | ^^^^^^ @@ -243,7 +244,7 @@ LL | #![ignore] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `proc_macro_derive` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:32:4 | LL | #![proc_macro_derive(Test)] | ^^^^^^^^^^^^^^^^^ @@ -252,7 +253,7 @@ LL | #![proc_macro_derive(Test)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `cold` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:37:4 | LL | #![cold] | ^^^^ @@ -260,8 +261,8 @@ LL | #![cold] = help: the `cold` attribute can only be applied to functions = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:4 +error: the `link` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:4 | LL | #![link(name = "x")] | ^^^^ @@ -269,8 +270,8 @@ LL | #![link(name = "x")] = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:76:4 +error: the `link_name` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:4 | LL | #![link_name = "1900"] | ^^^^^^^^^ @@ -278,8 +279,8 @@ LL | #![link_name = "1900"] = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_section` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:81:4 +error: the `link_section` attribute cannot be used on crates + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:4 | LL | #![link_section = ",1800"] | ^^^^^^^^^^^^ @@ -288,7 +289,7 @@ LL | #![link_section = ",1800"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `must_use` attribute cannot be used on crates - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:86:4 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:4 | LL | #![must_use] | ^^^^^^^^ @@ -297,7 +298,7 @@ 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! warning: the `macro_use` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:192:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:7 | LL | #[macro_use] fn f() { } | ^^^^^^^^^ @@ -306,7 +307,7 @@ LL | #[macro_use] 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! warning: the `macro_use` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:7 | LL | #[macro_use] struct S; | ^^^^^^^^^ @@ -315,7 +316,7 @@ LL | #[macro_use] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `macro_use` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:7 | LL | #[macro_use] type T = S; | ^^^^^^^^^ @@ -324,7 +325,7 @@ LL | #[macro_use] 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! warning: the `macro_use` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:7 | LL | #[macro_use] impl S { } | ^^^^^^^^^ @@ -333,7 +334,7 @@ LL | #[macro_use] 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! warning: the `macro_export` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:217:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:186:3 | LL | #[macro_export] | ^^^^^^^^^^^^ @@ -342,7 +343,7 @@ LL | #[macro_export] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `macro_export` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:223:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:192:20 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^ @@ -351,7 +352,7 @@ LL | mod inner { #![macro_export] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `macro_export` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:229:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:7 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^ @@ -360,7 +361,7 @@ LL | #[macro_export] 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! warning: the `macro_export` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:7 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^ @@ -369,7 +370,7 @@ LL | #[macro_export] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `macro_export` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:7 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^ @@ -378,7 +379,7 @@ LL | #[macro_export] 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! warning: the `macro_export` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:247:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:7 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^ @@ -387,7 +388,7 @@ LL | #[macro_export] 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! warning: the `path` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:232:7 | LL | #[path = "3800"] fn f() { } | ^^^^ @@ -396,7 +397,7 @@ LL | #[path = "3800"] 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! warning: the `path` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:7 | LL | #[path = "3800"] struct S; | ^^^^ @@ -405,7 +406,7 @@ LL | #[path = "3800"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `path` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:275:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:244:7 | LL | #[path = "3800"] type T = S; | ^^^^ @@ -414,7 +415,7 @@ LL | #[path = "3800"] 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! warning: the `path` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:250:7 | LL | #[path = "3800"] impl S { } | ^^^^ @@ -423,7 +424,7 @@ LL | #[path = "3800"] 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! warning: the `automatically_derived` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:288:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:3 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^ @@ -432,7 +433,7 @@ LL | #[automatically_derived] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `automatically_derived` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:294:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:20 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^ @@ -441,7 +442,7 @@ LL | mod inner { #![automatically_derived] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `automatically_derived` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:300:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:7 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -450,7 +451,7 @@ LL | #[automatically_derived] 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! warning: the `automatically_derived` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:306:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:275:7 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -459,7 +460,7 @@ LL | #[automatically_derived] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `automatically_derived` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:312:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:7 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -468,7 +469,7 @@ LL | #[automatically_derived] 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! warning: the `automatically_derived` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:7 | LL | #[automatically_derived] trait W { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -477,7 +478,7 @@ LL | #[automatically_derived] trait W { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `automatically_derived` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:293:7 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -485,8 +486,8 @@ LL | #[automatically_derived] impl S { } = 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! -warning: the `no_mangle` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:333:3 +error: the `no_mangle` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:3 | LL | #[no_mangle] | ^^^^^^^^^ @@ -494,8 +495,8 @@ 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! -warning: the `no_mangle` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:20 +error: the `no_mangle` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:20 | LL | mod inner { #![no_mangle] } | ^^^^^^^^^ @@ -503,8 +504,8 @@ LL | mod inner { #![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! -warning: the `no_mangle` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:7 +error: the `no_mangle` attribute cannot be used on structs + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:7 | LL | #[no_mangle] struct S; | ^^^^^^^^^ @@ -512,8 +513,8 @@ LL | #[no_mangle] struct S; = 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! -warning: the `no_mangle` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:353:7 +error: the `no_mangle` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:322:7 | LL | #[no_mangle] type T = S; | ^^^^^^^^^ @@ -521,8 +522,8 @@ LL | #[no_mangle] type T = S; = 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! -warning: the `no_mangle` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:7 +error: the `no_mangle` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:328:7 | LL | #[no_mangle] impl S { } | ^^^^^^^^^ @@ -531,7 +532,7 @@ LL | #[no_mangle] 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! warning: the `should_panic` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:3 | LL | #[should_panic] | ^^^^^^^^^^^^ @@ -540,7 +541,7 @@ 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! warning: the `should_panic` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:20 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^ @@ -549,7 +550,7 @@ LL | mod inner { #![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! warning: the `should_panic` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:7 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^ @@ -558,7 +559,7 @@ LL | #[should_panic] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `should_panic` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:400:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:369:7 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^ @@ -567,7 +568,7 @@ LL | #[should_panic] 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! warning: the `should_panic` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:7 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^ @@ -576,7 +577,7 @@ LL | #[should_panic] 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! warning: the `ignore` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:3 | LL | #[ignore] | ^^^^^^ @@ -585,7 +586,7 @@ LL | #[ignore] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `ignore` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:20 | LL | mod inner { #![ignore] } | ^^^^^^ @@ -594,7 +595,7 @@ LL | mod inner { #![ignore] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `ignore` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:7 | LL | #[ignore] struct S; | ^^^^^^ @@ -603,7 +604,7 @@ LL | #[ignore] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `ignore` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:7 | LL | #[ignore] type T = S; | ^^^^^^ @@ -612,7 +613,7 @@ LL | #[ignore] 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! warning: the `ignore` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:7 | LL | #[ignore] impl S { } | ^^^^^^ @@ -621,7 +622,7 @@ LL | #[ignore] 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! warning: the `no_implicit_prelude` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:450:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:7 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^ @@ -630,7 +631,7 @@ LL | #[no_implicit_prelude] 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! warning: the `no_implicit_prelude` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:456:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:7 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^ @@ -639,7 +640,7 @@ LL | #[no_implicit_prelude] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `no_implicit_prelude` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:431:7 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^ @@ -648,7 +649,7 @@ LL | #[no_implicit_prelude] 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! warning: the `no_implicit_prelude` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:468:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:437:7 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^ @@ -657,7 +658,7 @@ LL | #[no_implicit_prelude] 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! warning: the `macro_escape` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:7 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^ @@ -666,7 +667,7 @@ LL | #[macro_escape] 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! warning: the `macro_escape` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:7 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^ @@ -675,7 +676,7 @@ LL | #[macro_escape] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `macro_escape` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:7 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^ @@ -684,7 +685,7 @@ LL | #[macro_escape] 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! warning: the `macro_escape` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:7 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^ @@ -693,13 +694,13 @@ LL | #[macro_escape] 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! warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:477:1 | LL | #[no_std] | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:1 | LL | / mod no_std { LL | | @@ -709,61 +710,61 @@ LL | | } | |_^ warning: the `#![no_std]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:15 | LL | #[no_std] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 | LL | #[no_std] struct S; | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:15 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:15 | LL | #[no_std] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:15 | LL | #[no_std] impl S { } | ^^^^^^^^^^ warning: the `cold` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:549:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:3 | LL | #[cold] | ^^^^ @@ -772,7 +773,7 @@ LL | #[cold] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `cold` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:556:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:525:20 | LL | mod inner { #![cold] } | ^^^^ @@ -781,7 +782,7 @@ LL | mod inner { #![cold] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `cold` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:564:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:7 | LL | #[cold] struct S; | ^^^^ @@ -790,7 +791,7 @@ LL | #[cold] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `cold` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:570:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:7 | LL | #[cold] type T = S; | ^^^^ @@ -799,7 +800,7 @@ LL | #[cold] 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! warning: the `cold` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:576:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:545:7 | LL | #[cold] impl S { } | ^^^^ @@ -807,8 +808,8 @@ LL | #[cold] impl S { } = help: the `cold` attribute can only be applied to functions = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:583:3 +error: the `link_name` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:552:3 | LL | #[link_name = "1900"] | ^^^^^^^^^ @@ -816,8 +817,8 @@ LL | #[link_name = "1900"] = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on foreign modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:7 +error: the `link_name` attribute cannot be used on foreign modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:558:7 | LL | #[link_name = "1900"] | ^^^^^^^^^ @@ -825,8 +826,8 @@ LL | #[link_name = "1900"] = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:596:20 +error: the `link_name` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:565:20 | LL | mod inner { #![link_name="1900"] } | ^^^^^^^^^ @@ -834,8 +835,8 @@ LL | mod inner { #![link_name="1900"] } = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:602:7 +error: the `link_name` attribute cannot be used on functions + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:571:7 | LL | #[link_name = "1900"] fn f() { } | ^^^^^^^^^ @@ -843,8 +844,8 @@ LL | #[link_name = "1900"] fn f() { } = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:608:7 +error: the `link_name` attribute cannot be used on structs + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:577:7 | LL | #[link_name = "1900"] struct S; | ^^^^^^^^^ @@ -852,8 +853,8 @@ LL | #[link_name = "1900"] struct S; = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:7 +error: the `link_name` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:583:7 | LL | #[link_name = "1900"] type T = S; | ^^^^^^^^^ @@ -861,8 +862,8 @@ LL | #[link_name = "1900"] type T = S; = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_name` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:7 +error: the `link_name` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:7 | LL | #[link_name = "1900"] impl S { } | ^^^^^^^^^ @@ -870,8 +871,8 @@ LL | #[link_name = "1900"] impl S { } = help: the `link_name` attribute can be applied to foreign functions and foreign statics = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link_section` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:3 +error: the `link_section` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:596:3 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^ @@ -879,8 +880,8 @@ LL | #[link_section = ",1800"] = help: the `link_section` 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! -warning: the `link_section` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:20 +error: the `link_section` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:602:20 | LL | mod inner { #![link_section=",1800"] } | ^^^^^^^^^^^^ @@ -888,8 +889,8 @@ LL | mod inner { #![link_section=",1800"] } = help: the `link_section` 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! -warning: the `link_section` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:7 +error: the `link_section` attribute cannot be used on structs + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:610:7 | LL | #[link_section = ",1800"] struct S; | ^^^^^^^^^^^^ @@ -897,8 +898,8 @@ LL | #[link_section = ",1800"] struct S; = help: the `link_section` 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! -warning: the `link_section` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:7 +error: the `link_section` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:616:7 | LL | #[link_section = ",1800"] type T = S; | ^^^^^^^^^^^^ @@ -906,8 +907,8 @@ LL | #[link_section = ",1800"] type T = S; = help: the `link_section` 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! -warning: the `link_section` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:653:7 +error: the `link_section` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:622:7 | LL | #[link_section = ",1800"] impl S { } | ^^^^^^^^^^^^ @@ -915,8 +916,8 @@ LL | #[link_section = ",1800"] impl S { } = help: the `link_section` 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! -warning: the `link_section` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:7 +error: the `link_section` attribute cannot be used on traits + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:628:7 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^ @@ -924,8 +925,8 @@ LL | #[link_section = ",1800"] = help: the `link_section` 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! -warning: the `link` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:3 +error: the `link` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:3 | LL | #[link(name = "x")] | ^^^^ @@ -933,8 +934,8 @@ LL | #[link(name = "x")] = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:20 +error: the `link` attribute cannot be used on modules + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:20 | LL | mod inner { #![link(name = "x")] } | ^^^^ @@ -942,8 +943,8 @@ LL | mod inner { #![link(name = "x")] } = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:7 +error: the `link` attribute cannot be used on functions + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:7 | LL | #[link(name = "x")] fn f() { } | ^^^^ @@ -951,8 +952,8 @@ LL | #[link(name = "x")] fn f() { } = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:7 +error: the `link` attribute cannot be used on structs + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:7 | LL | #[link(name = "x")] struct S; | ^^^^ @@ -960,8 +961,8 @@ LL | #[link(name = "x")] struct S; = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:7 +error: the `link` attribute cannot be used on type aliases + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:7 | LL | #[link(name = "x")] type T = S; | ^^^^ @@ -969,8 +970,8 @@ LL | #[link(name = "x")] type T = S; = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `link` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:7 +error: the `link` attribute cannot be used on inherent impl blocks + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:7 | LL | #[link(name = "x")] impl S { } | ^^^^ @@ -979,7 +980,7 @@ LL | #[link(name = "x")] 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! warning: the `must_use` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:3 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:3 | LL | #[must_use] | ^^^^^^^^ @@ -988,7 +989,7 @@ 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! warning: the `must_use` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:20 | LL | mod inner { #![must_use] } | ^^^^^^^^ @@ -997,7 +998,7 @@ LL | mod inner { #![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! warning: the `must_use` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:7 | LL | #[must_use] type T = S; | ^^^^^^^^ @@ -1006,7 +1007,7 @@ LL | #[must_use] 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! warning: the `must_use` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:7 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:738:7 | LL | #[must_use] impl S { } | ^^^^^^^^ @@ -1015,13 +1016,13 @@ LL | #[must_use] 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! warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:1 | LL | #[windows_subsystem = "windows"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:746:1 | LL | / mod windows_subsystem { LL | | @@ -1031,67 +1032,67 @@ LL | | } | |_^ warning: the `#![windows_subsystem]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:17 | LL | mod inner { #![windows_subsystem="windows"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:5 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:38 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:5 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:38 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 | LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:38 | LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:38 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:802:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:772:1 | LL | / mod crate_name { LL | | @@ -1101,67 +1102,67 @@ LL | | } | |_^ warning: the `#![crate_name]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:28 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:28 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:28 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:28 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:1 | LL | / mod crate_type { LL | | @@ -1171,67 +1172,67 @@ LL | | } | |_^ warning: the `#![crate_type]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:828:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:28 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:28 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:28 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:28 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:848:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:818:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:1 | LL | / mod feature { LL | | @@ -1241,67 +1242,67 @@ LL | | } | |_^ warning: the `#![feature]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:23 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:23 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:23 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:867:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:837:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:867:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:837:23 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:873:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:1 | LL | #[no_main] | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:875:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:1 | LL | / mod no_main_1 { LL | | @@ -1311,67 +1312,67 @@ LL | | } | |_^ warning: the `#![no_main]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:877:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:847:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:16 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:16 | LL | #[no_main] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:16 | LL | #[no_main] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:892:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:892:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:16 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:867:1 | LL | #[no_builtins] | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:899:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:869:1 | LL | / mod no_builtins { LL | | @@ -1381,67 +1382,67 @@ LL | | } | |_^ warning: the `#![no_builtins]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:901:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:871:17 | LL | mod inner { #![no_builtins] } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:874:5 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:874:20 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:878:5 | LL | #[no_builtins] struct S; | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:878:20 | LL | #[no_builtins] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:882:5 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:882:20 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:916:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:886:5 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:916:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:886:20 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:921:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:891:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:923:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:893:1 | LL | / mod recursion_limit { LL | | @@ -1451,67 +1452,67 @@ LL | | } | |_^ warning: the `#![recursion_limit]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:925:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:895:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:898:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:898:31 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:902:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:902:31 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:906:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:906:31 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:940:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:910:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:940:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:910:31 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:945:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:915:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:947:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:917:1 | LL | / mod type_length_limit { LL | | @@ -1521,61 +1522,61 @@ LL | | } | |_^ warning: the `#![type_length_limit]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:949:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:919:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:922:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:922:33 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:926:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:926:33 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:930:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:930:33 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:964:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:934:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:964:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:934:33 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^ -warning: the `no_mangle` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:366:11 +error: the `no_mangle` attribute cannot be used on required trait methods + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:11 | LL | #[no_mangle] fn foo(); | ^^^^^^^^^ @@ -1583,8 +1584,8 @@ LL | #[no_mangle] fn foo(); = help: the `no_mangle` attribute can be applied to functions with a body 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! -warning: the `no_mangle` attribute cannot be used on provided trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:11 +error: the `no_mangle` attribute cannot be used on provided trait methods + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:11 | LL | #[no_mangle] fn bar() {} | ^^^^^^^^^ @@ -1592,8 +1593,8 @@ LL | #[no_mangle] fn bar() {} = help: the `no_mangle` attribute can be applied to functions, inherent methods, statics, and trait methods in 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! -warning: the `link_section` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:11 +error: the `link_section` attribute cannot be used on required trait methods + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:11 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^ @@ -1601,5 +1602,5 @@ LL | #[link_section = ",1800"] = help: the `link_section` attribute can be applied to functions with a body 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! -warning: 171 warnings emitted +error: aborting due to 31 previous errors; 140 warnings emitted diff --git a/tests/ui/lint/harmful_unused_attributes.rs b/tests/ui/lint/harmful_unused_attributes.rs new file mode 100644 index 0000000000000..6ea6318bbd23c --- /dev/null +++ b/tests/ui/lint/harmful_unused_attributes.rs @@ -0,0 +1,9 @@ +//@check-pass + +#![allow(harmful_unused_attributes, reason = "the lint can be silenced")] +#![crate_type = "lib"] + +fn foo(){ + #[repr(C)] + println!("foo"); +} diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index feb1a79bf9b92..95bc18753dfec 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -276,6 +276,7 @@ note: attribute also specified here 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! + = note: `#[deny(harmful_unused_attributes)]` on by default error: unused attribute --> $DIR/unused-attr-duplicate.rs:104:1 diff --git a/tests/ui/malformed/malformed-regressions.rs b/tests/ui/malformed/malformed-regressions.rs index 37824898f9d4d..d1580edfbb516 100644 --- a/tests/ui/malformed/malformed-regressions.rs +++ b/tests/ui/malformed/malformed-regressions.rs @@ -6,10 +6,10 @@ #[inline = ""] //~ ERROR valid forms for the attribute are //~^ WARN this was previously accepted #[link] //~ ERROR malformed -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted #[link = ""] //~ ERROR malformed -//~^ WARN attribute cannot be used on +//~^ ERROR attribute cannot be used on //~| WARN previously accepted fn main() {} diff --git a/tests/ui/malformed/malformed-regressions.stderr b/tests/ui/malformed/malformed-regressions.stderr index 0dcdee9ccc990..dbff13e6b8d5d 100644 --- a/tests/ui/malformed/malformed-regressions.stderr +++ b/tests/ui/malformed/malformed-regressions.stderr @@ -47,7 +47,7 @@ LL | #[inline = ""] = 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 #57571 -warning: the `link` attribute cannot be used on functions +error: the `link` attribute cannot be used on functions --> $DIR/malformed-regressions.rs:8:3 | LL | #[link] @@ -55,9 +55,9 @@ LL | #[link] | = help: the `link` attribute can only be applied to foreign modules = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: requested on the command line with `-W unused-attributes` + = note: `#[deny(harmful_unused_attributes)]` on by default -warning: the `link` attribute cannot be used on functions +error: the `link` attribute cannot be used on functions --> $DIR/malformed-regressions.rs:11:3 | LL | #[link = ""] @@ -66,7 +66,7 @@ LL | #[link = ""] = help: the `link` attribute can only be applied to foreign modules = 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 5 previous errors; 2 warnings emitted +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0539`. Future incompatibility report: Future breakage diagnostic: diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs index bb6e7705a29d6..fccc837953356 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs @@ -45,7 +45,7 @@ pub fn foo( //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} @@ -69,7 +69,7 @@ impl SelfStruct { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} @@ -88,7 +88,7 @@ impl SelfStruct { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} } @@ -113,7 +113,7 @@ impl RefStruct { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} } @@ -136,7 +136,7 @@ trait RefTrait { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} @@ -155,7 +155,7 @@ trait RefTrait { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} } @@ -179,7 +179,7 @@ impl RefTrait for RefStruct { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32, //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted ) {} } @@ -200,7 +200,7 @@ fn main() { //~^ ERROR documentation comments cannot be applied to function #[no_mangle] b: i32 //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - //~| WARN attribute cannot be used on + //~| ERROR attribute cannot be used on //~| WARN previously accepted | {}; } diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr index cee602a274bb3..f370514607e79 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr @@ -392,7 +392,7 @@ 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! = note: requested on the command line with `-W unused-attributes` -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:46:7 | LL | #[no_mangle] b: i32, @@ -400,6 +400,7 @@ LL | #[no_mangle] b: i32, | = 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! + = note: `#[deny(harmful_unused_attributes)]` on by default warning: the `must_use` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:195:11 @@ -410,7 +411,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:201:11 | LL | #[no_mangle] b: i32 @@ -428,7 +429,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:137:11 | LL | #[no_mangle] b: i32, @@ -446,7 +447,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:156:11 | LL | #[no_mangle] b: i32, @@ -464,7 +465,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:70:11 | LL | #[no_mangle] b: i32, @@ -482,7 +483,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:89:11 | LL | #[no_mangle] b: i32, @@ -500,7 +501,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:114:11 | LL | #[no_mangle] b: i32, @@ -518,7 +519,7 @@ LL | #[must_use] = help: the `must_use` attribute can be applied to data types, functions, and traits = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -warning: the `no_mangle` attribute cannot be used on function params +error: the `no_mangle` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:180:11 | LL | #[no_mangle] b: i32, @@ -527,5 +528,5 @@ LL | #[no_mangle] b: i32, = 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: aborting due to 64 previous errors; 16 warnings emitted +error: aborting due to 72 previous errors; 8 warnings emitted