diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index bd5ce5d18b839..23b716ec6325b 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3074,7 +3074,7 @@ impl FnDecl { } else { arg.attrs .iter() - .any(|attr| attr.has_name(sym::splat)) + .any(|attr| attr.has_name(sym::rustc_splat)) .then_some(u8::try_from(index).unwrap()) } }) diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index a2a7b542258d1..0c56057c96058 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -362,7 +362,7 @@ impl<'hir> LoweringContext<'_, 'hir> { self.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id()) } - /// Returns function parameter info, including C variadic `...` and `#[splat]` if present. + /// Returns function parameter info, including C variadic `...` and `#[rustc_splat]` if present. fn param_info(&self, def_id: DefId) -> ParamInfo { let sig = self.tcx.fn_sig(def_id).skip_binder().skip_binder(); diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 06925994b052c..dc73c23db606a 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -398,7 +398,7 @@ impl<'a> AstValidator<'a> { /// Emits an error if a function declaration has more than one splatted argument, with a /// C-variadic parameter, or a splat at an unsupported index (for performance). - /// Example: `fn foo(#[splat] x: (), #[splat] y: ())` will emit an error. + /// Example: `fn foo(#[rustc_splat] x: (), #[rustc_splat] y: ())` will emit an error. fn check_decl_splatting(&self, fn_decl: &FnDecl, c_variadic_span: Option) { let (splatted_arg_indexes, mut splatted_spans): (Vec, Vec) = fn_decl .inputs @@ -407,7 +407,7 @@ impl<'a> AstValidator<'a> { .filter_map(|(index, arg)| { arg.attrs .iter() - .any(|attr| attr.has_name(sym::splat)) + .any(|attr| attr.has_name(sym::rustc_splat)) .then_some((u16::try_from(index).unwrap(), arg.span)) }) .unzip(); @@ -451,7 +451,7 @@ impl<'a> AstValidator<'a> { sym::deny, sym::expect, sym::forbid, - sym::splat, + sym::rustc_splat, sym::warn, ]; !attr.has_any_name(&arr) && rustc_attr_parsing::is_builtin_attr(*attr) diff --git a/compiler/rustc_ast_passes/src/diagnostics.rs b/compiler/rustc_ast_passes/src/diagnostics.rs index 7a78e8e6213a5..fda240cd10919 100644 --- a/compiler/rustc_ast_passes/src/diagnostics.rs +++ b/compiler/rustc_ast_passes/src/diagnostics.rs @@ -124,27 +124,27 @@ pub(crate) struct FnParamCVarArgsNotLast { } #[derive(Diagnostic)] -#[diag("`#[splat]` is not supported on argument index {$splatted_arg_index}")] -#[help("remove `#[splat]`, or use it on an argument closer to the start of the argument list")] +#[diag("`#[rustc_splat]` is not supported on argument index {$splatted_arg_index}")] +#[help("remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list")] pub(crate) struct InvalidSplattedArg { pub splatted_arg_index: u16, #[primary_span] - #[label("`#[splat]` is not supported here")] + #[label("`#[rustc_splat]` is not supported here")] pub span: Span, } #[derive(Diagnostic)] -#[diag("multiple `#[splat]`s are not allowed in the same function")] -#[help("remove `#[splat]` from all but one argument")] +#[diag("multiple `#[rustc_splat]`s are not allowed in the same function")] +#[help("remove `#[rustc_splat]` from all but one argument")] pub(crate) struct DuplicateSplattedArgs { #[primary_span] pub spans: Vec, } #[derive(Diagnostic)] -#[diag("`...` and `#[splat]` are not allowed in the same function")] -#[help("remove `#[splat]` or remove `...`")] +#[diag("`...` and `#[rustc_splat]` are not allowed in the same function")] +#[help("remove `#[rustc_splat]` or remove `...`")] pub(crate) struct CVarArgsAndSplat { #[primary_span] pub spans: Vec, diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index dc6bc0a8123e9..e61c4b438e3dc 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -500,7 +500,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { gate_all!(pin_ergonomics, "pinned reference syntax is experimental"); gate_all!(postfix_match, "postfix match is experimental"); gate_all!(return_type_notation, "return type notation is experimental"); - gate_all!(splat, "`fn(#[splat] (a, ...))` is incomplete", "call as func((a, ...)) instead"); + gate_all!(splat, "`fn(#[rustc_splat] (a, ...))` is incomplete", "call as func((a, ...)) instead"); gate_all!(super_let, "`super let` is experimental"); gate_all!(try_blocks_heterogeneous, "`try bikeshed` expression is experimental"); gate_all!(unnamed_enum_variants, "unnamed enum variants are experimental"); diff --git a/compiler/rustc_attr_parsing/src/attributes/splat.rs b/compiler/rustc_attr_parsing/src/attributes/splat.rs index ab34021ad7cdf..0228679e1ddb4 100644 --- a/compiler/rustc_attr_parsing/src/attributes/splat.rs +++ b/compiler/rustc_attr_parsing/src/attributes/splat.rs @@ -1,4 +1,4 @@ -//! Attribute parsing for the `#[splat]` function argument overloading attribute. +//! Attribute parsing for the `#[rustc_splat]` function argument overloading attribute. //! This attribute modifies typecheck to support overload resolution, then modifies codegen for performance. use rustc_feature::AttributeStability; @@ -8,9 +8,9 @@ use super::prelude::*; pub(crate) struct SplatParser; impl NoArgsAttributeParser for SplatParser { - const PATH: &[Symbol] = &[sym::splat]; + const PATH: &[Symbol] = &[sym::rustc_splat]; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Param)]); const STABILITY: AttributeStability = - unstable!(splat, "the `#[splat]` attribute is experimental"); + unstable!(splat, "the `#[rustc_splat]` attribute is experimental"); const CREATE: fn(Span) -> AttributeKind = AttributeKind::Splat; } diff --git a/compiler/rustc_attr_parsing/src/attributes/unroll.rs b/compiler/rustc_attr_parsing/src/attributes/unroll.rs index 50c73ca041cdd..e6898bb9e8681 100644 --- a/compiler/rustc_attr_parsing/src/attributes/unroll.rs +++ b/compiler/rustc_attr_parsing/src/attributes/unroll.rs @@ -6,7 +6,8 @@ use super::prelude::*; pub(crate) struct UnrollParser; impl SingleAttributeParser for UnrollParser { - const PATH: &[Symbol] = &[sym::unroll]; + // FIXME(#159429): temporarily renamed to mitigate `#[unroll]` nameres ambiguity. + const PATH: &[Symbol] = &[sym::rustc_unroll]; const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[ Allow(Target::Loop), Allow(Target::ForLoop), diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index e081c2989d3c6..3e5ca7b0931fb 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -208,16 +208,18 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[ // - https://github.com/rust-lang/rust/issues/130494 sym::pin_v2, - // The `#[splat]` attribute is part of the `splat` experiment + // The `#[rustc_splat]` attribute is part of the `splat` experiment // that improves the ergonomics of function overloading, tracked in: // // - https://github.com/rust-lang/rust/issues/153629 - sym::splat, + sym::rustc_splat, - // The `#[unroll]` attribute. + // The `#[rustc_unroll]` attribute. // // - https://github.com/rust-lang/rust/pull/156816 - sym::unroll, + // + // FIXME(#159429): temporarily renamed to mitigate `#[unroll]` nameres ambiguity + sym::rustc_unroll, // `#[instrument_fn = "on|off"]` to insert or inhibit instrumentation function // calls inside a function, usually around the prologue. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index e497012f5e0d3..64b4258f0bb2a 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -730,7 +730,7 @@ declare_features! ( /// Allows specialization of implementations (RFC 1210). (incomplete, specialization, "1.7.0", Some(31844)), /// Experimental "splatting" of function call arguments at the call site. - /// e.g. `foo(a, b, c)` calls `#[splat] fn foo((a: A, b: B, c: C))`. + /// e.g. `foo(a, b, c)` calls `#[rustc_splat] fn foo((a: A, b: B, c: C))`. (incomplete, splat, "1.98.0", Some(153629)), /// Allows using `#[rustc_align_static(...)]` on static items. (unstable, static_align, "1.91.0", Some(146177)), diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 17d00863d99d5..f456c086e5378 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -1665,7 +1665,7 @@ pub enum AttributeKind { reason: Option, }, - /// Represents `#[splat]` + /// Represents `#[rustc_splat]` Splat(Span), /// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`. @@ -1697,7 +1697,8 @@ pub enum AttributeKind { limit: Limit, }, - /// Represents `#[unroll]` + /// Represents `#[rustc_unroll]` + // FIXME(#159429): temporarily renamed from `#[unroll]` to mitigate nameres ambiguity Unroll(UnrollAttr), /// Represents `#[unstable_feature_bound]`. diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index f0c5f6b85423c..50f1a85045637 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -450,7 +450,7 @@ fn fn_sig_suggestion<'tcx>( .iter() .enumerate() .map(|(i, ty)| { - let splat = if splatted_arg_index == Some(i) { "#[splat] " } else { "" }; + let splat = if splatted_arg_index == Some(i) { "#[rustc_splat] " } else { "" }; let arg_ty = match ty.kind() { ty::Param(_) if assoc.is_method() && i == 0 => "self".to_string(), ty::Ref(reg, ref_ty, mutability) if i == 0 => { diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 136fe22eea60f..466dc84265c6f 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -2266,7 +2266,7 @@ impl<'a> State<'a> { let mut i = 0; let mut print_arg = |s: &mut Self, ty: Option<&hir::Ty<'_>>| { if Some(i) == decl.splatted().map(usize::from) { - s.word("#[splat]"); + s.word("#[rustc_splat]"); } if i == 0 && decl.implicit_self().has_implicit_self() { s.print_implicit_self(&decl.implicit_self()); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 7d85a5a4ded63..8709e4ad97c4b 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -50,7 +50,7 @@ rustc_index::newtype_index! { pub(crate) struct GenericIdx {} } -/// Outcome of checking arguments that are tupled by "rust-call" or `#[splat]`. +/// Outcome of checking arguments that are tupled by "rust-call" or `#[rustc_splat]`. #[derive(Debug, Clone, Eq, PartialEq)] struct TupledArgCheckOutcome<'tcx> { /// The error code to emit if the arguments are not compatible. @@ -560,7 +560,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - /// Check arguments that are tupled by "rust-call" or `#[splat]`. + /// Check arguments that are tupled by "rust-call" or `#[rustc_splat]`. fn check_tupled_arguments( &self, // Span enclosing the call site @@ -596,10 +596,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // The argument difference can range from -1 to u16::MAX - 1, so we count the number // of tupled arguments instead. // (An empty argument list becomes a unit tuple in the callee.) - // 0: f() -> f(#[splat] _: ()) - // 1: f(a) -> f(#[splat] _: (A,)) - // 2: f(a, b) -> f(#[splat] _: (A, B)) - // The Fn* traits ensure this by construction, and `#[splat]` can only be applied to + // 0: f() -> f(#[rustc_splat] _: ()) + // 1: f(a) -> f(#[rustc_splat] _: (A,)) + // 2: f(a, b) -> f(#[rustc_splat] _: (A, B)) + // The Fn* traits ensure this by construction, and `#[rustc_splat]` can only be applied to // an actual argument. let tupled_args_count = (1 + provided_args.len()).checked_sub(formal_input_tys.len()); debug!( diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 03d13e6a81a6e..1bff2b5dd5e1f 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1548,7 +1548,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { let mut input_iter = inputs.iter().copied(); if let Some(index) = splatted_arg_index { self.comma_sep((&mut input_iter).take(usize::from(index)))?; - write!(self, ", #[splat]")?; + write!(self, ", #[rustc_splat]")?; self.comma_sep(input_iter)?; } else { self.comma_sep(input_iter)?; diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index c286c0819aea2..fb95e007ff2f1 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -371,7 +371,7 @@ impl<'tcx> ThirBuildCx<'tcx> { hir::ExprKind::MethodCall(segment, receiver, args, fn_span) => { if self.typeck_results.is_splatted_call(expr) { // The callee has a splatted tuple argument. - // rewrite `receiver.f(a, u, v)` into `receiver.f(a, #[splat] (u, v))` + // rewrite `receiver.f(a, u, v)` into `receiver.f(a, #[rustc_splat] (u, v))` self.convert_splatted_callee(expr, fn_span, args, Some(receiver)) } else { // Rewrite a.b(c) into UFCS form like Trait::b(a, c) @@ -421,7 +421,7 @@ impl<'tcx> ThirBuildCx<'tcx> { } } else if self.typeck_results.is_splatted_call(expr) { // The callee has a splatted tuple argument. - // rewrite `f(a, u, v)` into `f(a, #[splat] (u, v))` + // rewrite `f(a, u, v)` into `f(a, #[rustc_splat] (u, v))` self.convert_splatted_callee(expr, fun.span, args, None) } else { // Tuple-like ADTs are represented as ExprKind::Call. We convert them here. @@ -1248,7 +1248,7 @@ impl<'tcx> ThirBuildCx<'tcx> { } /// The callee has a splatted tuple argument. - /// Rewrite a splatted call `receiver.f(a, u, v)` into `receiver.f(a, #[splat] (u, v))`. + /// Rewrite a splatted call `receiver.f(a, u, v)` into `receiver.f(a, #[rustc_splat] (u, v))`. /// The receiver is optional. fn convert_splatted_callee( &mut self, @@ -1264,7 +1264,7 @@ impl<'tcx> ThirBuildCx<'tcx> { let tupled_arg_index = usize::from(tupled_arg_index); let tupled_args_count = usize::from(tupled_args_count); - // Splatting an empty tuple is permitted: `a.f() -> Trait::f(a, #[splat] ())`. + // Splatting an empty tuple is permitted: `a.f() -> Trait::f(a, #[rustc_splat] ())`. // In that case, the tupled arg index is one past the end of the args. if tupled_arg_index + tupled_args_count > args.len() { span_bug!( diff --git a/compiler/rustc_public/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs index 181498443073d..5e043192e4006 100644 --- a/compiler/rustc_public/src/unstable/convert/internal.rs +++ b/compiler/rustc_public/src/unstable/convert/internal.rs @@ -312,7 +312,7 @@ impl RustcInternal for FnSig { tables: &mut Tables<'_, BridgeTys>, tcx: impl InternalCx<'tcx>, ) -> Self::T<'tcx> { - // FIXME(splat): When `#[splat]` is complete (or stable), add splatted to the public FnSig + // FIXME(splat): When `#[rustc_splat]` is complete (or stable), add splatted to the public FnSig let fn_sig_kind = rustc_ty::FnSigKind::default() .set_abi(self.abi.internal(tables, tcx)) .set_safety(self.safety.internal(tables, tcx)) diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 71eae246ebaff..facb3f145567a 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1850,11 +1850,14 @@ symbols! { rustc_simd_monomorphize_lane_limit, rustc_skip_during_method_dispatch, rustc_specialization_trait, + rustc_splat, rustc_std_internal_symbol, rustc_strict_coherence, rustc_test_marker, rustc_then_this_would_need, rustc_trivial_field_reads, + // FIXME(#159429): temporary rename to avoid `#[unroll]` nameres ambiguity + rustc_unroll, rustc_unsafe_specialization_marker, rustdoc, rustdoc_internals, @@ -2235,7 +2238,6 @@ symbols! { unreachable_display, unreachable_macro, unrestricted_attribute_tokens, - unroll, unsafe_attributes, unsafe_binders, unsafe_block_in_unsafe_fn, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index 9822e8cdef8b2..07586c5e48792 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -829,11 +829,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { for (i, (l, r)) in iter::zip(sig1.inputs(), sig2.inputs()).enumerate() { self.push_comma(&mut values.0, &mut values.1, i); if Some(i) == splatted_arg_index1 { - values.0.push("#[splat]", splatted_arg_index1 != splatted_arg_index2); + values.0.push("#[rustc_splat]", splatted_arg_index1 != splatted_arg_index2); values.0.push_normal(" "); } if Some(i) == splatted_arg_index2 { - values.1.push("#[splat]", splatted_arg_index1 != splatted_arg_index2); + values.1.push("#[rustc_splat]", splatted_arg_index1 != splatted_arg_index2); values.1.push_normal(" "); } let (x1, x2) = self.cmp(*l, *r); diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index 31824b61cfb27..cfb228d5b92b8 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -1239,7 +1239,7 @@ impl fmt::Debug for FnSig { write!(f, ", ")?; } if Some(i) == fn_sig_kind.splatted().map(usize::from) { - write!(f, "#[splat] ")?; + write!(f, "#[rustc_splat] ")?; } write!(f, "{ty:?}")?; } diff --git a/library/core/src/mem/type_info.rs b/library/core/src/mem/type_info.rs index 7614adbcc532b..077f93c6ab375 100644 --- a/library/core/src/mem/type_info.rs +++ b/library/core/src/mem/type_info.rs @@ -348,7 +348,7 @@ pub struct FnPtr { pub is_splatted: bool, /// The index of the splatted function argument in `inputs`, only valid if `is_splatted` is true. - /// e.g. in `fn overload(a: u8, #[splat] b: (f32, usize))` the index is 1, and it can be called + /// e.g. in `fn overload(a: u8, #[rustc_splat] b: (f32, usize))` the index is 1, and it can be called /// as `overload(a, 1.0, 2)`. pub splatted_index: u8, } diff --git a/library/coretests/tests/mem/fn_ptr.rs b/library/coretests/tests/mem/fn_ptr.rs index 6e7e170917f55..192054bcaf66b 100644 --- a/library/coretests/tests/mem/fn_ptr.rs +++ b/library/coretests/tests/mem/fn_ptr.rs @@ -192,7 +192,7 @@ fn test_variadic() { #[test] fn test_splat() { #[rustfmt::skip] - let TypeKind::FnPtr(fn_ptr_ty) = &(const { Type::of::().kind }) else { + let TypeKind::FnPtr(fn_ptr_ty) = &(const { Type::of::().kind }) else { panic!(); }; let FnPtr { diff --git a/src/doc/unstable-book/src/language-features/loop-hints.md b/src/doc/unstable-book/src/language-features/loop-hints.md index c02411d30c668..b82a7b367095a 100644 --- a/src/doc/unstable-book/src/language-features/loop-hints.md +++ b/src/doc/unstable-book/src/language-features/loop-hints.md @@ -6,18 +6,22 @@ The tracking issue for this feature is: [#156874] ------ + + Loop unrolling can be a powerful optimization but like inlining, it is sometimes useful to manually provide hints to optimizations. -`#[unroll]` will encourage unrolling of a loop. +`#[rustc_unroll]` will encourage unrolling of a loop. -`#[unroll(full)]` is a stronger hint and can cause optimizations to completely ignore the code +`#[rustc_unroll(full)]` is a stronger hint and can cause optimizations to completely ignore the code side growth from repeating a loop body. -`#[unroll(never)]` is a strong hint to not unroll the loop at all. Note that other loop +`#[rustc_unroll(never)]` is a strong hint to not unroll the loop at all. Note that other loop optimizations may still be applied. -`#[unroll(N)]` is a hint to unroll `N` iterations of the loop. +`#[rustc_unroll(N)]` is a hint to unroll `N` iterations of the loop. In all cases these are just hints and may be ignored. But unlike function inlining hints, loops tend to be heavily modified during compilation, which can make obeying hints challenging. diff --git a/src/tools/cargo b/src/tools/cargo index d33be5d17d90e..797e8a9bca276 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit d33be5d17d90eeb98d6fa329b5d46b6587493ea2 +Subproject commit 797e8a9bca276c1c9f9f738d2a20f484fa4eea9d diff --git a/src/tools/rustfmt/src/modules.rs b/src/tools/rustfmt/src/modules.rs index 099a644282102..89f3e71f9eb45 100644 --- a/src/tools/rustfmt/src/modules.rs +++ b/src/tools/rustfmt/src/modules.rs @@ -167,8 +167,11 @@ impl<'ast, 'psess, 'c> ModResolver<'ast, 'psess> { Ok(()) } - fn visit_cfg_match(&mut self, item: Cow<'ast, ast::Item>) -> Result<(), ModuleResolutionError> { - let mut visitor = visitor::CfgMatchVisitor::new(self.psess); + fn visit_cfg_select( + &mut self, + item: Cow<'ast, ast::Item>, + ) -> Result<(), ModuleResolutionError> { + let mut visitor = visitor::CfgSelectVisitor::new(self.psess); visitor.visit_item(&item); for module_item in visitor.mods() { if let ast::ItemKind::Mod(_, _, ref sub_mod_kind) = module_item.item.kind { @@ -197,8 +200,8 @@ impl<'ast, 'psess, 'c> ModResolver<'ast, 'psess> { continue; } - if is_cfg_match(&item) { - self.visit_cfg_match(Cow::Owned(*item))?; + if is_cfg_select(&item) { + self.visit_cfg_select(Cow::Owned(*item))?; continue; } @@ -228,8 +231,8 @@ impl<'ast, 'psess, 'c> ModResolver<'ast, 'psess> { self.visit_cfg_if(Cow::Borrowed(item))?; } - if is_cfg_match(item) { - self.visit_cfg_match(Cow::Borrowed(item))?; + if is_cfg_select(item) { + self.visit_cfg_select(Cow::Borrowed(item))?; } if let ast::ItemKind::Mod(_, _, ref sub_mod_kind) = item.kind { @@ -605,11 +608,11 @@ fn is_cfg_if(item: &ast::Item) -> bool { } } -fn is_cfg_match(item: &ast::Item) -> bool { +fn is_cfg_select(item: &ast::Item) -> bool { match item.kind { ast::ItemKind::MacCall(ref mac) => { if let Some(last_segment) = mac.path.segments.last() { - if last_segment.ident.name == Symbol::intern("cfg_match") { + if last_segment.ident.name == Symbol::intern("cfg_select") { return true; } } diff --git a/src/tools/rustfmt/src/modules/visitor.rs b/src/tools/rustfmt/src/modules/visitor.rs index d302a9ede6cb7..485f44a936bd8 100644 --- a/src/tools/rustfmt/src/modules/visitor.rs +++ b/src/tools/rustfmt/src/modules/visitor.rs @@ -5,7 +5,7 @@ use tracing::debug; use crate::attr::MetaVisitor; use crate::parse::macros::cfg_if::parse_cfg_if; -use crate::parse::macros::cfg_match::parse_cfg_match; +use crate::parse::macros::cfg_select::parse_cfg_select; use crate::parse::session::ParseSess; pub(crate) struct ModItem { @@ -72,15 +72,15 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> { } } -/// Traverse `cfg_match!` macro and fetch modules. -pub(crate) struct CfgMatchVisitor<'a> { +/// Traverse `cfg_select!` macro and fetch modules. +pub(crate) struct CfgSelectVisitor<'a> { psess: &'a ParseSess, mods: Vec, } -impl<'a> CfgMatchVisitor<'a> { - pub(crate) fn new(psess: &'a ParseSess) -> CfgMatchVisitor<'a> { - CfgMatchVisitor { +impl<'a> CfgSelectVisitor<'a> { + pub(crate) fn new(psess: &'a ParseSess) -> CfgSelectVisitor<'a> { + CfgSelectVisitor { mods: vec![], psess, } @@ -91,7 +91,7 @@ impl<'a> CfgMatchVisitor<'a> { } } -impl<'a, 'ast: 'a> Visitor<'ast> for CfgMatchVisitor<'a> { +impl<'a, 'ast: 'a> Visitor<'ast> for CfgSelectVisitor<'a> { fn visit_mac_call(&mut self, mac: &'ast ast::MacCall) { match self.visit_mac_inner(mac) { Ok(()) => (), @@ -100,30 +100,30 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CfgMatchVisitor<'a> { } } -impl<'a, 'ast: 'a> CfgMatchVisitor<'a> { +impl<'a, 'ast: 'a> CfgSelectVisitor<'a> { fn visit_mac_inner(&mut self, mac: &'ast ast::MacCall) -> Result<(), &'static str> { // Support both: // ``` - // std::cfg_match! {..} - // core::cfg_match! {..} + // std::cfg_select! {..} + // core::cfg_select! {..} // ``` // And: // ``` - // use std::cfg_match; - // cfg_match! {..} + // use std::cfg_select; + // cfg_select! {..} // ``` match mac.path.segments.last() { Some(last_segment) => { - if last_segment.ident.name != Symbol::intern("cfg_match") { - return Err("Expected cfg_match"); + if last_segment.ident.name != Symbol::intern("cfg_select") { + return Err("Expected cfg_select"); } } None => { - return Err("Expected cfg_match"); + return Err("Expected cfg_select"); } }; - let items = parse_cfg_match(self.psess, mac)?; + let items = parse_cfg_select(self.psess, mac)?; self.mods .append(&mut items.into_iter().map(|item| ModItem { item }).collect()); diff --git a/src/tools/rustfmt/src/parse/macros/cfg_match.rs b/src/tools/rustfmt/src/parse/macros/cfg_select.rs similarity index 84% rename from src/tools/rustfmt/src/parse/macros/cfg_match.rs rename to src/tools/rustfmt/src/parse/macros/cfg_select.rs index 476289b08b72a..040447ff1898f 100644 --- a/src/tools/rustfmt/src/parse/macros/cfg_match.rs +++ b/src/tools/rustfmt/src/parse/macros/cfg_select.rs @@ -8,18 +8,18 @@ use rustc_parse::parser::{AllowConstBlockItems, ForceCollect}; use crate::parse::macros::build_stream_parser; use crate::parse::session::ParseSess; -pub(crate) fn parse_cfg_match<'a>( +pub(crate) fn parse_cfg_select<'a>( psess: &'a ParseSess, mac: &'a ast::MacCall, ) -> Result, &'static str> { - match catch_unwind(AssertUnwindSafe(|| parse_cfg_match_inner(psess, mac))) { + match catch_unwind(AssertUnwindSafe(|| parse_cfg_select_inner(psess, mac))) { Ok(Ok(items)) => Ok(items), Ok(err @ Err(_)) => err, - Err(..) => Err("failed to parse cfg_match!"), + Err(..) => Err("failed to parse cfg_select!"), } } -fn parse_cfg_match_inner<'a>( +fn parse_cfg_select_inner<'a>( psess: &'a ParseSess, mac: &'a ast::MacCall, ) -> Result, &'static str> { @@ -27,7 +27,7 @@ fn parse_cfg_match_inner<'a>( let mut parser = build_stream_parser(psess.inner(), ts); if parser.token == TokenKind::OpenBrace { - return Err("Expression position cfg_match! not yet supported"); + return Err("Expression position cfg_select! not yet supported"); } let mut items = vec![]; @@ -58,7 +58,7 @@ fn parse_cfg_match_inner<'a>( err.cancel(); parser.psess.dcx().reset_err_count(); return Err( - "Expected item inside cfg_match block, but failed to parse it as an item", + "Expected item inside cfg_select block, but failed to parse it as an item", ); } }; diff --git a/src/tools/rustfmt/src/parse/macros/mod.rs b/src/tools/rustfmt/src/parse/macros/mod.rs index 00e0f6f58bd37..3d32821ce08b3 100644 --- a/src/tools/rustfmt/src/parse/macros/mod.rs +++ b/src/tools/rustfmt/src/parse/macros/mod.rs @@ -10,7 +10,7 @@ use crate::macros::MacroArg; use crate::rewrite::RewriteContext; pub(crate) mod cfg_if; -pub(crate) mod cfg_match; +pub(crate) mod cfg_select; pub(crate) mod lazy_static; fn build_stream_parser<'a>(psess: &'a ParseSess, tokens: TokenStream) -> Parser<'a> { diff --git a/src/tools/rustfmt/src/test/mod.rs b/src/tools/rustfmt/src/test/mod.rs index 4eded7c49eb50..ff5ed15fce743 100644 --- a/src/tools/rustfmt/src/test/mod.rs +++ b/src/tools/rustfmt/src/test/mod.rs @@ -42,8 +42,8 @@ const FILE_SKIP_LIST: &[&str] = &[ "issue-3253/foo.rs", "issue-3253/bar.rs", "issue-3253/paths", - // This directory is directly tested by format_files_find_new_files_via_cfg_match - "cfg_match", + // This directory is directly tested by format_files_find_new_files_via_cfg_select + "cfg_select", // These files and directory are a part of modules defined inside `cfg_attr(..)`. "cfg_mod/dir", "cfg_mod/bar.rs", @@ -471,15 +471,15 @@ fn format_files_find_new_files_via_cfg_if() { } #[test] -fn format_files_find_new_files_via_cfg_match() { +fn format_files_find_new_files_via_cfg_select() { init_log(); run_test_with(&TestSetting::default(), || { - // We load these two files into the same session to test cfg_match! + // We load these two files into the same session to test cfg_select! // transparent mod discovery, and to ensure that it does not suffer // from a similar issue as cfg_if! support did with issue-4656. let files = vec![ - Path::new("tests/source/cfg_match/lib2.rs"), - Path::new("tests/source/cfg_match/lib.rs"), + Path::new("tests/source/cfg_select/lib2.rs"), + Path::new("tests/source/cfg_select/lib.rs"), ]; let config = Config::default(); diff --git a/src/tools/rustfmt/tests/source/cfg_match/format_me_please_1.rs b/src/tools/rustfmt/tests/source/cfg_select/format_me_please_1.rs similarity index 100% rename from src/tools/rustfmt/tests/source/cfg_match/format_me_please_1.rs rename to src/tools/rustfmt/tests/source/cfg_select/format_me_please_1.rs diff --git a/src/tools/rustfmt/tests/source/cfg_match/format_me_please_2.rs b/src/tools/rustfmt/tests/source/cfg_select/format_me_please_2.rs similarity index 100% rename from src/tools/rustfmt/tests/source/cfg_match/format_me_please_2.rs rename to src/tools/rustfmt/tests/source/cfg_select/format_me_please_2.rs diff --git a/src/tools/rustfmt/tests/source/cfg_match/format_me_please_3.rs b/src/tools/rustfmt/tests/source/cfg_select/format_me_please_3.rs similarity index 100% rename from src/tools/rustfmt/tests/source/cfg_match/format_me_please_3.rs rename to src/tools/rustfmt/tests/source/cfg_select/format_me_please_3.rs diff --git a/src/tools/rustfmt/tests/source/cfg_match/format_me_please_4.rs b/src/tools/rustfmt/tests/source/cfg_select/format_me_please_4.rs similarity index 100% rename from src/tools/rustfmt/tests/source/cfg_match/format_me_please_4.rs rename to src/tools/rustfmt/tests/source/cfg_select/format_me_please_4.rs diff --git a/src/tools/rustfmt/tests/source/cfg_match/lib.rs b/src/tools/rustfmt/tests/source/cfg_select/lib.rs similarity index 71% rename from src/tools/rustfmt/tests/source/cfg_match/lib.rs rename to src/tools/rustfmt/tests/source/cfg_select/lib.rs index 2f0accac7d77a..62fb6dfbe9e38 100644 --- a/src/tools/rustfmt/tests/source/cfg_match/lib.rs +++ b/src/tools/rustfmt/tests/source/cfg_select/lib.rs @@ -1,13 +1,11 @@ -#![feature(cfg_match)] - -std::cfg_match! { +cfg_select! { test => { mod format_me_please_1; } target_family = "unix" => { mod format_me_please_2; } - cfg(target_pointer_width = "32") => { + target_pointer_width = "32" => { mod format_me_please_3; } _ => { diff --git a/src/tools/rustfmt/tests/source/cfg_match/lib2.rs b/src/tools/rustfmt/tests/source/cfg_select/lib2.rs similarity index 100% rename from src/tools/rustfmt/tests/source/cfg_match/lib2.rs rename to src/tools/rustfmt/tests/source/cfg_select/lib2.rs diff --git a/src/tools/rustfmt/tests/target/cfg_match/format_me_please_1.rs b/src/tools/rustfmt/tests/target/cfg_select/format_me_please_1.rs similarity index 100% rename from src/tools/rustfmt/tests/target/cfg_match/format_me_please_1.rs rename to src/tools/rustfmt/tests/target/cfg_select/format_me_please_1.rs diff --git a/src/tools/rustfmt/tests/target/cfg_match/format_me_please_2.rs b/src/tools/rustfmt/tests/target/cfg_select/format_me_please_2.rs similarity index 100% rename from src/tools/rustfmt/tests/target/cfg_match/format_me_please_2.rs rename to src/tools/rustfmt/tests/target/cfg_select/format_me_please_2.rs diff --git a/src/tools/rustfmt/tests/target/cfg_match/format_me_please_3.rs b/src/tools/rustfmt/tests/target/cfg_select/format_me_please_3.rs similarity index 100% rename from src/tools/rustfmt/tests/target/cfg_match/format_me_please_3.rs rename to src/tools/rustfmt/tests/target/cfg_select/format_me_please_3.rs diff --git a/src/tools/rustfmt/tests/target/cfg_match/format_me_please_4.rs b/src/tools/rustfmt/tests/target/cfg_select/format_me_please_4.rs similarity index 100% rename from src/tools/rustfmt/tests/target/cfg_match/format_me_please_4.rs rename to src/tools/rustfmt/tests/target/cfg_select/format_me_please_4.rs diff --git a/src/tools/rustfmt/tests/target/cfg_match/lib.rs b/src/tools/rustfmt/tests/target/cfg_select/lib.rs similarity index 71% rename from src/tools/rustfmt/tests/target/cfg_match/lib.rs rename to src/tools/rustfmt/tests/target/cfg_select/lib.rs index 2f0accac7d77a..62fb6dfbe9e38 100644 --- a/src/tools/rustfmt/tests/target/cfg_match/lib.rs +++ b/src/tools/rustfmt/tests/target/cfg_select/lib.rs @@ -1,13 +1,11 @@ -#![feature(cfg_match)] - -std::cfg_match! { +cfg_select! { test => { mod format_me_please_1; } target_family = "unix" => { mod format_me_please_2; } - cfg(target_pointer_width = "32") => { + target_pointer_width = "32" => { mod format_me_please_3; } _ => { diff --git a/src/tools/rustfmt/tests/target/cfg_match/lib2.rs b/src/tools/rustfmt/tests/target/cfg_select/lib2.rs similarity index 100% rename from src/tools/rustfmt/tests/target/cfg_match/lib2.rs rename to src/tools/rustfmt/tests/target/cfg_select/lib2.rs diff --git a/tests/codegen-llvm/loop-attrs/unroll-for-metadata.rs b/tests/codegen-llvm/loop-attrs/unroll-for-metadata.rs index 64113fbeb3247..60f9b6da6c9fe 100644 --- a/tests/codegen-llvm/loop-attrs/unroll-for-metadata.rs +++ b/tests/codegen-llvm/loop-attrs/unroll-for-metadata.rs @@ -15,7 +15,7 @@ unsafe extern "C" { pub fn unroll_hint() { // CHECK-LABEL: @unroll_hint // CHECK: !llvm.loop ![[HINT:[0-9]+]] - #[unroll] + #[rustc_unroll] for _ in 0..10 { unsafe { maybe_has_side_effect() } } @@ -25,7 +25,7 @@ pub fn unroll_hint() { pub fn unroll_full() { // CHECK-LABEL: @unroll_full // CHECK: !llvm.loop ![[FULL:[0-9]+]] - #[unroll(full)] + #[rustc_unroll(full)] for _ in 0..10 { unsafe { maybe_has_side_effect() } } @@ -35,7 +35,7 @@ pub fn unroll_full() { pub fn unroll_never() { // CHECK-LABEL: @unroll_never // CHECK: !llvm.loop ![[DISABLE:[0-9]+]] - #[unroll(never)] + #[rustc_unroll(never)] for _ in 0..10 { unsafe { maybe_has_side_effect() } } @@ -45,7 +45,7 @@ pub fn unroll_never() { pub fn unroll_count() { // CHECK-LABEL: @unroll_count // CHECK: !llvm.loop ![[COUNT:[0-9]+]] - #[unroll(5)] + #[rustc_unroll(5)] for _ in 0..10 { unsafe { maybe_has_side_effect() } } diff --git a/tests/codegen-llvm/loop-attrs/unroll-for-works.rs b/tests/codegen-llvm/loop-attrs/unroll-for-works.rs index b2f8b58c93573..0aa8d805c4f68 100644 --- a/tests/codegen-llvm/loop-attrs/unroll-for-works.rs +++ b/tests/codegen-llvm/loop-attrs/unroll-for-works.rs @@ -11,7 +11,7 @@ unsafe extern "C" { pub fn unroll_full() { // CHECK-LABEL: @unroll_full // CHECK-COUNT-512: tail call void @maybe_has_side_effect() - #[unroll(full)] + #[rustc_unroll(full)] for _ in 0..512 { unsafe { maybe_has_side_effect() } } @@ -22,7 +22,7 @@ pub fn unroll_never() { // CHECK-LABEL: @unroll_never // CHECK: tail call void @maybe_has_side_effect() // CHECK-NOT: tail call void @maybe_has_side_effect() - #[unroll(never)] + #[rustc_unroll(never)] for _ in 0..3 { unsafe { maybe_has_side_effect() } } @@ -32,7 +32,7 @@ pub fn unroll_never() { pub fn unroll_count() { // CHECK-LABEL: @unroll_count // CHECK-COUNT-5: tail call void @maybe_has_side_effect() - #[unroll(5)] + #[rustc_unroll(5)] for _ in 0..10 { unsafe { maybe_has_side_effect() } } diff --git a/tests/codegen-llvm/loop-attrs/unroll-loop-metadata.rs b/tests/codegen-llvm/loop-attrs/unroll-loop-metadata.rs index 2b2b0779cf49e..7b715d1ac1e32 100644 --- a/tests/codegen-llvm/loop-attrs/unroll-loop-metadata.rs +++ b/tests/codegen-llvm/loop-attrs/unroll-loop-metadata.rs @@ -17,7 +17,7 @@ pub fn unroll_hint() { // CHECK-LABEL: @unroll_hint // CHECK: !llvm.loop ![[HINT:[0-9]+]] let mut i = 0; - #[unroll] + #[rustc_unroll] loop { unsafe { maybe_has_side_effect() } i += 1; @@ -35,7 +35,7 @@ pub fn unroll_full() { // CHECK-LABEL: @unroll_full // CHECK: !llvm.loop ![[FULL:[0-9]+]] let mut i = 0; - let _return = (#[unroll(full)] + let _return = (#[rustc_unroll(full)] loop { unsafe { maybe_has_side_effect() } i += 1; @@ -50,7 +50,7 @@ pub fn unroll_never() { // CHECK-LABEL: @unroll_never // CHECK: !llvm.loop ![[DISABLE:[0-9]+]] let mut i = 0; - let _return = (1 + #[unroll(never)] + let _return = (1 + #[rustc_unroll(never)] loop { unsafe { maybe_has_side_effect() } i += 1; @@ -65,7 +65,7 @@ pub fn unroll_count() { // CHECK-LABEL: @unroll_count // CHECK: !llvm.loop ![[COUNT:[0-9]+]] let mut i = 0; - #[unroll(5)] + #[rustc_unroll(5)] loop { unsafe { maybe_has_side_effect() } i += 1; diff --git a/tests/codegen-llvm/loop-attrs/unroll-while-metadata.rs b/tests/codegen-llvm/loop-attrs/unroll-while-metadata.rs index c40a4188334e8..1a100aae1e717 100644 --- a/tests/codegen-llvm/loop-attrs/unroll-while-metadata.rs +++ b/tests/codegen-llvm/loop-attrs/unroll-while-metadata.rs @@ -16,7 +16,7 @@ pub fn unroll_hint() { // CHECK-LABEL: @unroll_hint // CHECK: !llvm.loop ![[HINT:[0-9]+]] let mut i = 0; - #[unroll] + #[rustc_unroll] while i < 10 { unsafe { maybe_has_side_effect() } i += 1; @@ -28,7 +28,7 @@ pub fn unroll_full() { // CHECK-LABEL: @unroll_full // CHECK: !llvm.loop ![[FULL:[0-9]+]] let mut i = 0; - #[unroll(full)] + #[rustc_unroll(full)] while i < 10 { unsafe { maybe_has_side_effect() } i += 1; @@ -40,7 +40,7 @@ pub fn unroll_never() { // CHECK-LABEL: @unroll_never // CHECK: !llvm.loop ![[DISABLE:[0-9]+]] let mut i = 0; - #[unroll(never)] + #[rustc_unroll(never)] while i < 10 { unsafe { maybe_has_side_effect() } i += 1; @@ -52,7 +52,7 @@ pub fn unroll_count() { // CHECK-LABEL: @unroll_count // CHECK: !llvm.loop ![[COUNT:[0-9]+]] let mut i = 0; - #[unroll(5)] + #[rustc_unroll(5)] while i < 10 { unsafe { maybe_has_side_effect() } i += 1; diff --git a/tests/ui/attributes/unroll/invalid-unroll.rs b/tests/ui/attributes/unroll/invalid-unroll.rs index 8696cefe818f7..13a14c2713fc1 100644 --- a/tests/ui/attributes/unroll/invalid-unroll.rs +++ b/tests/ui/attributes/unroll/invalid-unroll.rs @@ -2,18 +2,18 @@ #![crate_type = "lib"] pub fn main() { - #[unroll(please)] //~ ERROR malformed `unroll` attribute input + #[rustc_unroll(please)] //~ ERROR malformed `rustc_unroll` attribute input for _ in 0..10 {} - #[unroll("never")] //~ ERROR malformed `unroll` attribute input + #[rustc_unroll("never")] //~ ERROR malformed `rustc_unroll` attribute input for _ in 0..10 {} - #[unroll()] //~ ERROR malformed `unroll` attribute input + #[rustc_unroll()] //~ ERROR malformed `rustc_unroll` attribute input for _ in 0..10 {} - #[unroll(-1)] //~ ERROR expected a literal + #[rustc_unroll(-1)] //~ ERROR expected a literal for _ in 0..10 {} - #[unroll(1.5)] //~ ERROR malformed `unroll` attribute input + #[rustc_unroll(1.5)] //~ ERROR malformed `rustc_unroll` attribute input for _ in 0..10 {} } diff --git a/tests/ui/attributes/unroll/invalid-unroll.stderr b/tests/ui/attributes/unroll/invalid-unroll.stderr index 1980be101362d..6ea4015466b8f 100644 --- a/tests/ui/attributes/unroll/invalid-unroll.stderr +++ b/tests/ui/attributes/unroll/invalid-unroll.stderr @@ -1,46 +1,46 @@ -error[E0539]: malformed `unroll` attribute input +error[E0539]: malformed `rustc_unroll` attribute input --> $DIR/invalid-unroll.rs:5:5 | -LL | #[unroll(please)] - | ^^^^^^^^^------^^ - | | - | valid arguments are `full` or `never` +LL | #[rustc_unroll(please)] + | ^^^^^^^^^^^^^^^------^^ + | | + | valid arguments are `full` or `never` -error[E0539]: malformed `unroll` attribute input +error[E0539]: malformed `rustc_unroll` attribute input --> $DIR/invalid-unroll.rs:8:5 | -LL | #[unroll("never")] - | ^^^^^^^^^-------^^ - | | - | valid arguments are `full` or `never` +LL | #[rustc_unroll("never")] + | ^^^^^^^^^^^^^^^-------^^ + | | + | valid arguments are `full` or `never` -error[E0805]: malformed `unroll` attribute input +error[E0805]: malformed `rustc_unroll` attribute input --> $DIR/invalid-unroll.rs:11:5 | -LL | #[unroll()] - | ^^^^^^^^--^ - | | - | expected an argument here +LL | #[rustc_unroll()] + | ^^^^^^^^^^^^^^--^ + | | + | expected an argument here error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found expression - --> $DIR/invalid-unroll.rs:14:14 + --> $DIR/invalid-unroll.rs:14:20 | -LL | #[unroll(-1)] - | ^^ expressions are not allowed here +LL | #[rustc_unroll(-1)] + | ^^ expressions are not allowed here | help: negative numbers are not literals, try removing the `-` sign | -LL - #[unroll(-1)] -LL + #[unroll(1)] +LL - #[rustc_unroll(-1)] +LL + #[rustc_unroll(1)] | -error[E0539]: malformed `unroll` attribute input +error[E0539]: malformed `rustc_unroll` attribute input --> $DIR/invalid-unroll.rs:17:5 | -LL | #[unroll(1.5)] - | ^^^^^^^^^---^^ - | | - | valid arguments are `full` or `never` +LL | #[rustc_unroll(1.5)] + | ^^^^^^^^^^^^^^^---^^ + | | + | valid arguments are `full` or `never` error: aborting due to 5 previous errors diff --git a/tests/ui/feature-gates/feature-gate-loop-hints.rs b/tests/ui/feature-gates/feature-gate-loop-hints.rs index afb8b7d74af9d..76538472c9c0c 100644 --- a/tests/ui/feature-gates/feature-gate-loop-hints.rs +++ b/tests/ui/feature-gates/feature-gate-loop-hints.rs @@ -1,4 +1,4 @@ fn main() { - #[unroll] //~ ERROR the `#[unroll]` attribute is an experimental feature + #[rustc_unroll] //~ ERROR the `#[rustc_unroll]` attribute is an experimental feature for _ in 0..10 {} } diff --git a/tests/ui/feature-gates/feature-gate-loop-hints.stderr b/tests/ui/feature-gates/feature-gate-loop-hints.stderr index df18fbafdd50c..6d65e7f070235 100644 --- a/tests/ui/feature-gates/feature-gate-loop-hints.stderr +++ b/tests/ui/feature-gates/feature-gate-loop-hints.stderr @@ -1,8 +1,8 @@ -error[E0658]: the `#[unroll]` attribute is an experimental feature +error[E0658]: the `#[rustc_unroll]` attribute is an experimental feature --> $DIR/feature-gate-loop-hints.rs:2:5 | -LL | #[unroll] - | ^^^^^^^^^ +LL | #[rustc_unroll] + | ^^^^^^^^^^^^^^^ | = note: see issue #156874 for more information = help: add `#![feature(loop_hints)]` to the crate attributes to enable diff --git a/tests/ui/feature-gates/feature-gate-rustc-attrs.stderr b/tests/ui/feature-gates/feature-gate-rustc-attrs.stderr index bc0db8b81aefc..505aefc76522f 100644 --- a/tests/ui/feature-gates/feature-gate-rustc-attrs.stderr +++ b/tests/ui/feature-gates/feature-gate-rustc-attrs.stderr @@ -33,6 +33,12 @@ error: cannot find attribute `rustc_unknown` in this scope | LL | #[rustc_unknown] | ^^^^^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[rustc_unknown] +LL + #[rustc_unroll] + | error[E0658]: use of an internal attribute --> $DIR/feature-gate-rustc-attrs.rs:20:1 diff --git a/tests/ui/feature-gates/feature-gate-splat.rs b/tests/ui/feature-gates/feature-gate-splat.rs index ebcfc0e5a1d9f..88330d178b0cd 100644 --- a/tests/ui/feature-gates/feature-gate-splat.rs +++ b/tests/ui/feature-gates/feature-gate-splat.rs @@ -1,6 +1,6 @@ #[rustfmt::skip] fn tuple_args( - #[splat] //~ ERROR the `#[splat]` attribute is an experimental feature + #[rustc_splat] //~ ERROR the `#[rustc_splat]` attribute is an experimental feature (a, b, c): (u32, i8, char), ) { } diff --git a/tests/ui/feature-gates/feature-gate-splat.stderr b/tests/ui/feature-gates/feature-gate-splat.stderr index 11ddc2a3b82e7..8a1f87575484f 100644 --- a/tests/ui/feature-gates/feature-gate-splat.stderr +++ b/tests/ui/feature-gates/feature-gate-splat.stderr @@ -1,13 +1,13 @@ -error[E0658]: the `#[splat]` attribute is an experimental feature +error[E0658]: the `#[rustc_splat]` attribute is an experimental feature --> $DIR/feature-gate-splat.rs:3:5 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | = 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 `#[splat]` attribute is experimental + = note: the `#[rustc_splat]` attribute is experimental error: aborting due to 1 previous error diff --git a/tests/ui/splat/run-splat.rs b/tests/ui/splat/run-splat.rs index 06360883d5a43..f821d30d2d4ee 100644 --- a/tests/ui/splat/run-splat.rs +++ b/tests/ui/splat/run-splat.rs @@ -13,7 +13,7 @@ trait MethodArgs: Tuple { } impl Foo { - fn method(&self, #[splat] args: impl MethodArgs) { + fn method(&self, #[rustc_splat] args: impl MethodArgs) { args.call_method(self) } } diff --git a/tests/ui/splat/splat-255-limit-fail.rs b/tests/ui/splat/splat-255-limit-fail.rs index 31767f11d999b..881a0da912aaa 100644 --- a/tests/ui/splat/splat-255-limit-fail.rs +++ b/tests/ui/splat/splat-255-limit-fail.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -//! Test `#[splat]` fails over the 255th argument index (or higher). +//! Test `#[rustc_splat]` fails over the 255th argument index (or higher). //! FIXME(splat): The 255 argument limit is a temporary performance hack. #![allow(incomplete_features)] @@ -47,7 +47,7 @@ fn s_255_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), //~ ERROR `#[splat]` is not supported on argument index 255 + #[rustc_splat] (_a, _b): (u32, i8), //~ ERROR `#[rustc_splat]` is not supported on argument index 255 ) {} #[rustfmt::skip] @@ -68,7 +68,7 @@ fn s_256_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), //~ ERROR `#[splat]` is not supported on argument index 256 + #[rustc_splat] (_a, _b): (u32, i8), //~ ERROR `#[rustc_splat]` is not supported on argument index 256 ) {} #[rustfmt::skip] @@ -88,7 +88,7 @@ fn s_255_non_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), //~ ERROR `#[splat]` is not supported on argument index 255 + #[rustc_splat] (_a, _b): (u32, i8), //~ ERROR `#[rustc_splat]` is not supported on argument index 255 _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, ) {} @@ -110,12 +110,12 @@ fn s_256_non_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), //~ ERROR `#[splat]` is not supported on argument index 256 + #[rustc_splat] (_a, _b): (u32, i8), //~ ERROR `#[rustc_splat]` is not supported on argument index 256 _: A, ) {} // It's only the splatted index that's constrained to 255, not the argument count of the caller or callee. -fn more_than_255_splatted_args(#[splat] _t: Tuple256) {} +fn more_than_255_splatted_args(#[rustc_splat] _t: Tuple256) {} fn main() { let a = (); diff --git a/tests/ui/splat/splat-255-limit-fail.stderr b/tests/ui/splat/splat-255-limit-fail.stderr index da62da8aa605b..dc7e4fe30242b 100644 --- a/tests/ui/splat/splat-255-limit-fail.stderr +++ b/tests/ui/splat/splat-255-limit-fail.stderr @@ -1,34 +1,34 @@ -error: `#[splat]` is not supported on argument index 255 +error: `#[rustc_splat]` is not supported on argument index 255 --> $DIR/splat-255-limit-fail.rs:50:5 | -LL | #[splat] (_a, _b): (u32, i8), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[splat]` is not supported here +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[rustc_splat]` is not supported here | - = help: remove `#[splat]`, or use it on an argument closer to the start of the argument list + = help: remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list -error: `#[splat]` is not supported on argument index 256 +error: `#[rustc_splat]` is not supported on argument index 256 --> $DIR/splat-255-limit-fail.rs:71:5 | -LL | #[splat] (_a, _b): (u32, i8), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[splat]` is not supported here +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[rustc_splat]` is not supported here | - = help: remove `#[splat]`, or use it on an argument closer to the start of the argument list + = help: remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list -error: `#[splat]` is not supported on argument index 255 +error: `#[rustc_splat]` is not supported on argument index 255 --> $DIR/splat-255-limit-fail.rs:91:5 | -LL | #[splat] (_a, _b): (u32, i8), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[splat]` is not supported here +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[rustc_splat]` is not supported here | - = help: remove `#[splat]`, or use it on an argument closer to the start of the argument list + = help: remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list -error: `#[splat]` is not supported on argument index 256 +error: `#[rustc_splat]` is not supported on argument index 256 --> $DIR/splat-255-limit-fail.rs:113:5 | -LL | #[splat] (_a, _b): (u32, i8), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[splat]` is not supported here +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[rustc_splat]` is not supported here | - = help: remove `#[splat]`, or use it on an argument closer to the start of the argument list + = help: remove `#[rustc_splat]`, or use it on an argument closer to the start of the argument list error[E0057]: this splatted function takes 256 arguments, but 255 were provided --> $DIR/splat-255-limit-fail.rs:124:5 diff --git a/tests/ui/splat/splat-255-limit-pass.rs b/tests/ui/splat/splat-255-limit-pass.rs index 9713616830f9b..82920a5edd238 100644 --- a/tests/ui/splat/splat-255-limit-pass.rs +++ b/tests/ui/splat/splat-255-limit-pass.rs @@ -1,6 +1,6 @@ //@ run-pass // ignore-tidy-linelength -//! Test `#[splat]` on the 255th argument index (or lower). +//! Test `#[rustc_splat]` on the 255th argument index (or lower). //! FIXME(splat): The 255 argument limit is a temporary performance hack. #![allow(incomplete_features)] @@ -48,7 +48,7 @@ fn s_253_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), ) {} #[rustfmt::skip] @@ -68,7 +68,7 @@ fn s_254_terminal( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), ) {} #[rustfmt::skip] @@ -88,13 +88,13 @@ fn s_254_non_terminal_272_args( _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, ) {} #[rustfmt::skip] fn s_0_initial_253_args( - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, @@ -114,7 +114,7 @@ fn s_0_initial_253_args( #[rustfmt::skip] fn s_0_initial_254_args( - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, @@ -134,7 +134,7 @@ fn s_0_initial_254_args( #[rustfmt::skip] fn s_0_initial_255_args( - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, @@ -155,7 +155,7 @@ fn s_0_initial_255_args( // It's only the splatted index that's constrained to 255, not the argument count of the caller or callee. #[rustfmt::skip] fn s_0_initial_256_args( - #[splat] (_a, _b): (u32, i8), + #[rustc_splat] (_a, _b): (u32, i8), _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, _: A, @@ -174,7 +174,7 @@ fn s_0_initial_256_args( _: A, ) {} -fn more_than_255_splatted_args(#[splat] _t: Tuple256) {} +fn more_than_255_splatted_args(#[rustc_splat] _t: Tuple256) {} fn main() { let a = (); diff --git a/tests/ui/splat/splat-assoc-fn-tuple-simple.rs b/tests/ui/splat/splat-assoc-fn-tuple-simple.rs index d2681c0d2574c..7551c34e0541d 100644 --- a/tests/ui/splat/splat-assoc-fn-tuple-simple.rs +++ b/tests/ui/splat/splat-assoc-fn-tuple-simple.rs @@ -1,5 +1,5 @@ //@ run-pass -//! Test using `#[splat]` on associated function tuple arguments (no receivers). +//! Test using `#[rustc_splat]` on associated function tuple arguments (no receivers). #![allow(incomplete_features)] #![feature(splat)] @@ -7,9 +7,9 @@ struct Foo; impl Foo { - fn tuple_1(#[splat] (_a,): (u32,)) {} + fn tuple_1(#[rustc_splat] (_a,): (u32,)) {} - fn tuple_3(#[splat] (_a, _b, _c): (u32, i32, i8)) {} + fn tuple_3(#[rustc_splat] (_a, _b, _c): (u32, i32, i8)) {} } fn main() { diff --git a/tests/ui/splat/splat-async-fn-tuple-fail.rs b/tests/ui/splat/splat-async-fn-tuple-fail.rs index a1f67dfe606d6..dee97d1e618b2 100644 --- a/tests/ui/splat/splat-async-fn-tuple-fail.rs +++ b/tests/ui/splat/splat-async-fn-tuple-fail.rs @@ -1,14 +1,17 @@ //@ edition:2024 -//! Test that using `#[splat]` incorrectly on async functions gives errors. +//! Test that using `#[rustc_splat]` incorrectly on async functions gives errors. #![allow(incomplete_features)] #![feature(splat)] -async fn async_wrong_type(#[splat] _x: u32) {} +async fn async_wrong_type(#[rustc_splat] _x: u32) {} //~^ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 -async fn async_multi_splat(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} -//~^ ERROR multiple `#[splat]`s are not allowed in the same function +async fn async_multi_splat( + #[rustc_splat] (_a, _b): (u32, i8), + //~^ ERROR multiple `#[rustc_splat]`s are not allowed in the same function + #[rustc_splat] (_c, _d): (u32, i8), +) {} fn main() { async_wrong_type(1u32); diff --git a/tests/ui/splat/splat-async-fn-tuple-fail.stderr b/tests/ui/splat/splat-async-fn-tuple-fail.stderr index e643b29c88c8a..eaad2daf57f78 100644 --- a/tests/ui/splat/splat-async-fn-tuple-fail.stderr +++ b/tests/ui/splat/splat-async-fn-tuple-fail.stderr @@ -1,22 +1,25 @@ -error: multiple `#[splat]`s are not allowed in the same function - --> $DIR/splat-async-fn-tuple-fail.rs:10:28 +error: multiple `#[rustc_splat]`s are not allowed in the same function + --> $DIR/splat-async-fn-tuple-fail.rs:11:5 | -LL | async fn async_multi_splat(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | #[rustc_splat] (_c, _d): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: remove `#[splat]` from all but one argument + = help: remove `#[rustc_splat]` from all but one argument error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32) - --> $DIR/splat-async-fn-tuple-fail.rs:7:40 + --> $DIR/splat-async-fn-tuple-fail.rs:7:46 | -LL | async fn async_wrong_type(#[splat] _x: u32) {} - | ^^^ +LL | async fn async_wrong_type(#[rustc_splat] _x: u32) {} + | ^^^ ... LL | async_wrong_type(1u32); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0057]: this splatted function takes 3 arguments, but 4 were provided - --> $DIR/splat-async-fn-tuple-fail.rs:15:5 + --> $DIR/splat-async-fn-tuple-fail.rs:18:5 | LL | async_multi_splat(1u32, 2i8, 3u32, 4i8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-async-fn-tuple.rs b/tests/ui/splat/splat-async-fn-tuple.rs index 81e56193bd4ab..9e7de07ec0752 100644 --- a/tests/ui/splat/splat-async-fn-tuple.rs +++ b/tests/ui/splat/splat-async-fn-tuple.rs @@ -1,13 +1,13 @@ //@ run-pass //@ edition:2024 -//! Test using `#[splat]` on tuple arguments of async functions. +//! Test using `#[rustc_splat]` on tuple arguments of async functions. #![allow(incomplete_features)] #![feature(splat)] -async fn async_tuple_args(#[splat] (_a, _b): (u32, i8)) {} +async fn async_tuple_args(#[rustc_splat] (_a, _b): (u32, i8)) {} -async fn async_splat_non_terminal_arg(#[splat] (_a, _b): (u32, i8), _c: f64) {} +async fn async_splat_non_terminal_arg(#[rustc_splat] (_a, _b): (u32, i8), _c: f64) {} fn main() { let _ = async_tuple_args(1u32, 2i8); diff --git a/tests/ui/splat/splat-cannot-resolve.rs b/tests/ui/splat/splat-cannot-resolve.rs index 1c22a53f82916..10d5e0e54ba66 100644 --- a/tests/ui/splat/splat-cannot-resolve.rs +++ b/tests/ui/splat/splat-cannot-resolve.rs @@ -1,16 +1,16 @@ -//! Test that using `#[splat]` on un-resolvable types is an error. +//! Test that using `#[rustc_splat]` on un-resolvable types is an error. #![allow(incomplete_features)] #![allow(unconditional_recursion)] #![feature(splat)] #![feature(tuple_trait)] -fn tuple(#[splat] t: impl Sized) -> impl Sized { +fn tuple(#[rustc_splat] t: impl Sized) -> impl Sized { //~^ ERROR cannot resolve opaque type tuple(tuple((t, ()))) } -fn tuple_trait(#[splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple { +fn tuple_trait(#[rustc_splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple { //~^ ERROR cannot resolve opaque type tuple_trait(tuple_trait((t, ()))) } @@ -20,12 +20,12 @@ trait Trait { type Tup: std::marker::Tuple; } -fn ambig(#[splat] t: Trait::MaybeTup) {} +fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} //~^ ERROR ambiguous associated type //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a -fn ambig_tup(#[splat] t: Trait::Tup) {} +fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} //~^ ERROR ambiguous associated type //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a diff --git a/tests/ui/splat/splat-cannot-resolve.stderr b/tests/ui/splat/splat-cannot-resolve.stderr index f91267d37dbc8..c3e6c057c4fac 100644 --- a/tests/ui/splat/splat-cannot-resolve.stderr +++ b/tests/ui/splat/splat-cannot-resolve.stderr @@ -1,89 +1,89 @@ error[E0223]: ambiguous associated type - --> $DIR/splat-cannot-resolve.rs:23:22 + --> $DIR/splat-cannot-resolve.rs:23:28 | -LL | fn ambig(#[splat] t: Trait::MaybeTup) {} - | ^^^^^^^^^^^^^^^ +LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} + | ^^^^^^^^^^^^^^^ | help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path | -LL - fn ambig(#[splat] t: Trait::MaybeTup) {} -LL + fn ambig(#[splat] t: ::MaybeTup) {} +LL - fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} +LL + fn ambig(#[rustc_splat] t: ::MaybeTup) {} | error[E0223]: ambiguous associated type - --> $DIR/splat-cannot-resolve.rs:28:26 + --> $DIR/splat-cannot-resolve.rs:28:32 | -LL | fn ambig_tup(#[splat] t: Trait::Tup) {} - | ^^^^^^^^^^ +LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} + | ^^^^^^^^^^ | help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path | -LL - fn ambig_tup(#[splat] t: Trait::Tup) {} -LL + fn ambig_tup(#[splat] t: ::Tup) {} +LL - fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} +LL + fn ambig_tup(#[rustc_splat] t: ::Tup) {} | error[E0720]: cannot resolve opaque type - --> $DIR/splat-cannot-resolve.rs:8:37 + --> $DIR/splat-cannot-resolve.rs:8:43 | -LL | fn tuple(#[splat] t: impl Sized) -> impl Sized { - | ^^^^^^^^^^ +LL | fn tuple(#[rustc_splat] t: impl Sized) -> impl Sized { + | ^^^^^^^^^^ error[E0720]: cannot resolve opaque type - --> $DIR/splat-cannot-resolve.rs:13:56 + --> $DIR/splat-cannot-resolve.rs:13:62 | -LL | fn tuple_trait(#[splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn tuple_trait(#[rustc_splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:23:22 + --> $DIR/splat-cannot-resolve.rs:23:28 | -LL | fn ambig(#[splat] t: Trait::MaybeTup) {} - | ^^^^^^^^^^^^^^^ +LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} + | ^^^^^^^^^^^^^^^ ... LL | ambig(); | ^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:28:26 + --> $DIR/splat-cannot-resolve.rs:28:32 | -LL | fn ambig_tup(#[splat] t: Trait::Tup) {} - | ^^^^^^^^^^ +LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} + | ^^^^^^^^^^ ... LL | ambig_tup(); | ^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:23:22 + --> $DIR/splat-cannot-resolve.rs:23:28 | -LL | fn ambig(#[splat] t: Trait::MaybeTup) {} - | ^^^^^^^^^^^^^^^ +LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} + | ^^^^^^^^^^^^^^^ ... LL | ambig(1); | ^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:28:26 + --> $DIR/splat-cannot-resolve.rs:28:32 | -LL | fn ambig_tup(#[splat] t: Trait::Tup) {} - | ^^^^^^^^^^ +LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} + | ^^^^^^^^^^ ... LL | ambig_tup(1); | ^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:23:22 + --> $DIR/splat-cannot-resolve.rs:23:28 | -LL | fn ambig(#[splat] t: Trait::MaybeTup) {} - | ^^^^^^^^^^^^^^^ +LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {} + | ^^^^^^^^^^^^^^^ ... LL | ambig(1, 2.0); | ^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) - --> $DIR/splat-cannot-resolve.rs:28:26 + --> $DIR/splat-cannot-resolve.rs:28:32 | -LL | fn ambig_tup(#[splat] t: Trait::Tup) {} - | ^^^^^^^^^^ +LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} + | ^^^^^^^^^^ ... LL | ambig_tup(1, 2.0); | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-const-fn-tuple-generic.rs b/tests/ui/splat/splat-const-fn-tuple-generic.rs index 646bf7e9b9f19..ad4fa57bd09b8 100644 --- a/tests/ui/splat/splat-const-fn-tuple-generic.rs +++ b/tests/ui/splat/splat-const-fn-tuple-generic.rs @@ -1,20 +1,20 @@ //@ run-pass -//! Test using `#[splat]` on tuple arguments of const functions with generics. +//! Test using `#[rustc_splat]` on tuple arguments of const functions with generics. #![allow(incomplete_features)] #![feature(splat)] // Generic type in first position -const fn const_generic_first(#[splat] _: (T, u32)) {} +const fn const_generic_first(#[rustc_splat] _: (T, u32)) {} // Generic type in second position -const fn const_generic_second(#[splat] _: (u32, T)) {} +const fn const_generic_second(#[rustc_splat] _: (u32, T)) {} // Multiple generic types -const fn const_generic_both(#[splat] _: (T, U)) {} +const fn const_generic_both(#[rustc_splat] _: (T, U)) {} // Generic with extra non-splatted arg -const fn const_generic_extra(#[splat] _: (T, u32), _extra: i32) {} +const fn const_generic_extra(#[rustc_splat] _: (T, u32), _extra: i32) {} fn main() { const_generic_first(1i8, 2u32); diff --git a/tests/ui/splat/splat-const-fn-tuple.rs b/tests/ui/splat/splat-const-fn-tuple.rs index f4ae2e124a72d..63d0e7d8dc412 100644 --- a/tests/ui/splat/splat-const-fn-tuple.rs +++ b/tests/ui/splat/splat-const-fn-tuple.rs @@ -1,10 +1,10 @@ //@ run-pass -//! Test using `#[splat]` on tuple arguments of const functions. +//! Test using `#[rustc_splat]` on tuple arguments of const functions. #![allow(incomplete_features)] #![feature(splat)] -const fn sum(#[splat] (a, b): (u32, u32)) -> u32 { +const fn sum(#[rustc_splat] (a, b): (u32, u32)) -> u32 { a + b } diff --git a/tests/ui/splat/splat-dyn-asref-tuple-fail.rs b/tests/ui/splat/splat-dyn-asref-tuple-fail.rs index d9b3b0351281c..30fa2aa6501ff 100644 --- a/tests/ui/splat/splat-dyn-asref-tuple-fail.rs +++ b/tests/ui/splat/splat-dyn-asref-tuple-fail.rs @@ -1,4 +1,4 @@ -//! Test that `#[splat]` on `&dyn AsRef` where `T: Tuple` is an error. +//! Test that `#[rustc_splat]` on `&dyn AsRef` where `T: Tuple` is an error. #![allow(incomplete_features)] #![feature(splat)] @@ -9,7 +9,7 @@ // FIXME(splat): Some errors are reported on the callee, but they would be more ergonomic on the // caller as well -fn dyn_asref_splat(#[splat] _t: &dyn AsRef) +fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) //~^ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a //~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a diff --git a/tests/ui/splat/splat-dyn-asref-tuple-fail.stderr b/tests/ui/splat/splat-dyn-asref-tuple-fail.stderr index e9388eee63de0..0c67c80db0ca7 100644 --- a/tests/ui/splat/splat-dyn-asref-tuple-fail.stderr +++ b/tests/ui/splat/splat-dyn-asref-tuple-fail.stderr @@ -1,8 +1,8 @@ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef) - --> $DIR/splat-dyn-asref-tuple-fail.rs:12:36 + --> $DIR/splat-dyn-asref-tuple-fail.rs:12:42 | -LL | fn dyn_asref_splat(#[splat] _t: &dyn AsRef) - | ^^^^^^^^^^^^^ +LL | fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) + | ^^^^^^^^^^^^^ ... LL | dyn_asref_splat::(&s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,35 +16,35 @@ LL | dyn_asref_splat::(&s); note: required by a bound in `dyn_asref_splat` --> $DIR/splat-dyn-asref-tuple-fail.rs:18:8 | -LL | fn dyn_asref_splat(#[splat] _t: &dyn AsRef) +LL | fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) | --------------- required by a bound in this function ... LL | T: std::marker::Tuple, | ^^^^^^^^^^^^^^^^^^ required by this bound in `dyn_asref_splat` error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>) - --> $DIR/splat-dyn-asref-tuple-fail.rs:12:36 + --> $DIR/splat-dyn-asref-tuple-fail.rs:12:42 | -LL | fn dyn_asref_splat(#[splat] _t: &dyn AsRef) - | ^^^^^^^^^^^^^ +LL | fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) + | ^^^^^^^^^^^^^ ... LL | dyn_asref_splat(&s); | ^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<(u8, f32)>) - --> $DIR/splat-dyn-asref-tuple-fail.rs:12:36 + --> $DIR/splat-dyn-asref-tuple-fail.rs:12:42 | -LL | fn dyn_asref_splat(#[splat] _t: &dyn AsRef) - | ^^^^^^^^^^^^^ +LL | fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) + | ^^^^^^^^^^^^^ ... LL | dyn_asref_splat::<(u8, f32)>(&t); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>) - --> $DIR/splat-dyn-asref-tuple-fail.rs:12:36 + --> $DIR/splat-dyn-asref-tuple-fail.rs:12:42 | -LL | fn dyn_asref_splat(#[splat] _t: &dyn AsRef) - | ^^^^^^^^^^^^^ +LL | fn dyn_asref_splat(#[rustc_splat] _t: &dyn AsRef) + | ^^^^^^^^^^^^^ ... LL | dyn_asref_splat(&t); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-fn-ptr-cast-fail.rs b/tests/ui/splat/splat-fn-ptr-cast-fail.rs index 1cd1bdacf582c..c764abcdbbcee 100644 --- a/tests/ui/splat/splat-fn-ptr-cast-fail.rs +++ b/tests/ui/splat/splat-fn-ptr-cast-fail.rs @@ -5,11 +5,11 @@ use std::marker::Tuple; -fn tuple_args(#[splat] (_a, _b): (u32, i8)) {} +fn tuple_args(#[rustc_splat] (_a, _b): (u32, i8)) {} -fn splat_non_terminal_arg(#[splat] (_a, _b): (u32, i8), _c: f64) {} +fn splat_non_terminal_arg(#[rustc_splat] (_a, _b): (u32, i8), _c: f64) {} -fn f(#[splat] args: Args) {} +fn f(#[rustc_splat] args: Args) {} fn main() { // Function pointers diff --git a/tests/ui/splat/splat-fn-ptr-cast-fail.stderr b/tests/ui/splat/splat-fn-ptr-cast-fail.stderr index 93d7c8493048d..d620f3dbcfe8d 100644 --- a/tests/ui/splat/splat-fn-ptr-cast-fail.stderr +++ b/tests/ui/splat/splat-fn-ptr-cast-fail.stderr @@ -7,7 +7,7 @@ LL | let _fn_ptr: fn((u32, i8)) = tuple_args; | expected due to this | = note: expected fn pointer `fn((_, _))` - found fn item `fn(#[splat] (_, _)) {tuple_args}` + found fn item `fn(#[rustc_splat] (_, _)) {tuple_args}` error[E0308]: mismatched types --> $DIR/splat-fn-ptr-cast-fail.rs:17:39 @@ -18,15 +18,15 @@ LL | let _fn_ptr: fn((u32, i8), f64) = splat_non_terminal_arg; | expected due to this | = note: expected fn pointer `fn((_, _), _)` - found fn item `fn(#[splat] (_, _), _) {splat_non_terminal_arg}` + found fn item `fn(#[rustc_splat] (_, _), _) {splat_non_terminal_arg}` -error[E0605]: non-primitive cast: `fn(, #[splat](u32, i8)) {tuple_args}` as `fn((u32, i8))` +error[E0605]: non-primitive cast: `fn(, #[rustc_splat](u32, i8)) {tuple_args}` as `fn((u32, i8))` --> $DIR/splat-fn-ptr-cast-fail.rs:19:34 | LL | let _fn_ptr: fn((u32, i8)) = tuple_args as fn((u32, i8)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast -error[E0605]: non-primitive cast: `fn(, #[splat](u32, i8), f64) {splat_non_terminal_arg}` as `fn((u32, i8), f64)` +error[E0605]: non-primitive cast: `fn(, #[rustc_splat](u32, i8), f64) {splat_non_terminal_arg}` as `fn((u32, i8), f64)` --> $DIR/splat-fn-ptr-cast-fail.rs:20:39 | LL | let _fn_ptr: fn((u32, i8), f64) = splat_non_terminal_arg as fn((u32, i8), f64); @@ -41,7 +41,7 @@ LL | const _F2: fn((u8, u32)) = f::<(u8, u32)>; | expected because of the type of the constant | = note: expected fn pointer `fn((_, _))` - found fn item `fn(#[splat] (_, _)) {f::<(u8, u32)>}` + found fn item `fn(#[rustc_splat] (_, _)) {f::<(u8, u32)>}` error[E0308]: mismatched types --> $DIR/splat-fn-ptr-cast-fail.rs:24:35 @@ -52,7 +52,7 @@ LL | const _F1: fn(((u8, u32),)) = f::<((u8, u32),)>; | expected because of the type of the constant | = note: expected fn pointer `fn(((_, _),))` - found fn item `fn(#[splat] ((_, _),)) {f::<((u8, u32),)>}` + found fn item `fn(#[rustc_splat] ((_, _),)) {f::<((u8, u32),)>}` error: aborting due to 6 previous errors diff --git a/tests/ui/splat/splat-fn-ptr-tuple.rs b/tests/ui/splat/splat-fn-ptr-tuple.rs index 297dbc0457794..e87318acabf9e 100644 --- a/tests/ui/splat/splat-fn-ptr-tuple.rs +++ b/tests/ui/splat/splat-fn-ptr-tuple.rs @@ -10,15 +10,15 @@ //@ normalize-stderr: ".*note: Some details are omitted.*\n" -> "" //@ normalize-stderr: ".*--> .*/splat-fn-ptr-tuple.rs:\d{1,}:\d{1,}.*\n" -> "" -//! Test using `#[splat]` on tuple arguments of simple functions. +//! Test using `#[rustc_splat]` on tuple arguments of simple functions. //! Currently ICEs, but if we fix it, we'll want to know and update this test to pass. #![allow(incomplete_features)] #![feature(splat)] -fn tuple_args(#[splat] (_a, _b): (u32, i8)) {} +fn tuple_args(#[rustc_splat] (_a, _b): (u32, i8)) {} -fn splat_non_terminal_arg(#[splat] (_a, _b): (u32, i8), _c: f64) {} +fn splat_non_terminal_arg(#[rustc_splat] (_a, _b): (u32, i8), _c: f64) {} fn main() { // FIXME(splat): not currently supported, can be supported when we no longer require a DefId in @@ -26,7 +26,7 @@ fn main() { // FIXME(rustfmt): the attribute gets deleted by rustfmt // Functions #[rustfmt::skip] - let fn_ptr: fn(#[splat] (u32, i8)) = tuple_args; + let fn_ptr: fn(#[rustc_splat] (u32, i8)) = tuple_args; fn_ptr(1, 2); //~ ERROR no splatted def for function or method callee fn_ptr(1u32, 2i8); @@ -35,19 +35,20 @@ fn main() { //fn_ptr((1, 2)); // ERROR this splatted function takes 2 arguments, but 1 was provided #[rustfmt::skip] - let fn_ptr: fn(#[splat] (u32, i8), f64) = splat_non_terminal_arg; + let fn_ptr: fn(#[rustc_splat] (u32, i8), f64) = splat_non_terminal_arg; fn_ptr(1, 2, 3.5); fn_ptr(1u32, 2i8, 3.5f64); // Function pointers #[rustfmt::skip] - let fn_ptr: *const fn(#[splat] (u32, i8)) = tuple_args as *const fn(#[splat] (u32, i8)); + let fn_ptr: *const fn(#[rustc_splat] (u32, i8)) = + tuple_args as *const fn(#[rustc_splat] (u32, i8)); (*fn_ptr)(1, 2); (*fn_ptr)(1u32, 2i8); #[rustfmt::skip] - let fn_ptr: *const fn(#[splat] (u32, i8), f64) = - splat_non_terminal_arg as *const fn(#[splat] (u32, i8), f64); + let fn_ptr: *const fn(#[rustc_splat] (u32, i8), f64) = + splat_non_terminal_arg as *const fn(#[rustc_splat] (u32, i8), f64); (*fn_ptr)(1, 2, 3.5); (*fn_ptr)(1u32, 2i8, 3.5f64); } diff --git a/tests/ui/splat/splat-fn-tuple-generic-fail.rs b/tests/ui/splat/splat-fn-tuple-generic-fail.rs index 17e8e46db0672..e520e448a7b66 100644 --- a/tests/ui/splat/splat-fn-tuple-generic-fail.rs +++ b/tests/ui/splat/splat-fn-tuple-generic-fail.rs @@ -1,4 +1,4 @@ -//! Test failing use of `#[splat]` on tuple trait arguments of generic functions. +//! Test failing use of `#[rustc_splat]` on tuple trait arguments of generic functions. #![allow(incomplete_features)] #![feature(splat)] @@ -6,9 +6,9 @@ use std::marker::Tuple; -fn splat_generic_tuple(#[splat] _t: T) {} +fn splat_generic_tuple(#[rustc_splat] _t: T) {} -fn f(#[splat] args: Args) {} +fn f(#[rustc_splat] args: Args) {} fn main() { // FIXME(splat): should splatted functions be callable with tupled and un-tupled arguments? diff --git a/tests/ui/splat/splat-fn-tuple-generic-fail.stderr b/tests/ui/splat/splat-fn-tuple-generic-fail.stderr index c4fc6aa1d56c1..69efeec36a77c 100644 --- a/tests/ui/splat/splat-fn-tuple-generic-fail.stderr +++ b/tests/ui/splat/splat-fn-tuple-generic-fail.stderr @@ -43,7 +43,7 @@ LL | const F1: fn((u8, u32)) = f::<(u8, u32)>; | expected because of the type of the constant | = note: expected fn pointer `fn((_, _))` - found fn item `fn(#[splat] (_, _)) {f::<(u8, u32)>}` + found fn item `fn(#[rustc_splat] (_, _)) {f::<(u8, u32)>}` error: aborting due to 7 previous errors diff --git a/tests/ui/splat/splat-fn-tuple-generic.rs b/tests/ui/splat/splat-fn-tuple-generic.rs index b7e3615f62c45..31eae90aa4401 100644 --- a/tests/ui/splat/splat-fn-tuple-generic.rs +++ b/tests/ui/splat/splat-fn-tuple-generic.rs @@ -1,11 +1,11 @@ //@ run-pass -//! Test using `#[splat]` on tuple trait arguments of generic functions. +//! Test using `#[rustc_splat]` on tuple trait arguments of generic functions. #![allow(incomplete_features)] #![feature(splat)] #![feature(tuple_trait)] -fn splat_generic_tuple(#[splat] _t: T) {} +fn splat_generic_tuple(#[rustc_splat] _t: T) {} fn main() { // Calling with un-splatted arguments might look like it works, but the actual generic type is diff --git a/tests/ui/splat/splat-fn-tuple-simple.rs b/tests/ui/splat/splat-fn-tuple-simple.rs index c7234a15b9d55..f4e81b0149f96 100644 --- a/tests/ui/splat/splat-fn-tuple-simple.rs +++ b/tests/ui/splat/splat-fn-tuple-simple.rs @@ -1,12 +1,12 @@ //@ run-pass -//! Test using `#[splat]` on tuple arguments of simple functions. +//! Test using `#[rustc_splat]` on tuple arguments of simple functions. #![allow(incomplete_features)] #![feature(splat)] -fn tuple_args(#[splat] (_a, _b): (u32, i8)) {} +fn tuple_args(#[rustc_splat] (_a, _b): (u32, i8)) {} -fn splat_non_terminal_arg(#[splat] (_a, _b): (u32, i8), _c: f64) {} +fn splat_non_terminal_arg(#[rustc_splat] (_a, _b): (u32, i8), _c: f64) {} fn main() { tuple_args(1, 2); diff --git a/tests/ui/splat/splat-generics-complex-types.rs b/tests/ui/splat/splat-generics-complex-types.rs index 7d4490c18da75..9a38e175a71f9 100644 --- a/tests/ui/splat/splat-generics-complex-types.rs +++ b/tests/ui/splat/splat-generics-complex-types.rs @@ -1,17 +1,17 @@ //@ run-pass -//! Test using `#[splat]` on tuples with complex generic types inside the splatted tuple. +//! Test using `#[rustc_splat]` on tuples with complex generic types inside the splatted tuple. #![allow(incomplete_features)] #![feature(splat)] // Vec and Option inside splatted tuple -fn nested_generic(#[splat] _: (Vec, Option)) {} +fn nested_generic(#[rustc_splat] _: (Vec, Option)) {} // Box inside splatted tuple -fn box_generic(#[splat] _: (Box, u32)) {} +fn box_generic(#[rustc_splat] _: (Box, u32)) {} // Multiple complex generics -fn multi_generic(#[splat] _: (Vec, Option, Box)) {} +fn multi_generic(#[rustc_splat] _: (Vec, Option, Box)) {} fn main() { nested_generic(vec![1u32, 2u32], Some(2i8)); diff --git a/tests/ui/splat/splat-generics-everywhere.rs b/tests/ui/splat/splat-generics-everywhere.rs index 90335ad31f938..544a4ac99399b 100644 --- a/tests/ui/splat/splat-generics-everywhere.rs +++ b/tests/ui/splat/splat-generics-everywhere.rs @@ -1,5 +1,5 @@ //@ run-pass -//! Test using `#[splat]` on tuples with generics in various positions. +//! Test using `#[rustc_splat]` on tuples with generics in various positions. #![allow(incomplete_features)] #![feature(splat)] @@ -12,45 +12,45 @@ impl Foo { Self(t) } - fn assoc(_u: U, #[splat] _s: ()) {} + fn assoc(_u: U, #[rustc_splat] _s: ()) {} - fn method(&self, _v: V, #[splat] _s: (u32, f64)) {} + fn method(&self, _v: V, #[rustc_splat] _s: (u32, f64)) {} - fn lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} + fn lifetime<'a>(&self, #[rustc_splat] _s: (u32, f64, &'a str)) {} - fn const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + fn const_generic(&self, #[rustc_splat] _s: (u32, f64, [u8; N])) {} - fn generic_in_tuple(&self, #[splat] _s: (U, u32)) {} + fn generic_in_tuple(&self, #[rustc_splat] _s: (U, u32)) {} - fn generic_tuple_assoc(_u: U, #[splat] _s: ()) {} + fn generic_tuple_assoc(_u: U, #[rustc_splat] _s: ()) {} } trait BarTrait { - fn trait_assoc(w: W, #[splat] _s: ()); + fn trait_assoc(w: W, #[rustc_splat] _s: ()); - fn trait_method(&self, x: X, #[splat] _s: (u32, f64)); + fn trait_method(&self, x: X, #[rustc_splat] _s: (u32, f64)); - fn trait_lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} + fn trait_lifetime<'a>(&self, #[rustc_splat] _s: (u32, f64, &'a str)) {} - fn trait_const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + fn trait_const_generic(&self, #[rustc_splat] _s: (u32, f64, [u8; N])) {} - fn trait_generic_in_tuple(&self, #[splat] _s: (T, U)) {} + fn trait_generic_in_tuple(&self, #[rustc_splat] _s: (T, U)) {} - fn trait_generic_tuple(&self, #[splat] _s: U) {} + fn trait_generic_tuple(&self, #[rustc_splat] _s: U) {} } impl BarTrait for Foo { - fn trait_assoc(_w: W, #[splat] _s: ()) {} + fn trait_assoc(_w: W, #[rustc_splat] _s: ()) {} - fn trait_method(&self, _x: X, #[splat] _s: (u32, f64)) {} + fn trait_method(&self, _x: X, #[rustc_splat] _s: (u32, f64)) {} - fn trait_lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} + fn trait_lifetime<'a>(&self, #[rustc_splat] _s: (u32, f64, &'a str)) {} - fn trait_const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + fn trait_const_generic(&self, #[rustc_splat] _s: (u32, f64, [u8; N])) {} - fn trait_generic_in_tuple(&self, #[splat] _s: (T, U)) {} + fn trait_generic_in_tuple(&self, #[rustc_splat] _s: (T, U)) {} - fn trait_generic_tuple(&self, #[splat] _s: U) {} + fn trait_generic_tuple(&self, #[rustc_splat] _s: U) {} } fn main() { diff --git a/tests/ui/splat/splat-generics-inside-tuple.rs b/tests/ui/splat/splat-generics-inside-tuple.rs index dce26e55fa2d9..1c47d10c73189 100644 --- a/tests/ui/splat/splat-generics-inside-tuple.rs +++ b/tests/ui/splat/splat-generics-inside-tuple.rs @@ -1,15 +1,15 @@ //@ run-pass -//! Test using `#[splat]` on tuples with generics inside the splatted tuple. +//! Test using `#[rustc_splat]` on tuples with generics inside the splatted tuple. #![allow(incomplete_features)] #![feature(splat)] -fn generic_second(#[splat] _s: (u32, T)) {} +fn generic_second(#[rustc_splat] _s: (u32, T)) {} -fn generic_first(#[splat] _s: (T, u32)) {} +fn generic_first(#[rustc_splat] _s: (T, u32)) {} -fn generic_both(#[splat] _s: (T, U)) {} +fn generic_both(#[rustc_splat] _s: (T, U)) {} -fn generic_triple(#[splat] _s: (T, U, V)) {} +fn generic_triple(#[rustc_splat] _s: (T, U, V)) {} fn main() { generic_second(1u32, 2i8); diff --git a/tests/ui/splat/splat-invalid-trait-impl.rs b/tests/ui/splat/splat-invalid-trait-impl.rs index fe0d5ddc5a1c8..fdbb1d8c597e7 100644 --- a/tests/ui/splat/splat-invalid-trait-impl.rs +++ b/tests/ui/splat/splat-invalid-trait-impl.rs @@ -1,9 +1,9 @@ -//! Test that `#[splat]` trait impls with mismatched tuple element types are rejected. +//! Test that `#[rustc_splat]` trait impls with mismatched tuple element types are rejected. #![allow(incomplete_features)] #![feature(splat)] trait FooTrait { - fn method(#[splat] _: (u32, i8)); + fn method(#[rustc_splat] _: (u32, i8)); } struct Foo; @@ -11,17 +11,17 @@ struct Foo1; struct Foo2; impl FooTrait for Foo { - fn method(#[splat] _: (u32, f32)) {} + fn method(#[rustc_splat] _: (u32, f32)) {} //~^ ERROR method `method` has an incompatible type for trait } impl FooTrait for Foo1 { - fn method(#[splat] _: (f32, i8)) {} + fn method(#[rustc_splat] _: (f32, i8)) {} //~^ ERROR method `method` has an incompatible type for trait } impl FooTrait for Foo2 { - fn method(#[splat] _: (f32, f64)) {} + fn method(#[rustc_splat] _: (f32, f64)) {} //~^ ERROR method `method` has an incompatible type for trait } fn main() {} diff --git a/tests/ui/splat/splat-invalid-trait-impl.stderr b/tests/ui/splat/splat-invalid-trait-impl.stderr index 684cc65d7a326..df414a5e63062 100644 --- a/tests/ui/splat/splat-invalid-trait-impl.stderr +++ b/tests/ui/splat/splat-invalid-trait-impl.stderr @@ -1,58 +1,58 @@ error[E0053]: method `method` has an incompatible type for trait - --> $DIR/splat-invalid-trait-impl.rs:14:27 + --> $DIR/splat-invalid-trait-impl.rs:14:33 | -LL | fn method(#[splat] _: (u32, f32)) {} - | ^^^^^^^^^^ expected `i8`, found `f32` +LL | fn method(#[rustc_splat] _: (u32, f32)) {} + | ^^^^^^^^^^ expected `i8`, found `f32` | note: type in trait - --> $DIR/splat-invalid-trait-impl.rs:6:27 + --> $DIR/splat-invalid-trait-impl.rs:6:33 | -LL | fn method(#[splat] _: (u32, i8)); - | ^^^^^^^^^ - = note: expected signature `fn(#[splat] (_, i8))` - found signature `fn(#[splat] (_, f32))` +LL | fn method(#[rustc_splat] _: (u32, i8)); + | ^^^^^^^^^ + = note: expected signature `fn(#[rustc_splat] (_, i8))` + found signature `fn(#[rustc_splat] (_, f32))` help: change the parameter type to match the trait | -LL - fn method(#[splat] _: (u32, f32)) {} -LL + fn method(#[splat] _: (u32, i8)) {} +LL - fn method(#[rustc_splat] _: (u32, f32)) {} +LL + fn method(#[rustc_splat] _: (u32, i8)) {} | error[E0053]: method `method` has an incompatible type for trait - --> $DIR/splat-invalid-trait-impl.rs:19:27 + --> $DIR/splat-invalid-trait-impl.rs:19:33 | -LL | fn method(#[splat] _: (f32, i8)) {} - | ^^^^^^^^^ expected `u32`, found `f32` +LL | fn method(#[rustc_splat] _: (f32, i8)) {} + | ^^^^^^^^^ expected `u32`, found `f32` | note: type in trait - --> $DIR/splat-invalid-trait-impl.rs:6:27 + --> $DIR/splat-invalid-trait-impl.rs:6:33 | -LL | fn method(#[splat] _: (u32, i8)); - | ^^^^^^^^^ - = note: expected signature `fn(#[splat] (u32, _))` - found signature `fn(#[splat] (f32, _))` +LL | fn method(#[rustc_splat] _: (u32, i8)); + | ^^^^^^^^^ + = note: expected signature `fn(#[rustc_splat] (u32, _))` + found signature `fn(#[rustc_splat] (f32, _))` help: change the parameter type to match the trait | -LL - fn method(#[splat] _: (f32, i8)) {} -LL + fn method(#[splat] _: (u32, i8)) {} +LL - fn method(#[rustc_splat] _: (f32, i8)) {} +LL + fn method(#[rustc_splat] _: (u32, i8)) {} | error[E0053]: method `method` has an incompatible type for trait - --> $DIR/splat-invalid-trait-impl.rs:24:27 + --> $DIR/splat-invalid-trait-impl.rs:24:33 | -LL | fn method(#[splat] _: (f32, f64)) {} - | ^^^^^^^^^^ expected `u32`, found `f32` +LL | fn method(#[rustc_splat] _: (f32, f64)) {} + | ^^^^^^^^^^ expected `u32`, found `f32` | note: type in trait - --> $DIR/splat-invalid-trait-impl.rs:6:27 + --> $DIR/splat-invalid-trait-impl.rs:6:33 | -LL | fn method(#[splat] _: (u32, i8)); - | ^^^^^^^^^ - = note: expected signature `fn(#[splat] (u32, i8))` - found signature `fn(#[splat] (f32, f64))` +LL | fn method(#[rustc_splat] _: (u32, i8)); + | ^^^^^^^^^ + = note: expected signature `fn(#[rustc_splat] (u32, i8))` + found signature `fn(#[rustc_splat] (f32, f64))` help: change the parameter type to match the trait | -LL - fn method(#[splat] _: (f32, f64)) {} -LL + fn method(#[splat] _: (u32, i8)) {} +LL - fn method(#[rustc_splat] _: (f32, f64)) {} +LL + fn method(#[rustc_splat] _: (u32, i8)) {} | error: aborting due to 3 previous errors diff --git a/tests/ui/splat/splat-invalid.rs b/tests/ui/splat/splat-invalid.rs index 2c4bf57ef972a..3e2e67c0bad38 100644 --- a/tests/ui/splat/splat-invalid.rs +++ b/tests/ui/splat/splat-invalid.rs @@ -1,37 +1,37 @@ -//! Test using `#[splat]` incorrectly, in ways not covered by other tests. +//! Test using `#[rustc_splat]` incorrectly, in ways not covered by other tests. #![allow(incomplete_features)] #![feature(splat)] #![feature(c_variadic)] -fn multisplat_bad(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} -//~^ ERROR multiple `#[splat]`s are not allowed in the same function +fn multisplat_bad(#[rustc_splat] (_a, _b): (u32, i8), #[rustc_splat] (_c, _d): (u32, i8)) {} +//~^ ERROR multiple `#[rustc_splat]`s are not allowed in the same function -unsafe extern "C" fn splat_variadic(#[splat] (_a, _b): (u32, i8), varargs: ...) {} -//~^ ERROR `...` and `#[splat]` are not allowed in the same function +unsafe extern "C" fn splat_variadic(#[rustc_splat] (_a, _b): (u32, i8), varargs: ...) {} +//~^ ERROR `...` and `#[rustc_splat]` are not allowed in the same function -unsafe extern "C" fn splat_variadic2(varargs: ..., #[splat] (_a, _b): (u32, i8)) {} -//~^ ERROR `...` and `#[splat]` are not allowed in the same function +unsafe extern "C" fn splat_variadic2(varargs: ..., #[rustc_splat] (_a, _b): (u32, i8)) {} +//~^ ERROR `...` and `#[rustc_splat]` are not allowed in the same function //~| ERROR `...` must be the last argument of a C-variadic function extern "C" { - fn splat_variadic3(#[splat] (_a, _b): (u32, i8), ...) {} + fn splat_variadic3(#[rustc_splat] (_a, _b): (u32, i8), ...) {} //~^ ERROR incorrect function inside `extern` block - //~| ERROR `...` and `#[splat]` are not allowed in the same function + //~| ERROR `...` and `#[rustc_splat]` are not allowed in the same function - fn splat_variadic4(..., #[splat] (_a, _b): (u32, i8)) {} + fn splat_variadic4(..., #[rustc_splat] (_a, _b): (u32, i8)) {} //~^ ERROR incorrect function inside `extern` block - //~| ERROR `...` and `#[splat]` are not allowed in the same function + //~| ERROR `...` and `#[rustc_splat]` are not allowed in the same function //~| ERROR `...` must be the last argument of a C-variadic function // FIXME(splat): tuple layouts are unspecified. Should this error in addition to // the existing `improper_ctypes` lint? #[expect(improper_ctypes)] - fn bar_2(#[splat] _: (u32, i8)); + fn bar_2(#[rustc_splat] _: (u32, i8)); } trait FooTrait { - fn has_splat(#[splat] _: ()); + fn has_splat(#[rustc_splat] _: ()); fn no_splat(_: (u32, f64)); } @@ -41,7 +41,7 @@ struct Foo; impl FooTrait for Foo { fn has_splat(_: ()) {} //~ ERROR method `has_splat` has an incompatible type for trait - fn no_splat(#[splat] _: (u32, f64)) {} //~ ERROR method `no_splat` has an incompatible type for trait + fn no_splat(#[rustc_splat] _: (u32, f64)) {} //~ ERROR method `no_splat` has an incompatible type for trait } fn main() {} diff --git a/tests/ui/splat/splat-invalid.stderr b/tests/ui/splat/splat-invalid.stderr index 74c54c00cd285..4d0f81fe6f294 100644 --- a/tests/ui/splat/splat-invalid.stderr +++ b/tests/ui/splat/splat-invalid.stderr @@ -1,51 +1,51 @@ -error: multiple `#[splat]`s are not allowed in the same function +error: multiple `#[rustc_splat]`s are not allowed in the same function --> $DIR/splat-invalid.rs:7:19 | -LL | fn multisplat_bad(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn multisplat_bad(#[rustc_splat] (_a, _b): (u32, i8), #[rustc_splat] (_c, _d): (u32, i8)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: remove `#[splat]` from all but one argument + = help: remove `#[rustc_splat]` from all but one argument -error: `...` and `#[splat]` are not allowed in the same function +error: `...` and `#[rustc_splat]` are not allowed in the same function --> $DIR/splat-invalid.rs:10:37 | -LL | unsafe extern "C" fn splat_variadic(#[splat] (_a, _b): (u32, i8), varargs: ...) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ +LL | unsafe extern "C" fn splat_variadic(#[rustc_splat] (_a, _b): (u32, i8), varargs: ...) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ | - = help: remove `#[splat]` or remove `...` + = help: remove `#[rustc_splat]` or remove `...` error: `...` must be the last argument of a C-variadic function --> $DIR/splat-invalid.rs:13:38 | -LL | unsafe extern "C" fn splat_variadic2(varargs: ..., #[splat] (_a, _b): (u32, i8)) {} +LL | unsafe extern "C" fn splat_variadic2(varargs: ..., #[rustc_splat] (_a, _b): (u32, i8)) {} | ^^^^^^^^^^^^ -error: `...` and `#[splat]` are not allowed in the same function +error: `...` and `#[rustc_splat]` are not allowed in the same function --> $DIR/splat-invalid.rs:13:38 | -LL | unsafe extern "C" fn splat_variadic2(varargs: ..., #[splat] (_a, _b): (u32, i8)) {} - | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe extern "C" fn splat_variadic2(varargs: ..., #[rustc_splat] (_a, _b): (u32, i8)) {} + | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: remove `#[splat]` or remove `...` + = help: remove `#[rustc_splat]` or remove `...` error: incorrect function inside `extern` block --> $DIR/splat-invalid.rs:18:8 | LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn splat_variadic3(#[splat] (_a, _b): (u32, i8), ...) {} - | ^^^^^^^^^^^^^^^ cannot have a body -- help: remove the invalid body: `;` +LL | fn splat_variadic3(#[rustc_splat] (_a, _b): (u32, i8), ...) {} + | ^^^^^^^^^^^^^^^ cannot have a body -- help: remove the invalid body: `;` | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html -error: `...` and `#[splat]` are not allowed in the same function +error: `...` and `#[rustc_splat]` are not allowed in the same function --> $DIR/splat-invalid.rs:18:24 | -LL | fn splat_variadic3(#[splat] (_a, _b): (u32, i8), ...) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +LL | fn splat_variadic3(#[rustc_splat] (_a, _b): (u32, i8), ...) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ | - = help: remove `#[splat]` or remove `...` + = help: remove `#[rustc_splat]` or remove `...` error: incorrect function inside `extern` block --> $DIR/splat-invalid.rs:22:8 @@ -53,8 +53,8 @@ error: incorrect function inside `extern` block LL | extern "C" { | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body ... -LL | fn splat_variadic4(..., #[splat] (_a, _b): (u32, i8)) {} - | ^^^^^^^^^^^^^^^ cannot have a body -- help: remove the invalid body: `;` +LL | fn splat_variadic4(..., #[rustc_splat] (_a, _b): (u32, i8)) {} + | ^^^^^^^^^^^^^^^ cannot have a body -- help: remove the invalid body: `;` | = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html @@ -62,16 +62,16 @@ LL | fn splat_variadic4(..., #[splat] (_a, _b): (u32, i8)) {} error: `...` must be the last argument of a C-variadic function --> $DIR/splat-invalid.rs:22:24 | -LL | fn splat_variadic4(..., #[splat] (_a, _b): (u32, i8)) {} +LL | fn splat_variadic4(..., #[rustc_splat] (_a, _b): (u32, i8)) {} | ^^^ -error: `...` and `#[splat]` are not allowed in the same function +error: `...` and `#[rustc_splat]` are not allowed in the same function --> $DIR/splat-invalid.rs:22:24 | -LL | fn splat_variadic4(..., #[splat] (_a, _b): (u32, i8)) {} - | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn splat_variadic4(..., #[rustc_splat] (_a, _b): (u32, i8)) {} + | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: remove `#[splat]` or remove `...` + = help: remove `#[rustc_splat]` or remove `...` error[E0053]: method `has_splat` has an incompatible type for trait --> $DIR/splat-invalid.rs:42:5 @@ -82,16 +82,16 @@ LL | fn has_splat(_: ()) {} note: type in trait --> $DIR/splat-invalid.rs:34:5 | -LL | fn has_splat(#[splat] _: ()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected signature `fn(#[splat] ())` +LL | fn has_splat(#[rustc_splat] _: ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected signature `fn(#[rustc_splat] ())` found signature `fn(())` error[E0053]: method `no_splat` has an incompatible type for trait --> $DIR/splat-invalid.rs:44:5 | -LL | fn no_splat(#[splat] _: (u32, f64)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn with no splatted arg, found fn with arg 0 splatted +LL | fn no_splat(#[rustc_splat] _: (u32, f64)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn with no splatted arg, found fn with arg 0 splatted | note: type in trait --> $DIR/splat-invalid.rs:36:5 @@ -99,7 +99,7 @@ note: type in trait LL | fn no_splat(_: (u32, f64)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected signature `fn((_, _))` - found signature `fn(#[splat] (_, _))` + found signature `fn(#[rustc_splat] (_, _))` error: aborting due to 11 previous errors diff --git a/tests/ui/splat/splat-maybe-tuple.rs b/tests/ui/splat/splat-maybe-tuple.rs index a74af66e9a874..5e09ad737e719 100644 --- a/tests/ui/splat/splat-maybe-tuple.rs +++ b/tests/ui/splat/splat-maybe-tuple.rs @@ -1,11 +1,11 @@ -//! Test that using `#[splat]` on maybe-tuple generic function arguments is an error, +//! Test that using `#[rustc_splat]` on maybe-tuple generic function arguments is an error, //! but only when the generics aren't tuples. #![allow(incomplete_features)] #![feature(splat)] #![expect(unused)] -fn unbound_generic_arg(#[splat] t: T) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 +fn unbound_generic_arg(#[rustc_splat] t: T) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 fn main() { unbound_generic_arg(); diff --git a/tests/ui/splat/splat-maybe-tuple.stderr b/tests/ui/splat/splat-maybe-tuple.stderr index 9abacdd657b93..9e9d1bc66b83c 100644 --- a/tests/ui/splat/splat-maybe-tuple.stderr +++ b/tests/ui/splat/splat-maybe-tuple.stderr @@ -1,8 +1,8 @@ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32) - --> $DIR/splat-maybe-tuple.rs:8:39 + --> $DIR/splat-maybe-tuple.rs:8:45 | -LL | fn unbound_generic_arg(#[splat] t: T) {} - | ^ +LL | fn unbound_generic_arg(#[rustc_splat] t: T) {} + | ^ ... LL | unbound_generic_arg::(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-method-tuple-simple.rs b/tests/ui/splat/splat-method-tuple-simple.rs index 887c9515bcdae..7070529c15782 100644 --- a/tests/ui/splat/splat-method-tuple-simple.rs +++ b/tests/ui/splat/splat-method-tuple-simple.rs @@ -1,5 +1,5 @@ //@ run-pass -//! Test using `#[splat]` on method tuple arguments (with receivers). +//! Test using `#[rustc_splat]` on method tuple arguments (with receivers). #![allow(incomplete_features)] #![feature(splat)] @@ -7,11 +7,11 @@ struct Foo; impl Foo { - fn tuple_2(&self, #[splat] (a, _b): (u32, i8)) -> u32 { + fn tuple_2(&self, #[rustc_splat] (a, _b): (u32, i8)) -> u32 { a } - fn tuple_4(&self, #[splat] (a, _b, _c, _d): (u32, i8, (), f32)) -> u32 { + fn tuple_4(&self, #[rustc_splat] (a, _b, _c, _d): (u32, i8, (), f32)) -> u32 { a } } @@ -20,7 +20,7 @@ impl Foo { struct TupleStruct(u32, i8); impl TupleStruct { - fn tuple_2(&self, #[splat] (a, _b): (u32, i8)) -> u32 { + fn tuple_2(&self, #[rustc_splat] (a, _b): (u32, i8)) -> u32 { a } } diff --git a/tests/ui/splat/splat-non-fn-arg.rs b/tests/ui/splat/splat-non-fn-arg.rs index 6f2815e2b6579..e9d712d3bc250 100644 --- a/tests/ui/splat/splat-non-fn-arg.rs +++ b/tests/ui/splat/splat-non-fn-arg.rs @@ -1,12 +1,12 @@ -//! Test that using `#[splat]` on non-function-arguments is an error. +//! Test that using `#[rustc_splat]` on non-function-arguments is an error. #![allow(incomplete_features)] #![feature(splat)] -#[splat] //~ ERROR `#[splat]` attribute cannot be used on functions +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on functions fn tuple_args_bad((a, b): (u32, i8)) {} -#[splat] //~ ERROR `#[splat]` attribute cannot be used on traits +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on traits trait FooTraitBad { fn tuple_1(_: (u32,)); @@ -15,45 +15,45 @@ trait FooTraitBad { struct Foo; -#[splat] //~ ERROR `#[splat]` attribute cannot be used on inherent impl blocks +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on inherent impl blocks impl Foo { fn tuple_1_bad((a,): (u32,)) {} } impl Foo { - #[splat] //~ ERROR `#[splat]` attribute cannot be used on inherent methods + #[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on inherent methods fn tuple_3_bad((a, b, c): (u32, i32, i8)) {} - #[splat] //~ ERROR `#[splat]` attribute cannot be used on inherent methods + #[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on inherent methods fn tuple_2_bad(self, (a, b): (u32, i8)) -> u32 { a } } -#[splat] //~ ERROR `#[splat]` attribute cannot be used on trait impl blocks +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on trait impl blocks impl FooTraitBad for Foo { fn tuple_1(_: (u32,)) {} fn tuple_4(self, _: (u32, i8, (), f32)) {} } -#[splat] //~ ERROR `#[splat]` attribute cannot be used on foreign modules +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on foreign modules extern "C" { fn foo_2(_: (u32, i8)); } extern "C" { - #[splat] //~ ERROR `#[splat]` attribute cannot be used on foreign functions + #[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on foreign functions fn bar_2_bad(_: (u32, i8)); } -#[splat] //~ ERROR `#[splat]` attribute cannot be used on modules +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on modules mod foo_mod {} -#[splat] //~ ERROR `#[splat]` attribute cannot be used on use statements +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on use statements use std::mem; -#[splat] //~ ERROR `#[splat]` attribute cannot be used on structs +#[rustc_splat] //~ ERROR `#[rustc_splat]` attribute cannot be used on structs struct FooStruct; fn main() {} diff --git a/tests/ui/splat/splat-non-fn-arg.stderr b/tests/ui/splat/splat-non-fn-arg.stderr index 089636f3d4dff..65c06e80a2050 100644 --- a/tests/ui/splat/splat-non-fn-arg.stderr +++ b/tests/ui/splat/splat-non-fn-arg.stderr @@ -1,90 +1,90 @@ -error: `#[splat]` attribute cannot be used on functions +error: `#[rustc_splat]` attribute cannot be used on functions --> $DIR/splat-non-fn-arg.rs:6:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on traits +error: `#[rustc_splat]` attribute cannot be used on traits --> $DIR/splat-non-fn-arg.rs:9:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on inherent impl blocks +error: `#[rustc_splat]` attribute cannot be used on inherent impl blocks --> $DIR/splat-non-fn-arg.rs:18:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on inherent methods +error: `#[rustc_splat]` attribute cannot be used on inherent methods --> $DIR/splat-non-fn-arg.rs:24:5 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on inherent methods +error: `#[rustc_splat]` attribute cannot be used on inherent methods --> $DIR/splat-non-fn-arg.rs:27:5 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on trait impl blocks +error: `#[rustc_splat]` attribute cannot be used on trait impl blocks --> $DIR/splat-non-fn-arg.rs:33:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on foreign modules +error: `#[rustc_splat]` attribute cannot be used on foreign modules --> $DIR/splat-non-fn-arg.rs:40:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on foreign functions +error: `#[rustc_splat]` attribute cannot be used on foreign functions --> $DIR/splat-non-fn-arg.rs:46:5 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on modules +error: `#[rustc_splat]` attribute cannot be used on modules --> $DIR/splat-non-fn-arg.rs:50:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on use statements +error: `#[rustc_splat]` attribute cannot be used on use statements --> $DIR/splat-non-fn-arg.rs:53:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params -error: `#[splat]` attribute cannot be used on structs +error: `#[rustc_splat]` attribute cannot be used on structs --> $DIR/splat-non-fn-arg.rs:56:1 | -LL | #[splat] - | ^^^^^^^^ +LL | #[rustc_splat] + | ^^^^^^^^^^^^^^ | - = help: `#[splat]` can only be applied to function params + = help: `#[rustc_splat]` can only be applied to function params error: aborting due to 11 previous errors diff --git a/tests/ui/splat/splat-non-tuple.rs b/tests/ui/splat/splat-non-tuple.rs index 35841a770b226..ac6a4d6139711 100644 --- a/tests/ui/splat/splat-non-tuple.rs +++ b/tests/ui/splat/splat-non-tuple.rs @@ -1,33 +1,33 @@ -//! Test that using `#[splat]` on non-tuple function arguments is an error. +//! Test that using `#[rustc_splat]` on non-tuple function arguments is an error. #![allow(incomplete_features)] #![feature(splat)] #![expect(unused)] -fn primitive_arg(#[splat] x: u32) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 +fn primitive_arg(#[rustc_splat] x: u32) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 enum NotATuple { A(u32), B(i8), } -fn enum_arg(#[splat] y: NotATuple) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a NotATuple +fn enum_arg(#[rustc_splat] y: NotATuple) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a NotATuple trait FooTrait { - fn tuple_1(#[splat] _: (u32,)); //~ NOTE type in trait + fn tuple_1(#[rustc_splat] _: (u32,)); //~ NOTE type in trait // Ambiguous case, self could be a tuple or a non-tuple - fn tuple_4(#[splat] self, _: (u32, i8, (), f32)); + fn tuple_4(#[rustc_splat] self, _: (u32, i8, (), f32)); } struct Foo; -fn struct_arg(#[splat] z: Foo) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Foo +fn struct_arg(#[rustc_splat] z: Foo) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Foo impl Foo { + // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple fn tuple_2_self( - // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a... - #[splat] self, + #[rustc_splat] self, (a, b): (u32, i8), ) -> u32 { a @@ -38,12 +38,12 @@ impl FooTrait for Foo { fn tuple_1(_: (u32,)) {} //~^ ERROR method `tuple_1` has an incompatible type for trait //~| NOTE expected fn with arg 0 splatted, found fn with no splatted arg - //~| NOTE expected signature `fn(#[splat] (_,))` + //~| NOTE expected signature `fn(#[rustc_splat] (_,))` //~| NOTE found signature `fn((_,))` + // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple fn tuple_4( - // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a... - #[splat] self, + #[rustc_splat] self, _: (u32, i8, (), f32), ) { } @@ -51,11 +51,12 @@ impl FooTrait for Foo { struct TupleStruct(u32, i8); -fn tuple_struct_arg(#[splat] z: TupleStruct) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a TupleStruct +fn tuple_struct_arg(#[rustc_splat] z: TupleStruct) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a TupleStruct impl TupleStruct { + // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple fn tuple_2( - #[splat] self, // FIXME(splat): ERROR `#[splat]` attribute must be used on a tuple + #[rustc_splat] self, (a, b): (f32, f64), ) -> f32 { a @@ -63,10 +64,11 @@ impl TupleStruct { } impl FooTrait for TupleStruct { - fn tuple_1(#[splat] _: (u32,)) {} + fn tuple_1(#[rustc_splat] _: (u32,)) {} + // FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple fn tuple_4( - #[splat] self, // FIXME(splat): ERROR `#[splat]` attribute must be used on a tuple + #[rustc_splat] self, _: (u32, i8, (), f32), ) { } diff --git a/tests/ui/splat/splat-non-tuple.stderr b/tests/ui/splat/splat-non-tuple.stderr index 64f7148d8dbd2..b75c6bf5e1fd7 100644 --- a/tests/ui/splat/splat-non-tuple.stderr +++ b/tests/ui/splat/splat-non-tuple.stderr @@ -7,43 +7,43 @@ LL | fn tuple_1(_: (u32,)) {} note: type in trait --> $DIR/splat-non-tuple.rs:17:5 | -LL | fn tuple_1(#[splat] _: (u32,)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected signature `fn(#[splat] (_,))` +LL | fn tuple_1(#[rustc_splat] _: (u32,)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected signature `fn(#[rustc_splat] (_,))` found signature `fn((_,))` error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32) - --> $DIR/splat-non-tuple.rs:7:30 + --> $DIR/splat-non-tuple.rs:7:36 | -LL | fn primitive_arg(#[splat] x: u32) {} - | ^^^ +LL | fn primitive_arg(#[rustc_splat] x: u32) {} + | ^^^ ... LL | primitive_arg(1u32); | ^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a NotATuple (NotATuple) - --> $DIR/splat-non-tuple.rs:14:25 + --> $DIR/splat-non-tuple.rs:14:31 | -LL | fn enum_arg(#[splat] y: NotATuple) {} - | ^^^^^^^^^ +LL | fn enum_arg(#[rustc_splat] y: NotATuple) {} + | ^^^^^^^^^ ... LL | enum_arg(NotATuple::A(1u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Foo (Foo) - --> $DIR/splat-non-tuple.rs:25:27 + --> $DIR/splat-non-tuple.rs:25:33 | -LL | fn struct_arg(#[splat] z: Foo) {} - | ^^^ +LL | fn struct_arg(#[rustc_splat] z: Foo) {} + | ^^^ ... LL | struct_arg(foo); | ^^^^^^^^^^^^^^^ error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a TupleStruct (TupleStruct) - --> $DIR/splat-non-tuple.rs:54:33 + --> $DIR/splat-non-tuple.rs:54:39 | -LL | fn tuple_struct_arg(#[splat] z: TupleStruct) {} - | ^^^^^^^^^^^ +LL | fn tuple_struct_arg(#[rustc_splat] z: TupleStruct) {} + | ^^^^^^^^^^^ ... LL | tuple_struct_arg(tuple_struct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-overload-at-home-fail.rs b/tests/ui/splat/splat-overload-at-home-fail.rs index 8e6a375e0eb96..79a7dd14d005b 100644 --- a/tests/ui/splat/splat-overload-at-home-fail.rs +++ b/tests/ui/splat/splat-overload-at-home-fail.rs @@ -1,4 +1,4 @@ -//! Test error cases for `#[splat]` "overloading at home" example code. +//! Test error cases for `#[rustc_splat]` "overloading at home" example code. //! Splatted calls that don't match any registered MethodArgs impl should fail. #![allow(incomplete_features)] #![feature(splat)] @@ -23,7 +23,7 @@ impl MethodArgs for (i32, String) { } impl Foo { - fn method(&self, #[splat] args: T) { + fn method(&self, #[rustc_splat] args: T) { args.call_method(self) } } diff --git a/tests/ui/splat/splat-overload-at-home-fail.stderr b/tests/ui/splat/splat-overload-at-home-fail.stderr index fcedccf28c359..3b1b59464b2f0 100644 --- a/tests/ui/splat/splat-overload-at-home-fail.stderr +++ b/tests/ui/splat/splat-overload-at-home-fail.stderr @@ -9,8 +9,8 @@ LL | foo.method(42f32); note: method defined here --> $DIR/splat-overload-at-home-fail.rs:26:8 | -LL | fn method(&self, #[splat] args: T) { - | ^^^^^^ ---------------- +LL | fn method(&self, #[rustc_splat] args: T) { + | ^^^^^^ ---------------------- help: change the type of the numeric literal from `f32` to `i32` | LL - foo.method(42f32); @@ -28,7 +28,7 @@ LL | foo.method(42i32, 42i32); note: method defined here --> $DIR/splat-overload-at-home-fail.rs:26:8 | -LL | fn method(&self, #[splat] args: T) { +LL | fn method(&self, #[rustc_splat] args: T) { | ^^^^^^ help: try using a conversion method | diff --git a/tests/ui/splat/splat-overload-at-home.rs b/tests/ui/splat/splat-overload-at-home.rs index 621f0e04f67e1..808973805dc30 100644 --- a/tests/ui/splat/splat-overload-at-home.rs +++ b/tests/ui/splat/splat-overload-at-home.rs @@ -1,6 +1,6 @@ //@ run-pass // ignore-tidy-linelength -//! Test using `#[splat]` on some "overloading at home" example code. +//! Test using `#[rustc_splat]` on some "overloading at home" example code. //! #![allow(incomplete_features)] @@ -23,7 +23,7 @@ impl MethodArgs for (i32, String) { } impl Foo { - fn method(&self, #[splat] args: T) { + fn method(&self, #[rustc_splat] args: T) { args.call_method(self) } } diff --git a/tests/ui/splat/splat-self.rs b/tests/ui/splat/splat-self.rs index b826a5b30b9bc..66539ae139139 100644 --- a/tests/ui/splat/splat-self.rs +++ b/tests/ui/splat/splat-self.rs @@ -1,16 +1,16 @@ //@ run-pass //@ check-run-results -//! Test using `#[splat]` on self arguments of trait methods. +//! Test using `#[rustc_splat]` on self arguments of trait methods. #![feature(splat)] #![expect(incomplete_features)] trait Trait { - fn method(#[splat] self: Self); + fn method(#[rustc_splat] self: Self); } impl Trait for (i32, i64) { - fn method(#[splat] self: Self) { + fn method(#[rustc_splat] self: Self) { println!("{self:?}"); } } diff --git a/tests/ui/splat/splat-trait-tuple.rs b/tests/ui/splat/splat-trait-tuple.rs index a5b74a40cffd9..d14e61321e2cb 100644 --- a/tests/ui/splat/splat-trait-tuple.rs +++ b/tests/ui/splat/splat-trait-tuple.rs @@ -1,31 +1,31 @@ //@ run-pass -//! Test using `#[splat]` on trait assoc function/method tuple arguments. +//! Test using `#[rustc_splat]` on trait assoc function/method tuple arguments. #![allow(incomplete_features)] #![feature(splat)] trait FooTrait { - fn tuple_1_trait(#[splat] _: (u32,)); + fn tuple_1_trait(#[rustc_splat] _: (u32,)); - fn tuple_2_trait(&self, #[splat] _: (u32, f32)); + fn tuple_2_trait(&self, #[rustc_splat] _: (u32, f32)); } struct Foo; impl FooTrait for Foo { // Currently, splat attributes on impls must match traits. This provides better UX. - fn tuple_1_trait(#[splat] _: (u32,)) {} + fn tuple_1_trait(#[rustc_splat] _: (u32,)) {} - fn tuple_2_trait(&self, #[splat] _: (u32, f32)) {} + fn tuple_2_trait(&self, #[rustc_splat] _: (u32, f32)) {} } #[expect(dead_code)] struct TupleStruct(u32, i8); impl FooTrait for TupleStruct { - fn tuple_1_trait(#[splat] _: (u32,)) {} + fn tuple_1_trait(#[rustc_splat] _: (u32,)) {} - fn tuple_2_trait(&self, #[splat] _: (u32, f32)) {} + fn tuple_2_trait(&self, #[rustc_splat] _: (u32, f32)) {} } fn main() { diff --git a/tests/ui/splat/splat-unsafe-fn-tuple-fail.rs b/tests/ui/splat/splat-unsafe-fn-tuple-fail.rs index 3f29b9d292d22..ab3906b902753 100644 --- a/tests/ui/splat/splat-unsafe-fn-tuple-fail.rs +++ b/tests/ui/splat/splat-unsafe-fn-tuple-fail.rs @@ -1,13 +1,16 @@ -//! Test that using `#[splat]` incorrectly on unsafe functions gives errors. +//! Test that using `#[rustc_splat]` incorrectly on unsafe functions gives errors. #![allow(incomplete_features)] #![feature(splat)] -unsafe fn unsafe_wrong_type(#[splat] _x: u32) {} +unsafe fn unsafe_wrong_type(#[rustc_splat] _x: u32) {} //~^ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 -unsafe fn unsafe_multi_splat(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} -//~^ ERROR multiple `#[splat]`s are not allowed in the same function +unsafe fn unsafe_multi_splat( + #[rustc_splat] (_a, _b): (u32, i8), + //~^ ERROR multiple `#[rustc_splat]`s are not allowed in the same function + #[rustc_splat] (_c, _d): (u32, i8), +) {} fn main() { unsafe { diff --git a/tests/ui/splat/splat-unsafe-fn-tuple-fail.stderr b/tests/ui/splat/splat-unsafe-fn-tuple-fail.stderr index 67935e170671a..0a7e156ea5199 100644 --- a/tests/ui/splat/splat-unsafe-fn-tuple-fail.stderr +++ b/tests/ui/splat/splat-unsafe-fn-tuple-fail.stderr @@ -1,16 +1,19 @@ -error: multiple `#[splat]`s are not allowed in the same function - --> $DIR/splat-unsafe-fn-tuple-fail.rs:9:30 +error: multiple `#[rustc_splat]`s are not allowed in the same function + --> $DIR/splat-unsafe-fn-tuple-fail.rs:10:5 | -LL | unsafe fn unsafe_multi_splat(#[splat] (_a, _b): (u32, i8), #[splat] (_c, _d): (u32, i8)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_splat] (_a, _b): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | #[rustc_splat] (_c, _d): (u32, i8), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: remove `#[splat]` from all but one argument + = help: remove `#[rustc_splat]` from all but one argument error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32) - --> $DIR/splat-unsafe-fn-tuple-fail.rs:6:42 + --> $DIR/splat-unsafe-fn-tuple-fail.rs:6:48 | -LL | unsafe fn unsafe_wrong_type(#[splat] _x: u32) {} - | ^^^ +LL | unsafe fn unsafe_wrong_type(#[rustc_splat] _x: u32) {} + | ^^^ ... LL | unsafe_wrong_type(1u32); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/splat/splat-unsafe-fn-tuple.rs b/tests/ui/splat/splat-unsafe-fn-tuple.rs index 0b9b3510ad50b..124e663f01f3d 100644 --- a/tests/ui/splat/splat-unsafe-fn-tuple.rs +++ b/tests/ui/splat/splat-unsafe-fn-tuple.rs @@ -1,12 +1,12 @@ //@ run-pass -//! Test using `#[splat]` on tuple arguments of unsafe functions. +//! Test using `#[rustc_splat]` on tuple arguments of unsafe functions. #![allow(incomplete_features)] #![feature(splat)] -unsafe fn unsafe_tuple_args(#[splat] (_a, _b): (u32, i8)) {} +unsafe fn unsafe_tuple_args(#[rustc_splat] (_a, _b): (u32, i8)) {} -unsafe fn unsafe_splat_non_terminal_arg(#[splat] (_a, _b): (u32, i8), _c: f64) {} +unsafe fn unsafe_splat_non_terminal_arg(#[rustc_splat] (_a, _b): (u32, i8), _c: f64) {} fn main() { unsafe { diff --git a/tests/ui/splat/splat-where-clause.rs b/tests/ui/splat/splat-where-clause.rs index 42a23fe67b216..9ee12e2b84343 100644 --- a/tests/ui/splat/splat-where-clause.rs +++ b/tests/ui/splat/splat-where-clause.rs @@ -1,17 +1,17 @@ //@ run-pass -//! Test using `#[splat]` on tuple arguments with where clause bounds. +//! Test using `#[rustc_splat]` on tuple arguments with where clause bounds. #![allow(incomplete_features)] #![feature(splat)] #![feature(tuple_trait)] -fn where_splat(#[splat] _t: T) where T: std::marker::Tuple {} +fn where_splat(#[rustc_splat] _t: T) where T: std::marker::Tuple {} -fn where_splat_with_extra(#[splat] _t: T, _extra: u32) where T: std::marker::Tuple {} +fn where_splat_with_extra(#[rustc_splat] _t: T, _extra: u32) where T: std::marker::Tuple {} -fn impl_tuple_splat(#[splat] _t: impl std::marker::Tuple) {} +fn impl_tuple_splat(#[rustc_splat] _t: impl std::marker::Tuple) {} -fn impl_tuple_splat_with_extra(#[splat] _t: impl std::marker::Tuple, _extra: u32) {} +fn impl_tuple_splat_with_extra(#[rustc_splat] _t: impl std::marker::Tuple, _extra: u32) {} fn main() { // empty tuple