Skip to content

Commit af978e3

Browse files
committed
Requested changes
1 parent b7593e5 commit af978e3

30 files changed

+59
-41
lines changed

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ impl<'a> Resolver<'a> {
480480
"const parameters may only be used as standalone arguments, i.e. `{}`",
481481
name
482482
));
483-
err.note("use feature(const_generics) and feature(const_evaluatable_checked) to enable this");
484483
}
484+
err.note("use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions");
485485

486486
err
487487
}

src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
55
| ^ cannot perform const operation using `N`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
1111
--> $DIR/array-size-in-generic-struct-param.rs:20:15
@@ -14,7 +14,7 @@ LL | arr: [u8; CFG.arr_size],
1414
| ^^^ cannot perform const operation using `CFG`
1515
|
1616
= help: const parameters may only be used as standalone arguments, i.e. `CFG`
17-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
17+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
1818

1919
error: `Config` is forbidden as the type of a const generic parameter
2020
--> $DIR/array-size-in-generic-struct-param.rs:18:21

src/test/ui/const-generics/const-arg-in-const-arg.min.stderr

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | let _: [u8; foo::<T>()];
55
| ^ cannot perform const operation using `T`
66
|
77
= note: type parameters may not be used in const expressions
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
89

910
error: generic parameters may not be used in const operations
1011
--> $DIR/const-arg-in-const-arg.rs:15:23
@@ -13,7 +14,7 @@ LL | let _: [u8; bar::<N>()];
1314
| ^ cannot perform const operation using `N`
1415
|
1516
= help: const parameters may only be used as standalone arguments, i.e. `N`
16-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
17+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
1718

1819
error: generic parameters may not be used in const operations
1920
--> $DIR/const-arg-in-const-arg.rs:25:23
@@ -22,7 +23,7 @@ LL | let _ = [0; bar::<N>()];
2223
| ^ cannot perform const operation using `N`
2324
|
2425
= help: const parameters may only be used as standalone arguments, i.e. `N`
25-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
26+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
2627

2728
error: generic parameters may not be used in const operations
2829
--> $DIR/const-arg-in-const-arg.rs:30:24
@@ -31,6 +32,7 @@ LL | let _: Foo<{ foo::<T>() }>;
3132
| ^ cannot perform const operation using `T`
3233
|
3334
= note: type parameters may not be used in const expressions
35+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
3436

3537
error: generic parameters may not be used in const operations
3638
--> $DIR/const-arg-in-const-arg.rs:31:24
@@ -39,7 +41,7 @@ LL | let _: Foo<{ bar::<N>() }>;
3941
| ^ cannot perform const operation using `N`
4042
|
4143
= help: const parameters may only be used as standalone arguments, i.e. `N`
42-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
44+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
4345

4446
error: generic parameters may not be used in const operations
4547
--> $DIR/const-arg-in-const-arg.rs:36:27
@@ -48,6 +50,7 @@ LL | let _ = Foo::<{ foo::<T>() }>;
4850
| ^ cannot perform const operation using `T`
4951
|
5052
= note: type parameters may not be used in const expressions
53+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
5154

5255
error: generic parameters may not be used in const operations
5356
--> $DIR/const-arg-in-const-arg.rs:37:27
@@ -56,7 +59,7 @@ LL | let _ = Foo::<{ bar::<N>() }>;
5659
| ^ cannot perform const operation using `N`
5760
|
5861
= help: const parameters may only be used as standalone arguments, i.e. `N`
59-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
62+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
6063

6164
error[E0658]: a non-static lifetime is not allowed in a `const`
6265
--> $DIR/const-arg-in-const-arg.rs:16:23

src/test/ui/const-generics/const-argument-if-length.min.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | pad: [u8; is_zst::<T>()],
55
| ^ cannot perform const operation using `T`
66
|
77
= note: type parameters may not be used in const expressions
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
89

910
error[E0277]: the size for values of type `T` cannot be known at compilation time
1011
--> $DIR/const-argument-if-length.rs:17:12

src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Arr<const N: usize> = [u8; N - 1];
55
| ^ cannot perform const operation using `N`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: aborting due to previous error
1111

src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
55
| ^ cannot perform const operation using `N`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
1111
--> $DIR/simple.rs:8:35
@@ -14,7 +14,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
1414
| ^ cannot perform const operation using `N`
1515
|
1616
= help: const parameters may only be used as standalone arguments, i.e. `N`
17-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
17+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Arr<const N: usize> = [u8; N - 1];
55
| ^ cannot perform const operation using `N`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: aborting due to previous error
1111

src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn bar<const N: usize>() -> [u32; foo(N)] {
55
| ^ cannot perform const operation using `N`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
1111
--> $DIR/generic-function-call-in-array-length.rs:12:13
@@ -14,7 +14,7 @@ LL | [0; foo(N)]
1414
| ^ cannot perform const operation using `N`
1515
|
1616
= help: const parameters may only be used as standalone arguments, i.e. `N`
17-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
17+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/const-generics/generic-sum-in-array-length.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
55
| ^ cannot perform const operation using `A`
66
|
77
= help: const parameters may only be used as standalone arguments, i.e. `A`
8-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
99

1010
error: generic parameters may not be used in const operations
1111
--> $DIR/generic-sum-in-array-length.rs:7:57
@@ -14,7 +14,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
1414
| ^ cannot perform const operation using `B`
1515
|
1616
= help: const parameters may only be used as standalone arguments, i.e. `B`
17-
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
17+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | T: Trait<{std::intrinsics::type_name::<T>()}>
55
| ^ cannot perform const operation using `T`
66
|
77
= note: type parameters may not be used in const expressions
8+
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions
89

910
error: `&'static str` is forbidden as the type of a const generic parameter
1011
--> $DIR/intrinsics-type_name-as-const-argument.rs:10:22

0 commit comments

Comments
 (0)