Skip to content

Commit 8802251

Browse files
Rollup merge of rust-lang#160244 - teor2345:extra-splat-renames, r=jieyouxu
Rename splat to rustc_splat in error messages Tracking issue: rust-lang#153629 This PR renames "splat attribute" to "\`rustc_splat\` attribute" in error messages (and some comments). It was meant to be part of rust-lang#159817 but I missed it. The search and replace command I used was: ```sh fastmod --extensions rs --fixed-strings 'splat attribute' '`rustc_splat` attribute' ``` This doesn't need to be backported, because those error messages only appear on nightly. Part of rust-lang#159428
2 parents ff16970 + 8fa1e60 commit 8802251

14 files changed

Lines changed: 46 additions & 42 deletions

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
751751
spans,
752752
// FIXME(splat): add a new error code before stabilization
753753
E0277,
754-
"cannot use splat attribute; the splatted argument type \
754+
"cannot use `rustc_splat` attribute; the splatted argument type \
755755
must be a tuple or unit, not a {:?} ({:?})",
756756
tuple_type.kind(),
757757
self.structurally_resolve_type(

tests/ui/splat/splat-async-fn-tuple-fail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![feature(splat)]
66

77
async fn async_wrong_type(#[rustc_splat] _x: u32) {}
8-
//~^ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32
8+
//~^ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a u32
99

1010
async fn async_multi_splat(
1111
#[rustc_splat] (_a, _b): (u32, i8),

tests/ui/splat/splat-async-fn-tuple-fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | #[rustc_splat] (_c, _d): (u32, i8),
99
|
1010
= help: remove `#[rustc_splat]` from all but one argument
1111

12-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32)
12+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a u32 (u32)
1313
--> $DIR/splat-async-fn-tuple-fail.rs:7:46
1414
|
1515
LL | async fn async_wrong_type(#[rustc_splat] _x: u32) {}

tests/ui/splat/splat-cannot-resolve.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ trait Trait {
2222

2323
fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
2424
//~^ ERROR ambiguous associated type
25-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
26-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
27-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
25+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
26+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
27+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
2828
fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
2929
//~^ ERROR ambiguous associated type
30-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
31-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
32-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
30+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
31+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
32+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
3333

3434
fn main() {
3535
tuple();

tests/ui/splat/splat-cannot-resolve.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ error[E0720]: cannot resolve opaque type
3434
LL | fn tuple_trait(#[rustc_splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple {
3535
| ^^^^^^^^^^^^^^^^^^^^^^^
3636

37-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
37+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
3838
--> $DIR/splat-cannot-resolve.rs:23:28
3939
|
4040
LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
@@ -43,7 +43,7 @@ LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
4343
LL | ambig();
4444
| ^^^^^^^
4545

46-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
46+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
4747
--> $DIR/splat-cannot-resolve.rs:28:32
4848
|
4949
LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
@@ -52,7 +52,7 @@ LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
5252
LL | ambig_tup();
5353
| ^^^^^^^^^^^
5454

55-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
55+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
5656
--> $DIR/splat-cannot-resolve.rs:23:28
5757
|
5858
LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
@@ -61,7 +61,7 @@ LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
6161
LL | ambig(1);
6262
| ^^^^^^^^
6363

64-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
64+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
6565
--> $DIR/splat-cannot-resolve.rs:28:32
6666
|
6767
LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
@@ -70,7 +70,7 @@ LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}
7070
LL | ambig_tup(1);
7171
| ^^^^^^^^^^^^
7272

73-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
73+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
7474
--> $DIR/splat-cannot-resolve.rs:23:28
7575
|
7676
LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
@@ -79,7 +79,7 @@ LL | fn ambig(#[rustc_splat] t: Trait::MaybeTup) {}
7979
LL | ambig(1, 2.0);
8080
| ^^^^^^^^^^^^^
8181

82-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
82+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error})
8383
--> $DIR/splat-cannot-resolve.rs:28:32
8484
|
8585
LL | fn ambig_tup(#[rustc_splat] t: Trait::Tup) {}

tests/ui/splat/splat-dyn-asref-tuple-fail.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
// FIXME(splat): Some errors are reported on the callee, but they would be more ergonomic on the
1111
// caller as well
1212
fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
13-
//~^ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
14-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
15-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
16-
//~| ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a
13+
//~^ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
14+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
15+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
16+
//~| ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a
1717
where
1818
T: std::marker::Tuple,
1919
{

tests/ui/splat/splat-dyn-asref-tuple-fail.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<std::string::String>)
1+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<std::string::String>)
22
--> $DIR/splat-dyn-asref-tuple-fail.rs:12:42
33
|
44
LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
@@ -22,7 +22,7 @@ LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
2222
LL | T: std::marker::Tuple,
2323
| ^^^^^^^^^^^^^^^^^^ required by this bound in `dyn_asref_splat`
2424

25-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>)
25+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>)
2626
--> $DIR/splat-dyn-asref-tuple-fail.rs:12:42
2727
|
2828
LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
@@ -31,7 +31,7 @@ LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
3131
LL | dyn_asref_splat(&s);
3232
| ^^^^^^^^^^^^^^^^^^^
3333

34-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<(u8, f32)>)
34+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<(u8, f32)>)
3535
--> $DIR/splat-dyn-asref-tuple-fail.rs:12:42
3636
|
3737
LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
@@ -40,7 +40,7 @@ LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)
4040
LL | dyn_asref_splat::<(u8, f32)>(&t);
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242

43-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>)
43+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<_>)
4444
--> $DIR/splat-dyn-asref-tuple-fail.rs:12:42
4545
|
4646
LL | fn dyn_asref_splat<T>(#[rustc_splat] _t: &dyn AsRef<T>)

tests/ui/splat/splat-maybe-tuple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![feature(splat)]
66
#![expect(unused)]
77

8-
fn unbound_generic_arg<T>(#[rustc_splat] t: T) {} //~ ERROR cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32
8+
fn unbound_generic_arg<T>(#[rustc_splat] t: T) {} //~ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a u32
99

1010
fn main() {
1111
unbound_generic_arg();

tests/ui/splat/splat-maybe-tuple.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a u32 (u32)
1+
error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a u32 (u32)
22
--> $DIR/splat-maybe-tuple.rs:8:45
33
|
44
LL | fn unbound_generic_arg<T>(#[rustc_splat] t: T) {}

tests/ui/splat/splat-non-tuple.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#![feature(splat)]
55
#![expect(unused)]
66

7-
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
7+
fn primitive_arg(#[rustc_splat] x: u32) {} //~ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a u32
88

99
enum NotATuple {
1010
A(u32),
1111
B(i8),
1212
}
1313

14-
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
14+
fn enum_arg(#[rustc_splat] y: NotATuple) {} //~ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a NotATuple
1515

1616
trait FooTrait {
1717
fn tuple_1(#[rustc_splat] _: (u32,)); //~ NOTE type in trait
@@ -22,11 +22,12 @@ trait FooTrait {
2222

2323
struct Foo;
2424

25-
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
25+
fn struct_arg(#[rustc_splat] z: Foo) {} //~ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a Foo
2626

2727
impl Foo {
28-
// FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple
2928
fn tuple_2_self(
29+
// FIXME(splat): ERROR cannot use `rustc_splat` attribute; the splatted argument type...
30+
// must be a tuple
3031
#[rustc_splat] self,
3132
(a, b): (u32, i8),
3233
) -> u32 {
@@ -41,8 +42,9 @@ impl FooTrait for Foo {
4142
//~| NOTE expected signature `fn(#[rustc_splat] (_,))`
4243
//~| NOTE found signature `fn((_,))`
4344

44-
// FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple
4545
fn tuple_4(
46+
// FIXME(splat): ERROR cannot use `rustc_splat` attribute; the splatted argument type...
47+
// must be a tuple
4648
#[rustc_splat] self,
4749
_: (u32, i8, (), f32),
4850
) {
@@ -51,11 +53,12 @@ impl FooTrait for Foo {
5153

5254
struct TupleStruct(u32, i8);
5355

54-
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
56+
fn tuple_struct_arg(#[rustc_splat] z: TupleStruct) {} //~ ERROR cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a TupleStruct
5557

5658
impl TupleStruct {
57-
// FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple
5859
fn tuple_2(
60+
// FIXME(splat): ERROR cannot use `rustc_splat` attribute; the splatted argument type...
61+
// must be a tuple
5962
#[rustc_splat] self,
6063
(a, b): (f32, f64),
6164
) -> f32 {
@@ -66,8 +69,9 @@ impl TupleStruct {
6669
impl FooTrait for TupleStruct {
6770
fn tuple_1(#[rustc_splat] _: (u32,)) {}
6871

69-
// FIXME(splat): ERROR cannot use splat attribute; the splatted argument type must be a tuple
7072
fn tuple_4(
73+
// FIXME(splat): ERROR cannot use `rustc_splat` attribute; the splatted argument type...
74+
// must be a tuple
7175
#[rustc_splat] self,
7276
_: (u32, i8, (), f32),
7377
) {

0 commit comments

Comments
 (0)