From d2bc93220174e2eb87e700406da909ff8c68a987 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 14 Sep 2026 12:19:25 +0200 Subject: [PATCH 1/3] Route `fn_hir_id` into `lower_fn_decl` --- compiler/rustc_ast_lowering/src/expr/closure.rs | 8 ++++++-- compiler/rustc_ast_lowering/src/item.rs | 17 +++++++++++++---- compiler/rustc_ast_lowering/src/lib.rs | 15 ++++++++++++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/expr/closure.rs b/compiler/rustc_ast_lowering/src/expr/closure.rs index 26c267a174782..89481b8314105 100644 --- a/compiler/rustc_ast_lowering/src/expr/closure.rs +++ b/compiler/rustc_ast_lowering/src/expr/closure.rs @@ -132,6 +132,7 @@ impl<'hir> LoweringContext<'_, 'hir> { binder, capture_clause, closure_id, + expr_hir_id, constness, movability, decl, @@ -158,6 +159,7 @@ impl<'hir> LoweringContext<'_, 'hir> { binder: &ClosureBinder, capture_clause: CaptureBy, closure_id: NodeId, + closure_hir_id: HirId, constness: Const, movability: Movability, decl: &FnDecl, @@ -204,7 +206,8 @@ impl<'hir> LoweringContext<'_, 'hir> { let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params); // Lower outside new scope to preserve `is_in_loop_condition`. - let fn_decl = self.lower_fn_decl(decl, closure_id, FnDeclKind::Closure, None); + let fn_decl = + self.lower_fn_decl(decl, closure_id, closure_hir_id, FnDeclKind::Closure, None); let c = self.arena.alloc(hir::Closure { def_id: closure_def_id, @@ -327,7 +330,8 @@ impl<'hir> LoweringContext<'_, 'hir> { // We need to lower the declaration outside the new scope, because we // have to conserve the state of being inside a loop condition for the // closure argument types. - let fn_decl = self.lower_fn_decl(&decl, closure_id, FnDeclKind::Closure, None); + let fn_decl = + self.lower_fn_decl(&decl, closure_id, closure_hir_id, FnDeclKind::Closure, None); if let Const::Yes(span) = constness { self.dcx().span_err(span, "const coroutines are not supported"); diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index d987bb69b0c53..add254fc16fb6 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -332,7 +332,12 @@ impl<'hir> LoweringContext<'_, 'hir> { let itctx = ImplTraitContext::Universal; let (generics, decl) = this.lower_generics(generics, itctx, |this| { - this.lower_fn_decl(decl, id, FnDeclKind::Fn, coroutine_marker) + this.lower_fn_decl( + decl, + id, + hir_id, + FnDeclKind::Fn, + coroutine_marker) }); let sig = hir::FnSig { decl, @@ -741,7 +746,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let (generics, (decl, fn_args)) = self.lower_generics(generics, itctx, |this| { ( // Disallow `impl Trait` in foreign items. - this.lower_fn_decl(fdec, i.id, FnDeclKind::ExternFn, None), + this.lower_fn_decl(fdec, i.id, hir_id, FnDeclKind::ExternFn, None), this.lower_fn_params_to_idents(fdec), ) }); @@ -965,6 +970,7 @@ impl<'hir> LoweringContext<'_, 'hir> { generics, sig, i.id, + hir_id, FnDeclKind::Trait, sig.header.coroutine_marker, attrs, @@ -1005,6 +1011,7 @@ impl<'hir> LoweringContext<'_, 'hir> { generics, sig, i.id, + hir_id, FnDeclKind::Trait, sig.header.coroutine_marker, attrs, @@ -1215,6 +1222,7 @@ impl<'hir> LoweringContext<'_, 'hir> { generics, sig, i.id, + hir_id, if is_in_trait_impl { FnDeclKind::Impl } else { FnDeclKind::Inherent }, sig.header.coroutine_marker, attrs, @@ -1660,7 +1668,8 @@ impl<'hir> LoweringContext<'_, 'hir> { &mut self, generics: &Generics, sig: &FnSig, - id: NodeId, + node_id: NodeId, + hir_id: HirId, kind: FnDeclKind, coroutine_marker: Option, attrs: &[hir::Attribute], @@ -1668,7 +1677,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let header = self.lower_fn_header(sig.header, hir::Safety::Safe, attrs); let itctx = ImplTraitContext::Universal; let (generics, decl) = self.lower_generics(generics, itctx, |this| { - this.lower_fn_decl(&sig.decl, id, kind, coroutine_marker) + this.lower_fn_decl(&sig.decl, node_id, hir_id, kind, coroutine_marker) }); (generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) }) } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index aa58ac4a62eca..82ad17eff01dc 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1597,14 +1597,22 @@ impl<'hir> LoweringContext<'_, 'hir> { hir::TyKind::Path(path) } TyKind::FnPtr(f) => { + let hir_id = self.lower_node_id(t.id); let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params); - hir::TyKind::FnPtr(self.arena.alloc(hir::FnPtrTy { + let kind = hir::TyKind::FnPtr(self.arena.alloc(hir::FnPtrTy { generic_params, safety: self.lower_safety(f.safety, hir::Safety::Safe), abi: self.lower_extern(f.ext), - decl: self.lower_fn_decl(&f.decl, t.id, FnDeclKind::Pointer, None), + decl: self.lower_fn_decl( + &f.decl, + t.id, + hir_id, + FnDeclKind::Pointer, + None, + ), param_idents: self.lower_fn_params_to_idents(&f.decl), - })) + })); + return hir::Ty { kind, span: self.lower_span(t.span), hir_id }; } TyKind::UnsafeBinder(f) => { let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params); @@ -1962,6 +1970,7 @@ impl<'hir> LoweringContext<'_, 'hir> { &mut self, decl: &FnDecl, fn_node_id: NodeId, + fn_hir_id: HirId, kind: FnDeclKind, coro: Option, ) -> &'hir hir::FnDecl<'hir> { From f7e96ba8aca536ac0a8ba26ddc37f0d7598afd88 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 14 Sep 2026 13:04:19 +0200 Subject: [PATCH 2/3] Add regression tests --- tests/ui/attributes/attrs-on-params.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/ui/attributes/attrs-on-params.rs b/tests/ui/attributes/attrs-on-params.rs index c8e9810327c2a..ed4a50efa25db 100644 --- a/tests/ui/attributes/attrs-on-params.rs +++ b/tests/ui/attributes/attrs-on-params.rs @@ -5,4 +5,23 @@ fn function(#[inline] param: u32) { //~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes } +trait Test { + fn meow( + #[rustc_splat] a1: u32, + ); + fn meow2( + #[rustc_splat(invalid)] a4: u32, + ); +} + +type Meow = fn( + #[rustc_splat] a1: u32, +); + +extern "Rust" { + fn meow2( + #[rustc_splat] a1: u32, + ); +} + fn main() {} From cad361c4b2896d0408d4bc9d2eaf8c9ee392311f Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 14 Sep 2026 13:32:59 +0200 Subject: [PATCH 3/3] Lower attributes for functions without bodies --- .../rustc_ast_lowering/src/expr/closure.rs | 22 +- compiler/rustc_ast_lowering/src/item.rs | 25 ++- compiler/rustc_ast_lowering/src/lib.rs | 30 ++- library/coretests/tests/lib.rs | 2 + tests/ui/attributes/attrs-on-params.rs | 5 + tests/ui/attributes/attrs-on-params.stderr | 62 +++++- .../param-attrs-builtin-attrs.rs | 8 + .../param-attrs-builtin-attrs.stderr | 190 +++++++++++------- tests/ui/splat/splat-invalid.rs | 2 + tests/ui/splat/splat-invalid.stderr | 36 +++- 10 files changed, 284 insertions(+), 98 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/expr/closure.rs b/compiler/rustc_ast_lowering/src/expr/closure.rs index 89481b8314105..3068a1eb5a29e 100644 --- a/compiler/rustc_ast_lowering/src/expr/closure.rs +++ b/compiler/rustc_ast_lowering/src/expr/closure.rs @@ -5,8 +5,8 @@ use rustc_middle::span_bug; use rustc_span::Span; use super::{LoweringContext, MoveExprState}; -use crate::FnDeclKind; use crate::diagnostics::{ClosureCannotBeStatic, CoroutineTooManyParameters}; +use crate::{DiscardParams, FnDeclKind}; impl<'hir> LoweringContext<'_, 'hir> { // Entry point for `ExprKind::Closure`. Plain closures go through @@ -206,8 +206,14 @@ impl<'hir> LoweringContext<'_, 'hir> { let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params); // Lower outside new scope to preserve `is_in_loop_condition`. - let fn_decl = - self.lower_fn_decl(decl, closure_id, closure_hir_id, FnDeclKind::Closure, None); + let fn_decl = self.lower_fn_decl( + decl, + closure_id, + closure_hir_id, + FnDeclKind::Closure, + None, + DiscardParams::No, + ); let c = self.arena.alloc(hir::Closure { def_id: closure_def_id, @@ -330,8 +336,14 @@ impl<'hir> LoweringContext<'_, 'hir> { // We need to lower the declaration outside the new scope, because we // have to conserve the state of being inside a loop condition for the // closure argument types. - let fn_decl = - self.lower_fn_decl(&decl, closure_id, closure_hir_id, FnDeclKind::Closure, None); + let fn_decl = self.lower_fn_decl( + &decl, + closure_id, + closure_hir_id, + FnDeclKind::Closure, + None, + DiscardParams::No, + ); if let Const::Yes(span) = constness { self.dcx().span_err(span, "const coroutines are not supported"); diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index add254fc16fb6..65e0ece70e274 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -24,8 +24,8 @@ use super::diagnostics::{ }; use super::stability::{enabled_names, gate_unstable_abi}; use super::{ - FnDeclKind, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, - RelaxedBoundForbiddenReason, RelaxedBoundPolicy, + DiscardParams, FnDeclKind, GenericArgsMode, ImplTraitContext, ImplTraitPosition, + LoweringContext, ParamMode, RelaxedBoundForbiddenReason, RelaxedBoundPolicy, }; use crate::diagnostics::{ConstComptimeFn, ResolvingRestrictionKind, RestrictionAncestorOnly}; @@ -337,7 +337,9 @@ impl<'hir> LoweringContext<'_, 'hir> { id, hir_id, FnDeclKind::Fn, - coroutine_marker) + coroutine_marker, + if body.is_none() { DiscardParams::Yes } else { DiscardParams::No }, + ) }); let sig = hir::FnSig { decl, @@ -746,7 +748,15 @@ impl<'hir> LoweringContext<'_, 'hir> { let (generics, (decl, fn_args)) = self.lower_generics(generics, itctx, |this| { ( // Disallow `impl Trait` in foreign items. - this.lower_fn_decl(fdec, i.id, hir_id, FnDeclKind::ExternFn, None), + // Parameters are discarded because foreign functions don't have a body + this.lower_fn_decl( + fdec, + i.id, + hir_id, + FnDeclKind::ExternFn, + None, + DiscardParams::Yes, + ), this.lower_fn_params_to_idents(fdec), ) }); @@ -974,6 +984,8 @@ impl<'hir> LoweringContext<'_, 'hir> { FnDeclKind::Trait, sig.header.coroutine_marker, attrs, + // Parameters are discarded for functions without a body + DiscardParams::Yes, ); if define_opaque.is_some() { self.dcx().span_err( @@ -1015,6 +1027,7 @@ impl<'hir> LoweringContext<'_, 'hir> { FnDeclKind::Trait, sig.header.coroutine_marker, attrs, + DiscardParams::No, ); self.lower_define_opaque(hir_id, &define_opaque); ( @@ -1226,6 +1239,7 @@ impl<'hir> LoweringContext<'_, 'hir> { if is_in_trait_impl { FnDeclKind::Impl } else { FnDeclKind::Inherent }, sig.header.coroutine_marker, attrs, + if body.is_none() { DiscardParams::Yes } else { DiscardParams::No }, ); self.lower_define_opaque(hir_id, &define_opaque); @@ -1673,11 +1687,12 @@ impl<'hir> LoweringContext<'_, 'hir> { kind: FnDeclKind, coroutine_marker: Option, attrs: &[hir::Attribute], + discard_params: DiscardParams, ) -> (&'hir hir::Generics<'hir>, hir::FnSig<'hir>) { let header = self.lower_fn_header(sig.header, hir::Safety::Safe, attrs); let itctx = ImplTraitContext::Universal; let (generics, decl) = self.lower_generics(generics, itctx, |this| { - this.lower_fn_decl(&sig.decl, node_id, hir_id, kind, coroutine_marker) + this.lower_fn_decl(&sig.decl, node_id, hir_id, kind, coroutine_marker, discard_params) }); (generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) }) } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 82ad17eff01dc..20dfe7a8424fa 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -828,6 +828,14 @@ enum GenericArgsMode { Silence, } +#[derive(Debug, Copy, Clone)] +enum DiscardParams { + /// Should be used for functions without a body. Lowers the attributes on the parameter and then discards them. + Yes, + /// Should be used for functions with a body. Does not lower the attributes, as lowering of the parameters is done by `lower_body`. + No, +} + impl<'hir> LoweringContext<'_, 'hir> { fn create_def( &mut self, @@ -1609,6 +1617,7 @@ impl<'hir> LoweringContext<'_, 'hir> { hir_id, FnDeclKind::Pointer, None, + DiscardParams::Yes, ), param_idents: self.lower_fn_params_to_idents(&f.decl), })); @@ -1960,11 +1969,17 @@ impl<'hir> LoweringContext<'_, 'hir> { /// /// `decl`: the unlowered (AST) function declaration. /// - /// `fn_node_id`: `impl Trait` arguments are lowered into generic parameters on the given - /// `NodeId`. + /// `fn_node_id`: Node Id of the function. /// - /// `transform_return_type`: if `Some`, applies some conversion to the return type, such as is - /// needed for `async fn` and `gen fn`. See [`CoroutineKind`] for more details. + /// `fn_hir_id`: Hir Id of the function. Used for attribute parsing. + /// + /// `kind`: The kind of function. + /// + /// `coro`: If the function is a coroutine, information about the coroutine. + /// + /// `discard_params`: if `DiscardParams::Yes`, the parameters are lowered and then discarded. Set this to `DiscardParams::Yes` + /// for functions without bodies, as attributes on parameters are otherwise not validated. + /// Set this to `DiscardParams::No` for functions with bodies, as lowering of the parameters is done by `lower_body`. #[instrument(level = "debug", skip(self))] fn lower_fn_decl( &mut self, @@ -1973,6 +1988,7 @@ impl<'hir> LoweringContext<'_, 'hir> { fn_hir_id: HirId, kind: FnDeclKind, coro: Option, + discard_params: DiscardParams, ) -> &'hir hir::FnDecl<'hir> { let c_variadic = decl.c_variadic(); let mut splatted = decl.splatted(); @@ -1987,6 +2003,12 @@ impl<'hir> LoweringContext<'_, 'hir> { inputs = &inputs[..inputs.len() - 1]; } let inputs = self.arena.alloc_from_iter(inputs.iter().map(|param| { + if let DiscardParams::Yes = discard_params { + // FIXME This uses `fn_hir_id`, which is not correct, it should use the parameter hir id instead + // The parameter is currently not lowered for functions without bodies, so there is no place to store the lowered hir id + // This should be fixed by storing function parameters in the `hir::FnSig` instead of `hir::Body` + self.lower_attrs(fn_hir_id, ¶m.attrs, param.span, Target::Param); + } let itctx = match kind { FnDeclKind::Fn | FnDeclKind::Inherent | FnDeclKind::Impl | FnDeclKind::Trait => { ImplTraitContext::Universal diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 69bc6edd1b833..344f1474818df 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -111,6 +111,7 @@ #![feature(slice_shift)] #![feature(slice_split_once)] #![feature(sliceindex_wrappers)] +#![feature(splat)] #![feature(split_array)] #![feature(split_as_slice)] #![feature(std_internals)] @@ -132,6 +133,7 @@ #![feature(unsize)] #![feature(unwrap_infallible)] // tidy-alphabetical-end +#![allow(incomplete_features)] #![allow(internal_features)] #![deny(implicit_provenance_casts)] #![deny(unsafe_op_in_unsafe_fn)] diff --git a/tests/ui/attributes/attrs-on-params.rs b/tests/ui/attributes/attrs-on-params.rs index ed4a50efa25db..e12ff906fa3f5 100644 --- a/tests/ui/attributes/attrs-on-params.rs +++ b/tests/ui/attributes/attrs-on-params.rs @@ -8,19 +8,24 @@ fn function(#[inline] param: u32) { trait Test { fn meow( #[rustc_splat] a1: u32, + //~^ ERROR the `rustc_splat` attribute is an experimental feature ); fn meow2( #[rustc_splat(invalid)] a4: u32, + //~^ ERROR the `rustc_splat` attribute is an experimental feature + //~| ERROR malformed `rustc_splat` attribute input ); } type Meow = fn( #[rustc_splat] a1: u32, + //~^ ERROR the `rustc_splat` attribute is an experimental feature ); extern "Rust" { fn meow2( #[rustc_splat] a1: u32, + //~^ ERROR the `rustc_splat` attribute is an experimental feature ); } diff --git a/tests/ui/attributes/attrs-on-params.stderr b/tests/ui/attributes/attrs-on-params.stderr index b38c590a19a5c..748f189590a46 100644 --- a/tests/ui/attributes/attrs-on-params.stderr +++ b/tests/ui/attributes/attrs-on-params.stderr @@ -12,5 +12,65 @@ LL | fn function(#[inline] param: u32) { | = help: the `inline` attribute can only be applied to functions -error: aborting due to 2 previous errors +error[E0658]: the `rustc_splat` attribute is an experimental feature + --> $DIR/attrs-on-params.rs:10:11 + | +LL | #[rustc_splat] a1: u32, + | ^^^^^^^^^^^ + | + = note: see issue #153629 for more information + = help: add `#![feature(splat)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: the `rustc_splat` attribute is experimental + +error[E0658]: the `rustc_splat` attribute is an experimental feature + --> $DIR/attrs-on-params.rs:14:11 + | +LL | #[rustc_splat(invalid)] a4: u32, + | ^^^^^^^^^^^ + | + = note: see issue #153629 for more information + = help: add `#![feature(splat)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: the `rustc_splat` attribute is experimental + +error[E0565]: malformed `rustc_splat` attribute input + --> $DIR/attrs-on-params.rs:14:11 + | +LL | #[rustc_splat(invalid)] a4: u32, + | ^^^^^^^^^^^--------- + | | + | didn't expect any arguments here + | +help: must be of the form + | +LL - #[rustc_splat(invalid)] a4: u32, +LL + #[rustc_splat] a4: u32, + | + +error[E0658]: the `rustc_splat` attribute is an experimental feature + --> $DIR/attrs-on-params.rs:21:7 + | +LL | #[rustc_splat] a1: u32, + | ^^^^^^^^^^^ + | + = note: see issue #153629 for more information + = help: add `#![feature(splat)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: the `rustc_splat` attribute is experimental + +error[E0658]: the `rustc_splat` attribute is an experimental feature + --> $DIR/attrs-on-params.rs:27:11 + | +LL | #[rustc_splat] a1: u32, + | ^^^^^^^^^^^ + | + = note: see issue #153629 for more information + = help: add `#![feature(splat)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: the `rustc_splat` attribute is experimental + +error: aborting due to 7 previous errors +Some errors have detailed explanations: E0565, E0658. +For more information about an error, try `rustc --explain E0565`. 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..7f1d5c849ebe6 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 @@ -8,10 +8,14 @@ extern "C" { //~^ 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 cannot be used on function params + //~| WARN previously accepted /// 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 cannot be used on function params + //~| WARN previously accepted ); } @@ -24,10 +28,14 @@ type FnType = fn( //~^ 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 cannot be used on function params + //~| WARN previously accepted /// 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 cannot be used on function params + //~| WARN previously accepted ); pub fn foo( 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..db2d8f161dba0 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 @@ -5,55 +5,55 @@ LL | #[test] a: i32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:21:7 + --> $DIR/param-attrs-builtin-attrs.rs:25:7 | LL | #[test] a: u32, | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/param-attrs-builtin-attrs.rs:36:7 + --> $DIR/param-attrs-builtin-attrs.rs:44:7 | 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:68: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:87: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:112: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:135: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:154: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:178: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:199:11 | LL | #[test] a: u32, | ^^^^ not a non-macro attribute @@ -77,313 +77,313 @@ LL | #[must_use] | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:11:9 + --> $DIR/param-attrs-builtin-attrs.rs:13: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 + --> $DIR/param-attrs-builtin-attrs.rs:15:9 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:19:5 + --> $DIR/param-attrs-builtin-attrs.rs:23:5 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:23:5 + --> $DIR/param-attrs-builtin-attrs.rs:27:5 | 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 + --> $DIR/param-attrs-builtin-attrs.rs:29:5 | LL | #[must_use] | ^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:27:5 + --> $DIR/param-attrs-builtin-attrs.rs:33: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 + --> $DIR/param-attrs-builtin-attrs.rs:35:5 | LL | #[no_mangle] b: i32, | ^^^^^^^^^^^^ error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:34:5 + --> $DIR/param-attrs-builtin-attrs.rs:42:5 | LL | /// Foo | ^^^^^^^ doc comments are not allowed here error: documentation comments cannot be applied to function parameters - --> $DIR/param-attrs-builtin-attrs.rs:38:5 + --> $DIR/param-attrs-builtin-attrs.rs:46:5 | 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 + --> $DIR/param-attrs-builtin-attrs.rs:48: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:52: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 + --> $DIR/param-attrs-builtin-attrs.rs:54: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:63: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:66: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:70: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 + --> $DIR/param-attrs-builtin-attrs.rs:72: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:76: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 + --> $DIR/param-attrs-builtin-attrs.rs:78: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:85: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:89: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 + --> $DIR/param-attrs-builtin-attrs.rs:91: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:95: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 + --> $DIR/param-attrs-builtin-attrs.rs:97: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:107: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:110: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:114: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 + --> $DIR/param-attrs-builtin-attrs.rs:116: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:120: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 + --> $DIR/param-attrs-builtin-attrs.rs:122: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:130: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:133: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:137: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 + --> $DIR/param-attrs-builtin-attrs.rs:139: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:143: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 + --> $DIR/param-attrs-builtin-attrs.rs:145: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:152: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:156: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 + --> $DIR/param-attrs-builtin-attrs.rs:158: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:162: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 + --> $DIR/param-attrs-builtin-attrs.rs:164: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:173: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:176: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:180: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 + --> $DIR/param-attrs-builtin-attrs.rs:182: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:186: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 + --> $DIR/param-attrs-builtin-attrs.rs:188: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:197: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:201: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 + --> $DIR/param-attrs-builtin-attrs.rs:203: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:207: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 + --> $DIR/param-attrs-builtin-attrs.rs:209:9 | LL | #[no_mangle] b: i32 | ^^^^^^^^^^^^ warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:40:7 + --> $DIR/param-attrs-builtin-attrs.rs:29:7 | LL | #[must_use] | ^^^^^^^^ @@ -393,7 +393,25 @@ LL | #[must_use] = note: requested on the command line with `-W unused-attributes` warning: the `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:46:7 + --> $DIR/param-attrs-builtin-attrs.rs:35: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! + +warning: the `must_use` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:48: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 + --> $DIR/param-attrs-builtin-attrs.rs:54:7 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -402,7 +420,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:195:11 + --> $DIR/param-attrs-builtin-attrs.rs:203:11 | LL | #[must_use] | ^^^^^^^^ @@ -411,7 +429,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:201:11 + --> $DIR/param-attrs-builtin-attrs.rs:209:11 | LL | #[no_mangle] b: i32 | ^^^^^^^^^ @@ -420,7 +438,25 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:131:11 + --> $DIR/param-attrs-builtin-attrs.rs:139:11 + | +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 + --> $DIR/param-attrs-builtin-attrs.rs:145:11 + | +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! + +warning: the `must_use` attribute cannot be used on function params + --> $DIR/param-attrs-builtin-attrs.rs:158:11 | LL | #[must_use] | ^^^^^^^^ @@ -429,7 +465,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:137:11 + --> $DIR/param-attrs-builtin-attrs.rs:164:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -438,7 +474,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:150:11 + --> $DIR/param-attrs-builtin-attrs.rs:72:11 | LL | #[must_use] | ^^^^^^^^ @@ -447,7 +483,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:156:11 + --> $DIR/param-attrs-builtin-attrs.rs:78:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -456,7 +492,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:64:11 + --> $DIR/param-attrs-builtin-attrs.rs:91:11 | LL | #[must_use] | ^^^^^^^^ @@ -465,7 +501,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:70:11 + --> $DIR/param-attrs-builtin-attrs.rs:97:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -474,7 +510,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:83:11 + --> $DIR/param-attrs-builtin-attrs.rs:116:11 | LL | #[must_use] | ^^^^^^^^ @@ -483,7 +519,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:89:11 + --> $DIR/param-attrs-builtin-attrs.rs:122:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -492,7 +528,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:108:11 + --> $DIR/param-attrs-builtin-attrs.rs:182:11 | LL | #[must_use] | ^^^^^^^^ @@ -501,7 +537,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:114:11 + --> $DIR/param-attrs-builtin-attrs.rs:188:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -510,7 +546,7 @@ 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! warning: the `must_use` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:174:11 + --> $DIR/param-attrs-builtin-attrs.rs:9:11 | LL | #[must_use] | ^^^^^^^^ @@ -519,7 +555,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 `no_mangle` attribute cannot be used on function params - --> $DIR/param-attrs-builtin-attrs.rs:180:11 + --> $DIR/param-attrs-builtin-attrs.rs:15:11 | LL | #[no_mangle] b: i32, | ^^^^^^^^^ @@ -527,5 +563,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 64 previous errors; 20 warnings emitted diff --git a/tests/ui/splat/splat-invalid.rs b/tests/ui/splat/splat-invalid.rs index 9a0101636a8b0..e30ac4a9af276 100644 --- a/tests/ui/splat/splat-invalid.rs +++ b/tests/ui/splat/splat-invalid.rs @@ -69,12 +69,14 @@ fn main() { let multisplat_arg_bad_: fn( #[rustc_splat] #[rustc_splat] + //~^ ERROR multiple `rustc_splat` attributes (u32, i8), ) = multisplat_arg_bad; let multisplat_arg_fn_bad_: fn( #[rustc_splat] //~^ ERROR multiple `#[rustc_splat]`s are not allowed in the same function argument list #[rustc_splat] + //~^ ERROR multiple `rustc_splat` attributes (u32, i8), #[rustc_splat] (u32, i8), ) = multisplat_arg_fn_bad; diff --git a/tests/ui/splat/splat-invalid.stderr b/tests/ui/splat/splat-invalid.stderr index f1c492bd3e37e..8681084a3c594 100644 --- a/tests/ui/splat/splat-invalid.stderr +++ b/tests/ui/splat/splat-invalid.stderr @@ -96,21 +96,21 @@ LL | fn(#[rustc_splat] (u32, i8), #[rustc_splat] (u32, i8)) = multisplat = help: remove `#[rustc_splat]` from all but one argument error: multiple `#[rustc_splat]`s are not allowed in the same function argument list - --> $DIR/splat-invalid.rs:75:9 + --> $DIR/splat-invalid.rs:76:9 | LL | #[rustc_splat] | ^^^^^^^^^^^^^^ LL | LL | #[rustc_splat] | ^^^^^^^^^^^^^^ -LL | (u32, i8), +... LL | #[rustc_splat] (u32, i8), | ^^^^^^^^^^^^^^ | = help: remove `#[rustc_splat]` from all but one argument error: `...` and `#[rustc_splat]` are not allowed in the same function argument list - --> $DIR/splat-invalid.rs:82:47 + --> $DIR/splat-invalid.rs:84:47 | LL | let splat_variadic_: unsafe extern "C" fn(#[rustc_splat] (u32, i8), ...) = splat_variadic; | ^^^^^^^^^^^^^^ ^^^ @@ -118,13 +118,13 @@ LL | let splat_variadic_: unsafe extern "C" fn(#[rustc_splat] (u32, i8), ... = help: remove `#[rustc_splat]` or remove `...` error: `...` must be the last argument of a C-variadic function - --> $DIR/splat-invalid.rs:84:48 + --> $DIR/splat-invalid.rs:86:48 | LL | let splat_variadic2_: unsafe extern "C" fn(..., #[rustc_splat] (u32, i8)) = splat_variadic2; | ^^^ error: `...` and `#[rustc_splat]` are not allowed in the same function argument list - --> $DIR/splat-invalid.rs:84:48 + --> $DIR/splat-invalid.rs:86:48 | LL | let splat_variadic2_: unsafe extern "C" fn(..., #[rustc_splat] (u32, i8)) = splat_variadic2; | ^^^ ^^^^^^^^^^^^^^ @@ -155,6 +155,30 @@ note: attribute also specified here LL | #[rustc_splat] | ^^^^^^^^^^^^^^ +error: multiple `rustc_splat` attributes + --> $DIR/splat-invalid.rs:71:9 + | +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/splat-invalid.rs:70:9 + | +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ + +error: multiple `rustc_splat` attributes + --> $DIR/splat-invalid.rs:78:9 + | +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/splat-invalid.rs:76:9 + | +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ + error[E0053]: method `has_splat` has an incompatible type for trait --> $DIR/splat-invalid.rs:59:5 | @@ -183,6 +207,6 @@ LL | fn no_splat(_: (u32, f64)); = note: expected signature `fn((_, _))` found signature `fn(#[rustc_splat] (_, _))` -error: aborting due to 19 previous errors +error: aborting due to 21 previous errors For more information about this error, try `rustc --explain E0053`.