From af978e3b63dce24e81a9ebecde08c9116f871a4e Mon Sep 17 00:00:00 2001 From: mendess Date: Tue, 24 Nov 2020 10:28:18 +0000 Subject: [PATCH] Requested changes --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- .../array-size-in-generic-struct-param.min.stderr | 4 ++-- .../const-generics/const-arg-in-const-arg.min.stderr | 11 +++++++---- .../const-argument-if-length.min.stderr | 1 + .../feature-gate-const_evaluatable_checked.min.stderr | 2 +- .../const_evaluatable_checked/simple.min.stderr | 4 ++-- .../const_evaluatable_checked/simple_fail.min.stderr | 2 +- .../generic-function-call-in-array-length.min.stderr | 4 ++-- .../generic-sum-in-array-length.min.stderr | 4 ++-- .../intrinsics-type_name-as-const-argument.min.stderr | 1 + .../issue-61522-array-len-succ.min.stderr | 4 ++-- src/test/ui/const-generics/issue-67375.min.stderr | 1 + src/test/ui/const-generics/issue-67945-1.min.stderr | 2 ++ src/test/ui/const-generics/issue-67945-2.min.stderr | 2 ++ .../ui/const-generics/issues/issue-61747.min.stderr | 2 +- .../ui/const-generics/issues/issue-61935.min.stderr | 2 +- .../ui/const-generics/issues/issue-62220.min.stderr | 2 +- .../ui/const-generics/issues/issue-62456.min.stderr | 2 +- .../ui/const-generics/issues/issue-64494.min.stderr | 2 ++ .../ui/const-generics/issues/issue-66205.min.stderr | 2 +- .../ui/const-generics/issues/issue-68366.min.stderr | 2 +- .../ui/const-generics/issues/issue-68977.min.stderr | 4 ++-- .../ui/const-generics/issues/issue-72787.min.stderr | 8 ++++---- .../issue-72819-generic-in-const-eval.min.stderr | 2 +- .../issues/issue-76701-ty-param-in-const.min.stderr | 3 ++- .../ui/const-generics/macro_rules-braces.min.stderr | 8 ++++---- .../min_const_generics/complex-expression.stderr | 11 +++++++---- .../min_const_generics/self-ty-in-const-1.stderr | 1 + .../params-in-ct-in-ty-param-lazy-norm.min.stderr | 1 + src/test/ui/const-generics/wf-misc.min.stderr | 4 ++-- 30 files changed, 59 insertions(+), 41 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 70ab59970d8a..9f3e8be0f7a3 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -480,8 +480,8 @@ impl<'a> Resolver<'a> { "const parameters may only be used as standalone arguments, i.e. `{}`", name )); - err.note("use feature(const_generics) and feature(const_evaluatable_checked) to enable this"); } + err.note("use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions"); err } diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr index ae3b593f9d31..59f458b35aac 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr @@ -5,7 +5,7 @@ LL | struct ArithArrayLen([u32; 0 + N]); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:20:15 @@ -14,7 +14,7 @@ LL | arr: [u8; CFG.arr_size], | ^^^ cannot perform const operation using `CFG` | = help: const parameters may only be used as standalone arguments, i.e. `CFG` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: `Config` is forbidden as the type of a const generic parameter --> $DIR/array-size-in-generic-struct-param.rs:18:21 diff --git a/src/test/ui/const-generics/const-arg-in-const-arg.min.stderr b/src/test/ui/const-generics/const-arg-in-const-arg.min.stderr index 9e3c07558f1d..136a4ddf7359 100644 --- a/src/test/ui/const-generics/const-arg-in-const-arg.min.stderr +++ b/src/test/ui/const-generics/const-arg-in-const-arg.min.stderr @@ -5,6 +5,7 @@ LL | let _: [u8; foo::()]; | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:15:23 @@ -13,7 +14,7 @@ LL | let _: [u8; bar::()]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:25:23 @@ -22,7 +23,7 @@ LL | let _ = [0; bar::()]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:30:24 @@ -31,6 +32,7 @@ LL | let _: Foo<{ foo::() }>; | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:31:24 @@ -39,7 +41,7 @@ LL | let _: Foo<{ bar::() }>; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:36:27 @@ -48,6 +50,7 @@ LL | let _ = Foo::<{ foo::() }>; | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:37:27 @@ -56,7 +59,7 @@ LL | let _ = Foo::<{ bar::() }>; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0658]: a non-static lifetime is not allowed in a `const` --> $DIR/const-arg-in-const-arg.rs:16:23 diff --git a/src/test/ui/const-generics/const-argument-if-length.min.stderr b/src/test/ui/const-generics/const-argument-if-length.min.stderr index bce701ade865..d85586ea0b79 100644 --- a/src/test/ui/const-generics/const-argument-if-length.min.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.min.stderr @@ -5,6 +5,7 @@ LL | pad: [u8; is_zst::()], | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/const-argument-if-length.rs:17:12 diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr index 8da75e953ff9..70b71c041f13 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr @@ -5,7 +5,7 @@ LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr index 91438ee1f65c..efee04598aba 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr @@ -5,7 +5,7 @@ LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:35 @@ -14,7 +14,7 @@ LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr index dd2164ee45a4..99e45fdece2b 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr @@ -5,7 +5,7 @@ LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr index 9d2524b60952..a42375289bcd 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.min.stderr @@ -5,7 +5,7 @@ LL | fn bar() -> [u32; foo(N)] { | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:12:13 @@ -14,7 +14,7 @@ LL | [0; foo(N)] | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr index 5a0e72524fb2..5b393351d5e8 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr +++ b/src/test/ui/const-generics/generic-sum-in-array-length.min.stderr @@ -5,7 +5,7 @@ LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `A` | = help: const parameters may only be used as standalone arguments, i.e. `A` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:57 @@ -14,7 +14,7 @@ LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `B` | = help: const parameters may only be used as standalone arguments, i.e. `B` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr index 20a8d9fdaab5..8f38a55b19b7 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr @@ -5,6 +5,7 @@ LL | T: Trait<{std::intrinsics::type_name::()}> | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: `&'static str` is forbidden as the type of a const generic parameter --> $DIR/intrinsics-type_name-as-const-argument.rs:10:22 diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr index 0ec673593d0b..94968a491384 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr @@ -5,7 +5,7 @@ LL | pub struct MyArray([u8; COUNT + 1]); | ^^^^^ cannot perform const operation using `COUNT` | = help: const parameters may only be used as standalone arguments, i.e. `COUNT` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:12:30 @@ -14,7 +14,7 @@ LL | fn inner(&self) -> &[u8; COUNT + 1] { | ^^^^^ cannot perform const operation using `COUNT` | = help: const parameters may only be used as standalone arguments, i.e. `COUNT` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issue-67375.min.stderr b/src/test/ui/const-generics/issue-67375.min.stderr index 3c344edbf1d1..f71618933b63 100644 --- a/src/test/ui/const-generics/issue-67375.min.stderr +++ b/src/test/ui/const-generics/issue-67375.min.stderr @@ -5,6 +5,7 @@ LL | inner: [(); { [|_: &T| {}; 0].len() }], | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0392]: parameter `T` is never used --> $DIR/issue-67375.rs:7:12 diff --git a/src/test/ui/const-generics/issue-67945-1.min.stderr b/src/test/ui/const-generics/issue-67945-1.min.stderr index 804236c30bd8..946f8ca1abcd 100644 --- a/src/test/ui/const-generics/issue-67945-1.min.stderr +++ b/src/test/ui/const-generics/issue-67945-1.min.stderr @@ -5,6 +5,7 @@ LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-67945-1.rs:17:45 @@ -13,6 +14,7 @@ LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0392]: parameter `S` is never used --> $DIR/issue-67945-1.rs:11:12 diff --git a/src/test/ui/const-generics/issue-67945-2.min.stderr b/src/test/ui/const-generics/issue-67945-2.min.stderr index 2de942c1220c..8e189f0c196b 100644 --- a/src/test/ui/const-generics/issue-67945-2.min.stderr +++ b/src/test/ui/const-generics/issue-67945-2.min.stderr @@ -5,6 +5,7 @@ LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-67945-2.rs:15:45 @@ -13,6 +14,7 @@ LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:9:12 diff --git a/src/test/ui/const-generics/issues/issue-61747.min.stderr b/src/test/ui/const-generics/issues/issue-61747.min.stderr index 1e4fdd885ec8..cb14813d8cac 100644 --- a/src/test/ui/const-generics/issues/issue-61747.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.min.stderr @@ -5,7 +5,7 @@ LL | fn successor() -> Const<{C + 1}> { | ^ cannot perform const operation using `C` | = help: const parameters may only be used as standalone arguments, i.e. `C` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.min.stderr b/src/test/ui/const-generics/issues/issue-61935.min.stderr index cf1ff180935e..91055949d8c0 100644 --- a/src/test/ui/const-generics/issues/issue-61935.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.min.stderr @@ -5,7 +5,7 @@ LL | Self:FooImpl<{N==0}> | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62220.min.stderr b/src/test/ui/const-generics/issues/issue-62220.min.stderr index dd8fbfebd2f6..6d49a4dc6edb 100644 --- a/src/test/ui/const-generics/issues/issue-62220.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62220.min.stderr @@ -5,7 +5,7 @@ LL | pub type TruncatedVector = Vector; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62456.min.stderr b/src/test/ui/const-generics/issues/issue-62456.min.stderr index ac11191b119c..a26f2a6bf027 100644 --- a/src/test/ui/const-generics/issues/issue-62456.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62456.min.stderr @@ -5,7 +5,7 @@ LL | let _ = [0u64; N + 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-64494.min.stderr b/src/test/ui/const-generics/issues/issue-64494.min.stderr index 8b02fd108bd5..ded781cab45a 100644 --- a/src/test/ui/const-generics/issues/issue-64494.min.stderr +++ b/src/test/ui/const-generics/issues/issue-64494.min.stderr @@ -5,6 +5,7 @@ LL | impl MyTrait for T where Is<{T::VAL == 5}>: True {} | ^^^^^^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:19:38 @@ -13,6 +14,7 @@ LL | impl MyTrait for T where Is<{T::VAL == 6}>: True {} | ^^^^^^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0119]: conflicting implementations of trait `MyTrait`: --> $DIR/issue-64494.rs:19:1 diff --git a/src/test/ui/const-generics/issues/issue-66205.min.stderr b/src/test/ui/const-generics/issues/issue-66205.min.stderr index f3e3eb6c5a65..e3a6b7a5ab2e 100644 --- a/src/test/ui/const-generics/issues/issue-66205.min.stderr +++ b/src/test/ui/const-generics/issues/issue-66205.min.stderr @@ -5,7 +5,7 @@ LL | fact::<{ N - 1 }>(); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-68366.min.stderr b/src/test/ui/const-generics/issues/issue-68366.min.stderr index 7dcb3ea1acb0..85ceace45d6e 100644 --- a/src/test/ui/const-generics/issues/issue-68366.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68366.min.stderr @@ -5,7 +5,7 @@ LL | impl Collatz<{Some(N)}> {} | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-68366.rs:12:13 diff --git a/src/test/ui/const-generics/issues/issue-68977.min.stderr b/src/test/ui/const-generics/issues/issue-68977.min.stderr index 67ca519de2c2..133f68d16fdc 100644 --- a/src/test/ui/const-generics/issues/issue-68977.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68977.min.stderr @@ -5,7 +5,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; | ^^^^^^^^ cannot perform const operation using `INT_BITS` | = help: const parameters may only be used as standalone arguments, i.e. `INT_BITS` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-68977.rs:29:28 @@ -14,7 +14,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; | ^^^^^^^^^ cannot perform const operation using `FRAC_BITS` | = help: const parameters may only be used as standalone arguments, i.e. `FRAC_BITS` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-72787.min.stderr b/src/test/ui/const-generics/issues/issue-72787.min.stderr index 2a7672d0c892..2feeafc778a0 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -5,7 +5,7 @@ LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `LHS` | = help: const parameters may only be used as standalone arguments, i.e. `LHS` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:11:24 @@ -14,7 +14,7 @@ LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `RHS` | = help: const parameters may only be used as standalone arguments, i.e. `RHS` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:25 @@ -23,7 +23,7 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `I` | = help: const parameters may only be used as standalone arguments, i.e. `I` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:36 @@ -32,7 +32,7 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `J` | = help: const parameters may only be used as standalone arguments, i.e. `J` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error[E0283]: type annotations needed --> $DIR/issue-72787.rs:22:26 diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr index f7c4109e5529..ada74ecd6f23 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.min.stderr @@ -5,7 +5,7 @@ LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr index 57514736121c..5fb2768e8f0e 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.min.stderr @@ -5,6 +5,7 @@ LL | fn ty_param() -> [u8; std::mem::size_of::()] { | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 @@ -13,7 +14,7 @@ LL | fn const_param() -> [u8; N + 1] { | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/macro_rules-braces.min.stderr b/src/test/ui/const-generics/macro_rules-braces.min.stderr index b23053756d14..c7f3ddcfe9e3 100644 --- a/src/test/ui/const-generics/macro_rules-braces.min.stderr +++ b/src/test/ui/const-generics/macro_rules-braces.min.stderr @@ -27,7 +27,7 @@ LL | let _: foo!({{ N }}); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/macro_rules-braces.rs:41:19 @@ -36,7 +36,7 @@ LL | let _: bar!({ N }); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/macro_rules-braces.rs:46:20 @@ -45,7 +45,7 @@ LL | let _: baz!({{ N }}); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/macro_rules-braces.rs:51:19 @@ -54,7 +54,7 @@ LL | let _: biz!({ N }); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr index d8debd2b9304..54448c68529e 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr @@ -5,7 +5,7 @@ LL | struct Break0([u8; { N + 1 }]); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:14:40 @@ -14,7 +14,7 @@ LL | struct Break1([u8; { { N } }]); | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:18:17 @@ -23,7 +23,7 @@ LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:23:17 @@ -32,7 +32,7 @@ LL | let _ = [0; N + 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:27:45 @@ -41,6 +41,7 @@ LL | struct BreakTy0(T, [u8; { size_of::<*mut T>() }]); | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:30:47 @@ -49,6 +50,7 @@ LL | struct BreakTy1(T, [u8; { { size_of::<*mut T>() } }]); | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:34:32 @@ -57,6 +59,7 @@ LL | let _: [u8; size_of::<*mut T>() + 1]; | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions warning: cannot use constants which depend on generic parameters in types --> $DIR/complex-expression.rs:39:17 diff --git a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr index 64da5e07df2f..c52d9552b900 100644 --- a/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr +++ b/src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.stderr @@ -5,6 +5,7 @@ LL | fn t1() -> [u8; std::mem::size_of::()]; | ^^^^ cannot perform const operation using `Self` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic `Self` types are currently not permitted in anonymous constants --> $DIR/self-ty-in-const-1.rs:14:41 diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr index 39aa8087cec5..bfe748855d70 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr @@ -13,6 +13,7 @@ LL | struct Foo()]>(T, U); | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: constant values inside of type parameter defaults must not depend on generic parameters --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:21 diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index 296b1c15cf01..8b1cf944856d 100644 --- a/src/test/ui/const-generics/wf-misc.min.stderr +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -5,7 +5,7 @@ LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: generic parameters may not be used in const operations --> $DIR/wf-misc.rs:17:21 @@ -14,7 +14,7 @@ LL | let _: Const::<{N + 1}>; | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` - = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this + = note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions error: aborting due to 2 previous errors