diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 3a7308ef7c97a..63e1b2b16a438 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -751,6 +751,16 @@ impl<'hir> LoweringContext<'_, 'hir> { ) }); + for param in &fdec.inputs { + self.lower_attrs_with_extra( + hir_id, + param.attrs(), + param.span, + Target::Param, + attrs, + ); + } + // Unmarked safety in unsafe block defaults to unsafe. let header = self.lower_fn_header(sig.header, hir::Safety::Unsafe, attrs); diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 350fa04ab3bdc..1b1a5ed99b797 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -209,6 +209,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { tcx.features(), registered_tools, Late, + tcx.dcx(), ), delayed_lints: Vec::new(), } @@ -1349,6 +1350,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { hir::TyKind::Path(path) } TyKind::FnPtr(f) => { + let hir_id = hir::HirId::make_owner(self.current_hir_id_owner.def_id); + for param in &f.decl.inputs { + // Attrs on FnPtr need to be lowered, see RFC #2565 + self.lower_attrs(hir_id, param.attrs(), param.span, Target::Param); + } + let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params); hir::TyKind::FnPtr(self.arena.alloc(hir::FnPtrTy { generic_params, diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index eddcf12fca29c..abd03d38f3ae8 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -16,6 +16,7 @@ //! constructions produced by proc macros. This pass is only intended for simple checks that do not //! require name resolution or type checking, or other kinds of complex analysis. +use core::slice; use std::mem; use std::ops::{Deref, DerefMut}; use std::str::FromStr; @@ -25,7 +26,7 @@ use rustc_abi::{CVariadicStatus, CanonAbi, ExternAbi, InterruptKind}; use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, walk_list}; use rustc_ast::*; use rustc_ast_pretty::pprust::{self, State}; -use rustc_attr_parsing::validate_attr; +use rustc_attr_parsing::{AttributeParser, Late, validate_attr}; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::{DiagCtxtHandle, LintBuffer}; use rustc_feature::Features; @@ -373,7 +374,12 @@ impl<'a> AstValidator<'a> { sym::forbid, sym::warn, ]; - !attr.has_any_name(&arr) && rustc_attr_parsing::is_builtin_attr(*attr) + !attr.has_any_name(&arr) + && rustc_attr_parsing::is_builtin_attr(*attr) + // Only emit this for non-parsed attrs, because parsed attrs have better lints for this + && !attr.name() + .as_ref() + .is_some_and(|name| AttributeParser::::is_parsed_attribute(slice::from_ref(name))) }) .for_each(|attr| { if attr.is_doc_comment() { diff --git a/compiler/rustc_attr_parsing/messages.ftl b/compiler/rustc_attr_parsing/messages.ftl index 36213e68a52be..f965ba530d265 100644 --- a/compiler/rustc_attr_parsing/messages.ftl +++ b/compiler/rustc_attr_parsing/messages.ftl @@ -211,6 +211,10 @@ attr_parsing_stability_outside_std = stability attributes may not be used outsid attr_parsing_suffixed_literal_in_attribute = suffixed literals are not allowed in attributes .help = instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) +attr_parsing_target_regression = attribute parser for `#[{$attribute_symbol}]` uses `AllowedTargets::AllowListWarnRest` but does not specify `Allow` or `Error` for target: `{$target}` + .help = this target is already emitting errs for all unparsed attrs so omitting it in `AllowListWarnRest` would mean a regression from emitting an error, to emitting a warn + .note = this is an internal rustc lint + attr_parsing_unknown_version_literal = unknown version literal format, assuming it refers to a future version diff --git a/compiler/rustc_attr_parsing/src/attributes/cfi_encoding.rs b/compiler/rustc_attr_parsing/src/attributes/cfi_encoding.rs index df1e569743c04..c2dd01e683e1c 100644 --- a/compiler/rustc_attr_parsing/src/attributes/cfi_encoding.rs +++ b/compiler/rustc_attr_parsing/src/attributes/cfi_encoding.rs @@ -7,6 +7,7 @@ impl SingleAttributeParser for CfiEncodingParser { Allow(Target::ForeignTy), Allow(Target::Enum), Allow(Target::Union), + Error(Target::Param), ]); const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost; const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index c68c66b271857..d69023b0b17a8 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -60,6 +60,7 @@ impl NoArgsAttributeParser for ColdParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::ForeignFn), Allow(Target::Closure), + Error(Target::Param), ]); const CREATE: fn(Span) -> AttributeKind = AttributeKind::Cold; } @@ -364,6 +365,7 @@ impl NoArgsAttributeParser for NoMangleParser { Allow(Target::Method(MethodKind::TraitImpl)), AllowSilent(Target::Const), // Handled in the `InvalidNoMangleItems` pass Error(Target::Closure), + Error(Target::Param), ]); const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoMangle; } diff --git a/compiler/rustc_attr_parsing/src/attributes/deprecation.rs b/compiler/rustc_attr_parsing/src/attributes/deprecation.rs index 2d79e3a103d6e..d9c728d7bc983 100644 --- a/compiler/rustc_attr_parsing/src/attributes/deprecation.rs +++ b/compiler/rustc_attr_parsing/src/attributes/deprecation.rs @@ -61,6 +61,7 @@ impl SingleAttributeParser for DeprecationParser { Allow(Target::Impl { of_trait: false }), Allow(Target::Crate), Error(Target::WherePredicate), + Error(Target::Param), ]); const TEMPLATE: AttributeTemplate = template!( Word, diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs index 16dbb04b48ebd..ac43b43543d55 100644 --- a/compiler/rustc_attr_parsing/src/attributes/doc.rs +++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs @@ -7,7 +7,7 @@ use rustc_hir::lints::AttributeLintKind; use rustc_span::{Span, Symbol, edition, sym}; use thin_vec::ThinVec; -use super::prelude::{ALL_TARGETS, AllowedTargets}; +use super::prelude::*; use super::{AcceptMapping, AttributeParser}; use crate::context::{AcceptContext, FinalizeContext, Stage}; use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser}; @@ -584,38 +584,43 @@ impl AttributeParser for DocParser { }, )]; // FIXME: Currently emitted from 2 different places, generating duplicated warnings. - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); - // const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ - // Allow(Target::ExternCrate), - // Allow(Target::Use), - // Allow(Target::Static), - // Allow(Target::Const), - // Allow(Target::Fn), - // Allow(Target::Mod), - // Allow(Target::ForeignMod), - // Allow(Target::TyAlias), - // Allow(Target::Enum), - // Allow(Target::Variant), - // Allow(Target::Struct), - // Allow(Target::Field), - // Allow(Target::Union), - // Allow(Target::Trait), - // Allow(Target::TraitAlias), - // Allow(Target::Impl { of_trait: true }), - // Allow(Target::Impl { of_trait: false }), - // Allow(Target::AssocConst), - // Allow(Target::Method(MethodKind::Inherent)), - // Allow(Target::Method(MethodKind::Trait { body: true })), - // Allow(Target::Method(MethodKind::Trait { body: false })), - // Allow(Target::Method(MethodKind::TraitImpl)), - // Allow(Target::AssocTy), - // Allow(Target::ForeignFn), - // Allow(Target::ForeignStatic), - // Allow(Target::ForeignTy), - // Allow(Target::MacroDef), - // Allow(Target::Crate), - // Error(Target::WherePredicate), - // ]); + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::ExternCrate), + Allow(Target::Use), + Allow(Target::Static), + Allow(Target::Const), + Allow(Target::Fn), + Allow(Target::Mod), + Allow(Target::ForeignMod), + Allow(Target::TyAlias), + Allow(Target::Enum), + Allow(Target::Variant), + Allow(Target::Struct), + Allow(Target::Field), + Allow(Target::Union), + Allow(Target::Trait), + Allow(Target::TraitAlias), + Allow(Target::Impl { of_trait: true }), + Allow(Target::Impl { of_trait: false }), + Allow(Target::AssocConst), + Allow(Target::Method(MethodKind::Inherent)), + Allow(Target::Method(MethodKind::Trait { body: true })), + Allow(Target::Method(MethodKind::Trait { body: false })), + Allow(Target::Method(MethodKind::TraitImpl)), + Allow(Target::AssocTy), + Allow(Target::ForeignFn), + Allow(Target::ForeignStatic), + Allow(Target::ForeignTy), + Allow(Target::MacroDef), + Allow(Target::Crate), + Allow(Target::Expression), + Allow(Target::ExprField), + Allow(Target::Arm), + Allow(Target::Statement), + Allow(Target::PatField), + Error(Target::WherePredicate), + Error(Target::Param), + ]); fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option { if self.nb_doc_attrs != 0 { diff --git a/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs b/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs index 3be9b9ded9c1f..7b79515f756dd 100644 --- a/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs +++ b/compiler/rustc_attr_parsing/src/attributes/instruction_set.rs @@ -13,6 +13,7 @@ impl SingleAttributeParser for InstructionSetParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::Method(MethodKind::TraitImpl)), Allow(Target::Method(MethodKind::Trait { body: true })), + Error(Target::Param), ]); const TEMPLATE: AttributeTemplate = template!(List: &["set"], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute"); const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; diff --git a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs index 61f975555884e..c2c9bab3a20f6 100644 --- a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs @@ -27,6 +27,7 @@ impl SingleAttributeParser for LinkNameParser { const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ Allow(Target::ForeignFn), Allow(Target::ForeignStatic), + Error(Target::Param), ]); const TEMPLATE: AttributeTemplate = template!( NameValueStr: "name", @@ -471,6 +472,7 @@ impl SingleAttributeParser for LinkSectionParser { Allow(Target::Method(MethodKind::Inherent)), Allow(Target::Method(MethodKind::Trait { body: true })), Allow(Target::Method(MethodKind::TraitImpl)), + Error(Target::Param), ]); const TEMPLATE: AttributeTemplate = template!( NameValueStr: "name", diff --git a/compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs b/compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs index 8ca5f0f7228e3..cef71641f85b3 100644 --- a/compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs +++ b/compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs @@ -57,6 +57,7 @@ impl NoArgsAttributeParser for AutomaticallyDerivedParser { Allow(Target::Impl { of_trait: true }), Error(Target::Crate), Error(Target::WherePredicate), + Error(Target::Param), ]); const CREATE: fn(Span) -> AttributeKind = AttributeKind::AutomaticallyDerived; } diff --git a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs index d37915b1b80b2..3777a43d28c49 100644 --- a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs @@ -35,6 +35,7 @@ const MACRO_USE_ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnR Allow(Target::ExternCrate), Allow(Target::Crate), Error(Target::WherePredicate), + Error(Target::Param), ]); impl AttributeParser for MacroUseParser { @@ -137,6 +138,7 @@ impl SingleAttributeParser for MacroExportParser { Allow(Target::MacroDef), Error(Target::WherePredicate), Error(Target::Crate), + Error(Target::Param), ]); fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option { diff --git a/compiler/rustc_attr_parsing/src/attributes/must_use.rs b/compiler/rustc_attr_parsing/src/attributes/must_use.rs index 673e2c902da0b..72697e8a18ab8 100644 --- a/compiler/rustc_attr_parsing/src/attributes/must_use.rs +++ b/compiler/rustc_attr_parsing/src/attributes/must_use.rs @@ -20,6 +20,7 @@ impl SingleAttributeParser for MustUseParser { // `#[must_use]` Allow(Target::Trait), Error(Target::WherePredicate), + Error(Target::Param), ]); const TEMPLATE: AttributeTemplate = template!( Word, NameValueStr: "reason", diff --git a/compiler/rustc_attr_parsing/src/attributes/no_implicit_prelude.rs b/compiler/rustc_attr_parsing/src/attributes/no_implicit_prelude.rs index 40073ea0f4610..efedc39e12145 100644 --- a/compiler/rustc_attr_parsing/src/attributes/no_implicit_prelude.rs +++ b/compiler/rustc_attr_parsing/src/attributes/no_implicit_prelude.rs @@ -5,7 +5,10 @@ pub(crate) struct NoImplicitPreludeParser; impl NoArgsAttributeParser for NoImplicitPreludeParser { const PATH: &[rustc_span::Symbol] = &[sym::no_implicit_prelude]; const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn; - const ALLOWED_TARGETS: AllowedTargets = - AllowedTargets::AllowListWarnRest(&[Allow(Target::Mod), Allow(Target::Crate)]); + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::Mod), + Allow(Target::Crate), + Error(Target::Param), + ]); const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoImplicitPrelude; } diff --git a/compiler/rustc_attr_parsing/src/attributes/path.rs b/compiler/rustc_attr_parsing/src/attributes/path.rs index b60f8e315e5ef..b227e9001eec2 100644 --- a/compiler/rustc_attr_parsing/src/attributes/path.rs +++ b/compiler/rustc_attr_parsing/src/attributes/path.rs @@ -6,8 +6,11 @@ impl SingleAttributeParser for PathParser { const PATH: &[Symbol] = &[sym::path]; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost; const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; - const ALLOWED_TARGETS: AllowedTargets = - AllowedTargets::AllowListWarnRest(&[Allow(Target::Mod), Error(Target::Crate)]); + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::Mod), + Error(Target::Crate), + Error(Target::Param), + ]); const TEMPLATE: AttributeTemplate = template!( NameValueStr: "file", "https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute" diff --git a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs index 7f25641b948e2..52ac18f7d19aa 100644 --- a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs @@ -8,8 +8,11 @@ impl SingleAttributeParser for IgnoreParser { const PATH: &[Symbol] = &[sym::ignore]; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost; const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn; - const ALLOWED_TARGETS: AllowedTargets = - AllowedTargets::AllowListWarnRest(&[Allow(Target::Fn), Error(Target::WherePredicate)]); + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::Fn), + Error(Target::WherePredicate), + Error(Target::Param), + ]); const TEMPLATE: AttributeTemplate = template!( Word, NameValueStr: "reason", "https://doc.rust-lang.org/reference/attributes/testing.html#the-ignore-attribute" @@ -42,8 +45,11 @@ impl SingleAttributeParser for ShouldPanicParser { const PATH: &[Symbol] = &[sym::should_panic]; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost; const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; - const ALLOWED_TARGETS: AllowedTargets = - AllowedTargets::AllowListWarnRest(&[Allow(Target::Fn), Error(Target::WherePredicate)]); + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[ + Allow(Target::Fn), + Error(Target::WherePredicate), + Error(Target::Param), + ]); const TEMPLATE: AttributeTemplate = template!( Word, List: &[r#"expected = "reason""#], NameValueStr: "reason", "https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute" diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 835bf8ae5c9c4..de920158d1d18 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -90,7 +90,7 @@ use crate::session_diagnostics::{ }; use crate::target_checking::AllowedTargets; -type GroupType = LazyLock>; +pub(crate) type GroupType = LazyLock>; pub(super) struct GroupTypeInner { pub(super) accepters: BTreeMap<&'static [Symbol], Vec>>, diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs index 7602e3c4598a3..cd0536871ccda 100644 --- a/compiler/rustc_attr_parsing/src/interface.rs +++ b/compiler/rustc_attr_parsing/src/interface.rs @@ -12,10 +12,11 @@ use rustc_session::Session; use rustc_session::lint::BuiltinLintDiag; use rustc_span::{DUMMY_SP, Span, Symbol, sym}; -use crate::context::{AcceptContext, FinalizeContext, SharedContext, Stage}; +use crate::context::{AcceptContext, FinalizeContext, GroupType, SharedContext, Stage}; use crate::early_parsed::{EARLY_PARSED_ATTRIBUTES, EarlyParsedState}; use crate::parser::{ArgParser, PathParser, RefPathParser}; -use crate::session_diagnostics::ParsedDescription; +use crate::session_diagnostics::{AttributeTargetRegression, ParsedDescription}; +use crate::target_checking::AllowedTargets; use crate::{Early, Late, OmitDoc, ShouldEmit}; /// Context created once, for example as part of the ast lowering @@ -237,7 +238,9 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> { features: &'sess Features, tools: Vec, stage: S, + dcx: DiagCtxtHandle<'_>, ) -> Self { + Self::check_allowed_attrs(S::parsers(), dcx); Self { features: Some(features), tools, parse_only: None, sess, stage } } @@ -486,4 +489,31 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> { } } } + + fn check_allowed_attrs(parsers: &'static GroupType, dcx: DiagCtxtHandle<'_>) { + use crate::target_checking::Policy::{Allow, Error, Warn}; + let targets = [Target::Param]; + for (syms, accepters) in &parsers.accepters { + for accept in accepters { + let AllowedTargets::AllowListWarnRest(allow_list) = accept.allowed_targets else { + continue; + }; + + let missing_targets = targets.into_iter().flat_map(|target| { + (!allow_list.iter().any(|policy| { + [Allow(target), Warn(target), Error(target)].contains(policy) + })) + .then_some(target) + }); + for target in missing_targets { + for sym in *syms { + dcx.emit_warn(AttributeTargetRegression { + attribute_symbol: *sym, + target: target.name(), + }); + } + } + } + } + } } diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 20d00a82cadb2..876502a83ee93 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -946,3 +946,12 @@ pub(crate) struct UnsupportedInstructionSet<'a> { pub instruction_set: Symbol, pub current_target: &'a TargetTuple, } + +#[derive(Diagnostic)] +#[diag(attr_parsing_target_regression)] +#[help] +#[note] +pub(crate) struct AttributeTargetRegression { + pub attribute_symbol: Symbol, + pub target: &'static str, +} diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs index ea5640ecc1fa9..f1b9a9b603091 100644 --- a/compiler/rustc_resolve/src/def_collector.rs +++ b/compiler/rustc_resolve/src/def_collector.rs @@ -144,6 +144,7 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> { self.resolver.tcx.features(), Vec::new(), Early { emit_errors: ShouldEmit::Nothing }, + self.resolver.dcx(), ); let attrs = parser.parse_attribute_list( &i.attrs, diff --git a/tests/ui/attributes/attrs-on-params.rs b/tests/ui/attributes/attrs-on-params.rs index c8e9810327c2a..73551f70a8ea9 100644 --- a/tests/ui/attributes/attrs-on-params.rs +++ b/tests/ui/attributes/attrs-on-params.rs @@ -2,7 +2,6 @@ fn function(#[inline] param: u32) { //~^ ERROR attribute cannot be used on - //~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes } fn main() {} diff --git a/tests/ui/attributes/attrs-on-params.stderr b/tests/ui/attributes/attrs-on-params.stderr index 91f87a954c55d..eee279afdb157 100644 --- a/tests/ui/attributes/attrs-on-params.stderr +++ b/tests/ui/attributes/attrs-on-params.stderr @@ -1,9 +1,3 @@ -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/attrs-on-params.rs:3:13 - | -LL | fn function(#[inline] param: u32) { - | ^^^^^^^^^ - error: `#[inline]` attribute cannot be used on function params --> $DIR/attrs-on-params.rs:3:13 | @@ -12,5 +6,5 @@ LL | fn function(#[inline] param: u32) { | = help: `#[inline]` can only be applied to functions -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/force-inlining/invalid.rs b/tests/ui/force-inlining/invalid.rs index eaacbb502090c..eba31aaef1377 100644 --- a/tests/ui/force-inlining/invalid.rs +++ b/tests/ui/force-inlining/invalid.rs @@ -129,8 +129,7 @@ impl FooBaz for Bar { macro_rules! barqux { ($foo:tt) => { $foo }; } fn barqux(#[rustc_force_inline] _x: u32) {} -//~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters -//~^^ ERROR attribute cannot be used on +//~^ ERROR attribute cannot be used on #[rustc_force_inline] //~^ ERROR attribute cannot be applied to a `async`, `gen` or `async gen` function diff --git a/tests/ui/force-inlining/invalid.stderr b/tests/ui/force-inlining/invalid.stderr index ce4f1d77ad2d2..7980169eb31c0 100644 --- a/tests/ui/force-inlining/invalid.stderr +++ b/tests/ui/force-inlining/invalid.stderr @@ -1,9 +1,3 @@ -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/invalid.rs:131:11 - | -LL | fn barqux(#[rustc_force_inline] _x: u32) {} - | ^^^^^^^^^^^^^^^^^^^^^ - error[E0805]: malformed `rustc_force_inline` attribute input --> $DIR/invalid.rs:15:1 | @@ -265,7 +259,7 @@ LL | fn barqux(#[rustc_force_inline] _x: u32) {} = help: `#[rustc_force_inline]` can only be applied to functions error: `#[rustc_force_inline]` attribute cannot be used on closures - --> $DIR/invalid.rs:148:14 + --> $DIR/invalid.rs:147:14 | LL | let _x = #[rustc_force_inline] || { }; | ^^^^^^^^^^^^^^^^^^^^^ @@ -273,7 +267,7 @@ LL | let _x = #[rustc_force_inline] || { }; = help: `#[rustc_force_inline]` can be applied to functions and inherent methods error: `#[rustc_force_inline]` attribute cannot be used on expressions - --> $DIR/invalid.rs:150:14 + --> $DIR/invalid.rs:149:14 | LL | let _y = #[rustc_force_inline] 3 + 4; | ^^^^^^^^^^^^^^^^^^^^^ @@ -281,7 +275,7 @@ LL | let _y = #[rustc_force_inline] 3 + 4; = help: `#[rustc_force_inline]` can only be applied to functions error: `#[rustc_force_inline]` attribute cannot be used on statements - --> $DIR/invalid.rs:152:5 + --> $DIR/invalid.rs:151:5 | LL | #[rustc_force_inline] | ^^^^^^^^^^^^^^^^^^^^^ @@ -289,7 +283,7 @@ LL | #[rustc_force_inline] = help: `#[rustc_force_inline]` can only be applied to functions error: `#[rustc_force_inline]` attribute cannot be used on match arms - --> $DIR/invalid.rs:157:9 + --> $DIR/invalid.rs:156:9 | LL | #[rustc_force_inline] | ^^^^^^^^^^^^^^^^^^^^^ @@ -297,7 +291,7 @@ LL | #[rustc_force_inline] = help: `#[rustc_force_inline]` can only be applied to functions error: attribute cannot be applied to a `async`, `gen` or `async gen` function - --> $DIR/invalid.rs:135:1 + --> $DIR/invalid.rs:134:1 | LL | #[rustc_force_inline] | ^^^^^^^^^^^^^^^^^^^^^ @@ -306,7 +300,7 @@ LL | async fn async_foo() {} | -------------------- `async`, `gen` or `async gen` function error: attribute cannot be applied to a `async`, `gen` or `async gen` function - --> $DIR/invalid.rs:139:1 + --> $DIR/invalid.rs:138:1 | LL | #[rustc_force_inline] | ^^^^^^^^^^^^^^^^^^^^^ @@ -315,7 +309,7 @@ LL | gen fn gen_foo() {} | ---------------- `async`, `gen` or `async gen` function error: attribute cannot be applied to a `async`, `gen` or `async gen` function - --> $DIR/invalid.rs:143:1 + --> $DIR/invalid.rs:142:1 | LL | #[rustc_force_inline] | ^^^^^^^^^^^^^^^^^^^^^ @@ -323,7 +317,7 @@ LL | LL | async gen fn async_gen_foo() {} | ---------------------------- `async`, `gen` or `async gen` function -error: aborting due to 36 previous errors +error: aborting due to 35 previous errors Some errors have detailed explanations: E0539, E0805. For more information about an error, try `rustc --explain E0539`. diff --git a/tests/ui/pin-ergonomics/pin_v2-attr.rs b/tests/ui/pin-ergonomics/pin_v2-attr.rs index ba25d3587edd8..39d2acca0a844 100644 --- a/tests/ui/pin-ergonomics/pin_v2-attr.rs +++ b/tests/ui/pin-ergonomics/pin_v2-attr.rs @@ -83,7 +83,6 @@ const CONST: () = (); #[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on functions fn f(#[pin_v2] param: Foo) //~^ ERROR `#[pin_v2]` attribute cannot be used on function params -//~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters where #[pin_v2] //~^ ERROR `#[pin_v2]` attribute cannot be used on where predicates diff --git a/tests/ui/pin-ergonomics/pin_v2-attr.stderr b/tests/ui/pin-ergonomics/pin_v2-attr.stderr index c297afa87a73f..4382978c08bd7 100644 --- a/tests/ui/pin-ergonomics/pin_v2-attr.stderr +++ b/tests/ui/pin-ergonomics/pin_v2-attr.stderr @@ -1,17 +1,11 @@ error: `#[pin_v2]` attribute cannot be used on macro calls - --> $DIR/pin_v2-attr.rs:135:1 + --> $DIR/pin_v2-attr.rs:134:1 | LL | #[pin_v2] | ^^^^^^^^^ | = help: `#[pin_v2]` can be applied to data types and unions -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/pin_v2-attr.rs:84:12 - | -LL | fn f(#[pin_v2] param: Foo) - | ^^^^^^^^^ - error: `#[pin_v2]` attribute cannot be used on crates --> $DIR/pin_v2-attr.rs:10:1 | @@ -197,7 +191,7 @@ LL | fn f(#[pin_v2] param: Foo) = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on closures - --> $DIR/pin_v2-attr.rs:92:5 + --> $DIR/pin_v2-attr.rs:91:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -205,7 +199,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on expressions - --> $DIR/pin_v2-attr.rs:94:5 + --> $DIR/pin_v2-attr.rs:93:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -213,7 +207,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on struct fields - --> $DIR/pin_v2-attr.rs:98:9 + --> $DIR/pin_v2-attr.rs:97:9 | LL | #[pin_v2] | ^^^^^^^^^ @@ -221,7 +215,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on statements - --> $DIR/pin_v2-attr.rs:96:5 + --> $DIR/pin_v2-attr.rs:95:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -229,7 +223,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on match arms - --> $DIR/pin_v2-attr.rs:102:9 + --> $DIR/pin_v2-attr.rs:101:9 | LL | #[pin_v2] | ^^^^^^^^^ @@ -237,7 +231,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on pattern fields - --> $DIR/pin_v2-attr.rs:106:13 + --> $DIR/pin_v2-attr.rs:105:13 | LL | #[pin_v2] | ^^^^^^^^^ @@ -245,7 +239,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on where predicates - --> $DIR/pin_v2-attr.rs:88:5 + --> $DIR/pin_v2-attr.rs:87:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -253,7 +247,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on modules - --> $DIR/pin_v2-attr.rs:112:1 + --> $DIR/pin_v2-attr.rs:111:1 | LL | #[pin_v2] | ^^^^^^^^^ @@ -261,7 +255,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on foreign modules - --> $DIR/pin_v2-attr.rs:115:1 + --> $DIR/pin_v2-attr.rs:114:1 | LL | #[pin_v2] | ^^^^^^^^^ @@ -269,7 +263,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on foreign types - --> $DIR/pin_v2-attr.rs:117:5 + --> $DIR/pin_v2-attr.rs:116:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -277,7 +271,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on foreign statics - --> $DIR/pin_v2-attr.rs:120:5 + --> $DIR/pin_v2-attr.rs:119:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -285,7 +279,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on foreign functions - --> $DIR/pin_v2-attr.rs:123:5 + --> $DIR/pin_v2-attr.rs:122:5 | LL | #[pin_v2] | ^^^^^^^^^ @@ -293,7 +287,7 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on type aliases - --> $DIR/pin_v2-attr.rs:127:1 + --> $DIR/pin_v2-attr.rs:126:1 | LL | #[pin_v2] | ^^^^^^^^^ @@ -301,12 +295,12 @@ LL | #[pin_v2] = help: `#[pin_v2]` can be applied to data types and unions error: `#[pin_v2]` attribute cannot be used on macro defs - --> $DIR/pin_v2-attr.rs:130:1 + --> $DIR/pin_v2-attr.rs:129:1 | LL | #[pin_v2] | ^^^^^^^^^ | = help: `#[pin_v2]` can be applied to data types and unions -error: aborting due to 39 previous errors +error: aborting due to 38 previous errors 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..3faea9497998b 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 @@ -7,11 +7,11 @@ extern "C" { /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~^ ERROR attribute cannot be used on /// Baz //~^ 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 + //~^ ERROR attribute cannot be used on ); } @@ -23,11 +23,11 @@ type FnType = fn( /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters + //~^ ERROR attribute cannot be used on /// Baz //~^ 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 + //~^ ERROR attribute cannot be used on ); pub fn foo( @@ -38,15 +38,11 @@ pub fn foo( /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Baz //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} struct SelfStruct {} @@ -62,15 +58,11 @@ impl SelfStruct { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} fn issue_64682_associated_fn( @@ -81,15 +73,11 @@ impl SelfStruct { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} } @@ -106,15 +94,11 @@ impl RefStruct { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} } trait RefTrait { @@ -129,15 +113,11 @@ trait RefTrait { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} fn issue_64682_associated_fn( @@ -148,15 +128,11 @@ trait RefTrait { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} } @@ -172,15 +148,11 @@ impl RefTrait for RefStruct { /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Qux //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on ) {} } @@ -193,14 +165,10 @@ fn main() { /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] - //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on /// Baz //~^ 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 - //~| WARN previously accepted + //~^ ERROR attribute cannot be used on | {}; } 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 cc08307a18d04..dd31dc63c8f0a 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 @@ -17,43 +17,43 @@ LL | #[test] a: u32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:60:11 + --> $DIR/param-attrs-builtin-attrs.rs:56:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:79:11 + --> $DIR/param-attrs-builtin-attrs.rs:71:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:104:11 + --> $DIR/param-attrs-builtin-attrs.rs:92:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:127:11 + --> $DIR/param-attrs-builtin-attrs.rs:111:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:146:11 + --> $DIR/param-attrs-builtin-attrs.rs:126:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:170:11 + --> $DIR/param-attrs-builtin-attrs.rs:146:11 | LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:191:11 + --> $DIR/param-attrs-builtin-attrs.rs:163:11 | LL | #[test] a: u32, | ^^^^ not a non-macro attribute @@ -70,24 +70,12 @@ error: documentation comments cannot be applied to function parameters LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:9:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:11:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:13:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:19:5 | @@ -100,24 +88,12 @@ error: documentation comments cannot be applied to function parameters LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:25:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:27:5 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:29:5 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:34:5 | @@ -130,402 +106,321 @@ error: documentation comments cannot be applied to function parameters LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:40:5 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:44:5 + --> $DIR/param-attrs-builtin-attrs.rs:42:5 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:46:5 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:55:9 + --> $DIR/param-attrs-builtin-attrs.rs:51:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:58:9 + --> $DIR/param-attrs-builtin-attrs.rs:54:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:62:9 + --> $DIR/param-attrs-builtin-attrs.rs:58:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:64:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:68:9 + --> $DIR/param-attrs-builtin-attrs.rs:62:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:70:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:77:9 + --> $DIR/param-attrs-builtin-attrs.rs:69:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:81:9 + --> $DIR/param-attrs-builtin-attrs.rs:73:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:83:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:87:9 + --> $DIR/param-attrs-builtin-attrs.rs:77:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:89:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:99:9 + --> $DIR/param-attrs-builtin-attrs.rs:87:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:102:9 + --> $DIR/param-attrs-builtin-attrs.rs:90:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:106:9 + --> $DIR/param-attrs-builtin-attrs.rs:94:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:108:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:112:9 + --> $DIR/param-attrs-builtin-attrs.rs:98:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:114:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:122:9 + --> $DIR/param-attrs-builtin-attrs.rs:106:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:125:9 + --> $DIR/param-attrs-builtin-attrs.rs:109:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:129:9 + --> $DIR/param-attrs-builtin-attrs.rs:113:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:131:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:135:9 + --> $DIR/param-attrs-builtin-attrs.rs:117:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:137:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:144:9 + --> $DIR/param-attrs-builtin-attrs.rs:124:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:148:9 + --> $DIR/param-attrs-builtin-attrs.rs:128:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:150:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:154:9 + --> $DIR/param-attrs-builtin-attrs.rs:132:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:156:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:165:9 + --> $DIR/param-attrs-builtin-attrs.rs:141:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:168:9 + --> $DIR/param-attrs-builtin-attrs.rs:144:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:172:9 + --> $DIR/param-attrs-builtin-attrs.rs:148:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:174:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:178:9 + --> $DIR/param-attrs-builtin-attrs.rs:152:9 | LL | /// Qux | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:180:9 - | -LL | #[no_mangle] b: i32, - | ^^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:189:9 + --> $DIR/param-attrs-builtin-attrs.rs:161:9 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:193:9 + --> $DIR/param-attrs-builtin-attrs.rs:165:9 | LL | /// Bar | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:195:9 - | -LL | #[must_use] - | ^^^^^^^^^^^ - error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:199:9 + --> $DIR/param-attrs-builtin-attrs.rs:169:9 | LL | /// Baz | ^^^^^^^ doc comments are not allowed here -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/param-attrs-builtin-attrs.rs:201:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:9:9 | -LL | #[no_mangle] b: i32 +LL | #[must_use] + | ^^^^^^^^^^^ + | + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:13:9 + | +LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ + | + = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:25:5 + | +LL | #[must_use] + | ^^^^^^^^^^^ + | + = help: `#[must_use]` can be applied to data types, functions, traits, and unions + +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:29:5 + | +LL | #[no_mangle] b: i32, + | ^^^^^^^^^^^^ + | + = help: `#[no_mangle]` can be applied to functions and statics + +error: `#[must_use]` attribute cannot be used on function params --> $DIR/param-attrs-builtin-attrs.rs:40:5 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions - = note: requested on the command line with `-W unused-attributes` -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:46:5 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:44:5 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:64:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:60:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:70:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:64:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:83:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:75:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:89:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:79:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:108:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:96:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:114:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:100:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:131:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:115:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:137:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:119:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:150:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:130:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:156:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:134:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:174:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:150:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:180:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:154:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -warning: `#[must_use]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:195:9 +error: `#[must_use]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:167:9 | 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! = help: `#[must_use]` can be applied to data types, functions, traits, and unions -warning: `#[no_mangle]` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:201:9 +error: `#[no_mangle]` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:171:9 | LL | #[no_mangle] b: i32 | ^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = help: `#[no_mangle]` can be applied to functions and statics -error: aborting due to 64 previous errors; 16 warnings emitted +error: aborting due to 64 previous errors diff --git a/tests/ui/rustdoc/check-doc-alias-attr-location.stderr b/tests/ui/rustdoc/check-doc-alias-attr-location.stderr index f587c17c1f3e9..fd92b032f4687 100644 --- a/tests/ui/rustdoc/check-doc-alias-attr-location.stderr +++ b/tests/ui/rustdoc/check-doc-alias-attr-location.stderr @@ -1,8 +1,10 @@ -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters +error: `#[doc]` attribute cannot be used on function params --> $DIR/check-doc-alias-attr-location.rs:22:12 | LL | fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X { | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: `#[doc]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, functions, impl blocks, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, unions, and use statements error: `#[doc(alias = "...")]` isn't allowed on foreign module --> $DIR/check-doc-alias-attr-location.rs:9:15 diff --git a/tests/ui/scalable-vectors/invalid.rs b/tests/ui/scalable-vectors/invalid.rs index 90e9839c9e116..6b0b95023abd5 100644 --- a/tests/ui/scalable-vectors/invalid.rs +++ b/tests/ui/scalable-vectors/invalid.rs @@ -108,7 +108,6 @@ macro_rules! barqux { ($foo:tt) => { $foo }; } //~^ ERROR: `#[rustc_scalable_vector]` attribute cannot be used on functions fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} //~^ ERROR: `#[rustc_scalable_vector]` attribute cannot be used on function params -//~^^ ERROR: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters #[rustc_scalable_vector(4)] //~^ ERROR: `#[rustc_scalable_vector]` attribute cannot be used on functions diff --git a/tests/ui/scalable-vectors/invalid.stderr b/tests/ui/scalable-vectors/invalid.stderr index d73b5abf7030f..57ddecc6360cb 100644 --- a/tests/ui/scalable-vectors/invalid.stderr +++ b/tests/ui/scalable-vectors/invalid.stderr @@ -1,9 +1,3 @@ -error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/invalid.rs:109:11 - | -LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: `#[rustc_scalable_vector]` attribute cannot be used on extern crates --> $DIR/invalid.rs:9:1 | @@ -213,7 +207,7 @@ LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:113:1 + --> $DIR/invalid.rs:112:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -221,7 +215,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:117:1 + --> $DIR/invalid.rs:116:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +223,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:121:1 + --> $DIR/invalid.rs:120:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -237,7 +231,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on closures - --> $DIR/invalid.rs:126:14 + --> $DIR/invalid.rs:125:14 | LL | let _x = #[rustc_scalable_vector(4)] || { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -245,7 +239,7 @@ LL | let _x = #[rustc_scalable_vector(4)] || { }; = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on expressions - --> $DIR/invalid.rs:128:14 + --> $DIR/invalid.rs:127:14 | LL | let _y = #[rustc_scalable_vector(4)] 3 + 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +247,7 @@ LL | let _y = #[rustc_scalable_vector(4)] 3 + 4; = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on statements - --> $DIR/invalid.rs:130:5 + --> $DIR/invalid.rs:129:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -261,7 +255,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on match arms - --> $DIR/invalid.rs:135:9 + --> $DIR/invalid.rs:134:9 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +263,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error[E0539]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:142:1 + --> $DIR/invalid.rs:141:1 | LL | #[rustc_scalable_vector("4")] | ^^^^^^^^^^^^^^^^^^^^^^^^---^^ @@ -286,7 +280,7 @@ LL + #[rustc_scalable_vector] | error[E0805]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:146:1 + --> $DIR/invalid.rs:145:1 | LL | #[rustc_scalable_vector(4, 2)] | ^^^^^^^^^^^^^^^^^^^^^^^------^ @@ -303,7 +297,7 @@ LL + #[rustc_scalable_vector] | error[E0539]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:150:1 + --> $DIR/invalid.rs:149:1 | LL | #[rustc_scalable_vector(count = "4")] | ^^^^^^^^^^^^^^^^^^^^^^^^-----------^^ @@ -320,7 +314,7 @@ LL + #[rustc_scalable_vector] | error: element count in `rustc_scalable_vector` is too large: `65536` - --> $DIR/invalid.rs:154:1 + --> $DIR/invalid.rs:153:1 | LL | #[rustc_scalable_vector(65536)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -328,12 +322,12 @@ LL | #[rustc_scalable_vector(65536)] = note: the value may not exceed `u16::MAX` error: scalable vector structs can only have scalable vector fields - --> $DIR/invalid.rs:162:18 + --> $DIR/invalid.rs:161:18 | LL | struct OkayNoArg(f32); | ^^^ -error: aborting due to 39 previous errors +error: aborting due to 38 previous errors Some errors have detailed explanations: E0539, E0805. For more information about an error, try `rustc --explain E0539`.