Skip to content

Commit ae7ce72

Browse files
committed
swap const arg and array repeat expression
1 parent 3d42053 commit ae7ce72

20 files changed

+37
-37
lines changed

compiler/rustc_resolve/src/late.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ impl IntoDiagArg for AnonConstKind {
9090
AnonConstKind::FieldDefaultValue => "field default value",
9191
AnonConstKind::InlineConst => "inline const",
9292
AnonConstKind::ConstArg(is_repeat_expr) => match is_repeat_expr {
93-
IsRepeatExpr::No => "array repeat expression",
94-
IsRepeatExpr::Yes => "const generic args",
93+
IsRepeatExpr::No => "const generic args",
94+
IsRepeatExpr::Yes => "array repeat expression",
9595
},
9696
}))
9797
}

tests/ui/const-generics/const-arg-in-const-arg.min.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error: generic parameters may not be used in const operations
1313
LL | let _: [u8; bar::<N>()];
1414
| ^ cannot perform const operation using `N`
1515
|
16-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
16+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
1717
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
1818

1919
error: generic parameters may not be used in const operations
@@ -58,7 +58,7 @@ error: generic parameters may not be used in const operations
5858
LL | let _ = [0; bar::<N>()];
5959
| ^ cannot perform const operation using `N`
6060
|
61-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
61+
= help: const parameters may only be used as standalone arguments in array repeat expression, i.e. `N`
6262
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
6363

6464
error: generic parameters may not be used in const operations
@@ -112,7 +112,7 @@ error: generic parameters may not be used in const operations
112112
LL | let _: Foo<{ bar::<N>() }>;
113113
| ^ cannot perform const operation using `N`
114114
|
115-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
115+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
116116
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
117117

118118
error: generic parameters may not be used in const operations
@@ -166,7 +166,7 @@ error: generic parameters may not be used in const operations
166166
LL | let _ = Foo::<{ bar::<N>() }>;
167167
| ^ cannot perform const operation using `N`
168168
|
169-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
169+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
170170
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
171171

172172
error: generic parameters may not be used in const operations

tests/ui/const-generics/defaults/complex-generic-default-expr.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: generic parameters may not be used in const operations
44
LL | struct Foo<const N: usize, const M: usize = { N + 1 }>;
55
| ^ cannot perform const operation using `N`
66
|
7-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
7+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations

tests/ui/const-generics/early/const_arg_trivial_macro_expansion-4.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | N
77
LL | fn foo<const N: usize>() -> Foo<{ arg!{} arg!{} }> { loop {} }
88
| ------ in this macro invocation
99
|
10-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
10+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
1111
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
1212
= note: this error originates in the macro `arg` (in Nightly builds, run with -Z macro-backtrace for more info)
1313

@@ -20,7 +20,7 @@ LL | N
2020
LL | fn foo<const N: usize>() -> Foo<{ arg!{} arg!{} }> { loop {} }
2121
| ------ in this macro invocation
2222
|
23-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
23+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
2424
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
2525
= note: this error originates in the macro `arg` (in Nightly builds, run with -Z macro-backtrace for more info)
2626

@@ -30,7 +30,7 @@ error: generic parameters may not be used in const operations
3030
LL | fn bar<const N: usize>() -> [(); { empty!{}; N }] { loop {} }
3131
| ^ cannot perform const operation using `N`
3232
|
33-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
33+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
3434
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
3535

3636
error: aborting due to 3 previous errors

tests/ui/const-generics/early/macro_rules-braces.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ error: generic parameters may not be used in const operations
2626
LL | let _: foo!({{ N }});
2727
| ^ cannot perform const operation using `N`
2828
|
29-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
29+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
3030
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
3131

3232
error: generic parameters may not be used in const operations
@@ -35,7 +35,7 @@ error: generic parameters may not be used in const operations
3535
LL | let _: bar!({ N });
3636
| ^ cannot perform const operation using `N`
3737
|
38-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
38+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
3939
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
4040

4141
error: generic parameters may not be used in const operations
@@ -44,7 +44,7 @@ error: generic parameters may not be used in const operations
4444
LL | let _: baz!({{ N }});
4545
| ^ cannot perform const operation using `N`
4646
|
47-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
47+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
4848
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
4949

5050
error: generic parameters may not be used in const operations
@@ -53,7 +53,7 @@ error: generic parameters may not be used in const operations
5353
LL | let _: biz!({ N });
5454
| ^ cannot perform const operation using `N`
5555
|
56-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
56+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
5757
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
5858

5959
error: aborting due to 6 previous errors

tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | N
77
LL | fn foo<const N: usize>() -> A<{{ y!() }}> {
88
| ---- in this macro invocation
99
|
10-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
10+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
1111
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
1212
= note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info)
1313

tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | { N }
77
LL | fn foo<const N: usize>() -> A<{ y!() }> {
88
| ---- in this macro invocation
99
|
10-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
10+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
1111
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
1212
= note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info)
1313

tests/ui/const-generics/early/trivial-const-arg-nested-braces.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: generic parameters may not be used in const operations
44
LL | fn foo<const N: usize>() -> A<{ { N } }> {
55
| ^ cannot perform const operation using `N`
66
|
7-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
7+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

1010
error: aborting due to 1 previous error

tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: generic parameters may not be used in const operations
44
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
55
| ^ cannot perform const operation using `N`
66
|
7-
= help: const parameters may only be used as standalone arguments here, i.e. `N`
7+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `N`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
@@ -13,7 +13,7 @@ error: generic parameters may not be used in const operations
1313
LL | arr: [u8; CFG.arr_size],
1414
| ^^^ cannot perform const operation using `CFG`
1515
|
16-
= help: const parameters may only be used as standalone arguments here, i.e. `CFG`
16+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `CFG`
1717
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
1818

1919
error: `Config` is forbidden as the type of a const generic parameter

tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: generic parameters may not be used in const operations
44
LL | SmallVec<{ D * 2 }>:,
55
| ^ cannot perform const operation using `D`
66
|
7-
= help: const parameters may only be used as standalone arguments here, i.e. `D`
7+
= help: const parameters may only be used as standalone arguments in const generic args, i.e. `D`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

1010
error[E0747]: constant provided when a type was expected

0 commit comments

Comments
 (0)