From d7029cbd7e25405ab815d12d55c3f496d48f6084 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Sun, 11 Oct 2020 16:47:45 +0100 Subject: [PATCH 1/5] `min_const_generics` diagnostics improvements 2 3 --- compiler/rustc_resolve/src/diagnostics.rs | 21 ++++++---------- compiler/rustc_resolve/src/lib.rs | 2 +- ...ay-size-in-generic-struct-param.min.stderr | 12 +++++----- .../array-size-in-generic-struct-param.rs | 4 ++-- .../const-argument-if-length.min.stderr | 6 ++--- .../const-argument-if-length.rs | 2 +- ...-gate-const_evaluatable_checked.min.stderr | 6 ++--- .../feature-gate-const_evaluatable_checked.rs | 2 +- .../simple.min.stderr | 12 +++++----- .../simple_fail.min.stderr | 6 ++--- .../const_evaluatable_checked/simple_fail.rs | 2 +- ...c-function-call-in-array-length.min.stderr | 12 +++++----- .../generic-function-call-in-array-length.rs | 4 ++-- .../generic-sum-in-array-length.min.stderr | 12 +++++----- .../generic-sum-in-array-length.rs | 4 ++-- ...ics-type_name-as-const-argument.min.stderr | 6 ++--- .../intrinsics-type_name-as-const-argument.rs | 2 +- .../issue-61522-array-len-succ.min.stderr | 12 +++++----- .../ui/const-generics/issue-67375.min.stderr | 6 ++--- src/test/ui/const-generics/issue-67375.rs | 2 +- .../const-generics/issue-67945-1.min.stderr | 12 +++++----- src/test/ui/const-generics/issue-67945-1.rs | 4 ++-- .../const-generics/issue-67945-2.min.stderr | 12 +++++----- src/test/ui/const-generics/issue-67945-2.rs | 4 ++-- .../issues/issue-61747.min.stderr | 6 ++--- .../issues/issue-61935.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-61935.rs | 2 +- .../issues/issue-62220.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-62220.rs | 2 +- .../issues/issue-62456.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-62456.rs | 2 +- .../issues/issue-64494.min.stderr | 12 +++++----- .../ui/const-generics/issues/issue-64494.rs | 4 ++-- .../issues/issue-66205.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-66205.rs | 2 +- .../issues/issue-67739.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-67739.rs | 2 +- .../issues/issue-68366.min.stderr | 6 ++--- .../ui/const-generics/issues/issue-68366.rs | 2 +- .../issues/issue-68977.min.stderr | 12 +++++----- .../ui/const-generics/issues/issue-68977.rs | 4 ++-- .../issues/issue-72787.min.stderr | 24 +++++++++---------- .../ui/const-generics/issues/issue-72787.rs | 8 +++---- ...sue-72819-generic-in-const-eval.min.stderr | 6 ++--- .../issue-72819-generic-in-const-eval.rs | 2 +- .../issue-76701-ty-param-in-const.min.stderr | 12 +++++----- .../issues/issue-76701-ty-param-in-const.rs | 4 ++-- .../min_const_generics/complex-expression.rs | 8 +++---- .../complex-expression.stderr | 24 +++++++++---------- .../self-ty-in-const-1.stderr | 6 ++--- ...ams-in-ct-in-ty-param-lazy-norm.min.stderr | 6 ++--- .../params-in-ct-in-ty-param-lazy-norm.rs | 2 +- src/test/ui/const-generics/wf-misc.min.stderr | 12 +++++----- src/test/ui/const-generics/wf-misc.rs | 4 ++-- 54 files changed, 182 insertions(+), 189 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index e3cf6d12bd5eb..83706e8a96f07 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -469,24 +469,17 @@ impl<'a> Resolver<'a> { ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => { let mut err = self.session.struct_span_err( span, - "generic parameters must not be used inside of non-trivial constant values", - ); - err.span_label( - span, - &format!( - "non-trivial anonymous constants must not depend on the parameter `{}`", - name - ), + "generic parameters must not be used inside const evaluations", ); + err.span_label(span, &format!("cannot perform const operation using `{}`", name)); if is_type { - err.note("type parameters are currently not permitted in anonymous constants"); + err.note("type parameters may not be used in anonymous constants"); } else { - err.help( - &format!("it is currently only allowed to use either `{0}` or `{{ {0} }}` as generic constants", - name - ) - ); + err.help(&format!( + "const parameters may only be used as standalone arguments `{}`", + name + )); } err diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index fe8f592638594..6677a5ffe2867 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -218,7 +218,7 @@ enum ResolutionError<'a> { ParamInTyOfConstParam(Symbol), /// constant values inside of type parameter defaults must not depend on generic parameters. ParamInAnonConstInTyDefault(Symbol), - /// generic parameters must not be used inside of non-trivial constant values. + /// generic parameters must not be used inside const evaluations. /// /// This error is only emitted when using `min_const_generics`. ParamInNonTrivialAnonConst { name: Symbol, is_type: bool }, 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 0fc45513cd78a..31073683870e9 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/array-size-in-generic-struct-param.rs:9:48 | LL | struct ArithArrayLen([u32; 0 + N]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/array-size-in-generic-struct-param.rs:20:15 | LL | arr: [u8; CFG.arr_size], - | ^^^ non-trivial anonymous constants must not depend on the parameter `CFG` + | ^^^ cannot perform const operation using `CFG` | - = help: it is currently only allowed to use either `CFG` or `{ CFG }` as generic constants + = help: const parameters may only be used as standalone arguments `CFG` 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/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index dd45b6ed278e8..84591c1b724c6 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -8,7 +8,7 @@ #[allow(dead_code)] struct ArithArrayLen([u32; 0 + N]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations #[derive(PartialEq, Eq)] struct Config { @@ -19,7 +19,7 @@ struct B { //[min]~^ ERROR `Config` is forbidden arr: [u8; CFG.arr_size], //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } const C: Config = Config { arr_size: 5 }; 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 c666dce479f65..60f860838139b 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/const-argument-if-length.rs:19:24 | LL | pad: [u8; is_zst::()], - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants 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-argument-if-length.rs b/src/test/ui/const-generics/const-argument-if-length.rs index 481ff97d68dbe..b8b49e100e6c9 100644 --- a/src/test/ui/const-generics/const-argument-if-length.rs +++ b/src/test/ui/const-generics/const-argument-if-length.rs @@ -17,7 +17,7 @@ pub struct AtLeastByte { value: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::()], - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR evaluation of constant value failed } 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 4b3235fd08783..93c92682c1216 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | LL | type Arr = [u8; N - 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs index d552e0f543080..3961b2568860f 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs @@ -4,7 +4,7 @@ #![cfg_attr(min, feature(min_const_generics))] type Arr = [u8; N - 1]; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations fn test() -> Arr where Arr: Default { //[full]~^ ERROR constant expression depends 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 85a15b1e75fdc..a9a5e7b8f4ac2 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple.rs:8:53 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple.rs:8:35 | LL | fn test() -> [u8; N - 1] where [u8; N - 1]: Default { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` 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 2eac9505624dd..903baf9cc0add 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/simple_fail.rs:7:33 | LL | type Arr = [u8; N - 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs index 637c940f71432..47330c624c7e4 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs @@ -5,7 +5,7 @@ #![allow(incomplete_features)] type Arr = [u8; N - 1]; //[full]~ ERROR evaluation of constant -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations fn test() -> Arr where Arr: Sized { todo!() 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 e7e968e4c2ad2..52262e33676fe 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-function-call-in-array-length.rs:9:39 | LL | fn bar() -> [u32; foo(N)] { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-function-call-in-array-length.rs:12:13 | LL | [0; foo(N)] - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/generic-function-call-in-array-length.rs index c8bbae29343dc..653ad84e10fc3 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.rs +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.rs @@ -7,10 +7,10 @@ const fn foo(n: usize) -> usize { n * 2 } fn bar() -> [u32; foo(N)] { - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR constant expression depends on a generic parameter [0; foo(N)] - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations } fn main() {} 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 6f157fbbbbb8a..611645b5eaac6 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-sum-in-array-length.rs:7:53 | LL | fn foo(bar: [usize; A + B]) {} - | ^ non-trivial anonymous constants must not depend on the parameter `A` + | ^ cannot perform const operation using `A` | - = help: it is currently only allowed to use either `A` or `{ A }` as generic constants + = help: const parameters may only be used as standalone arguments `A` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/generic-sum-in-array-length.rs:7:57 | LL | fn foo(bar: [usize; A + B]) {} - | ^ non-trivial anonymous constants must not depend on the parameter `B` + | ^ cannot perform const operation using `B` | - = help: it is currently only allowed to use either `B` or `{ B }` as generic constants + = help: const parameters may only be used as standalone arguments `B` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.rs b/src/test/ui/const-generics/generic-sum-in-array-length.rs index 810095b384baa..b7ba70863826c 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.rs +++ b/src/test/ui/const-generics/generic-sum-in-array-length.rs @@ -5,8 +5,8 @@ #![cfg_attr(min, feature(min_const_generics))] fn foo(bar: [usize; A + B]) {} -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values -//[min]~| ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~| ERROR generic parameters must not be used inside const evaluations //[full]~^^^ ERROR constant expression depends on a generic parameter fn main() {} 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 307db088bf892..e58d4c4d37e48 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/intrinsics-type_name-as-const-argument.rs:15:44 | LL | T: Trait<{std::intrinsics::type_name::()}> - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants 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/intrinsics-type_name-as-const-argument.rs b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs index 37b6cf4bab92b..833e8ef06dde0 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs @@ -13,7 +13,7 @@ trait Trait {} struct Bug where T: Trait<{std::intrinsics::type_name::()}> - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR constant expression depends on a generic parameter { t: T 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 2c1bc055b28ae..ac3488b2aff42 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61522-array-len-succ.rs:7:45 | LL | pub struct MyArray([u8; COUNT + 1]); - | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | ^^^^^ cannot perform const operation using `COUNT` | - = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + = help: const parameters may only be used as standalone arguments `COUNT` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61522-array-len-succ.rs:12:30 | LL | fn inner(&self) -> &[u8; COUNT + 1] { - | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | ^^^^^ cannot perform const operation using `COUNT` | - = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + = help: const parameters may only be used as standalone arguments `COUNT` 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 b13d9fdab0d96..405d83e7c7ee7 100644 --- a/src/test/ui/const-generics/issue-67375.min.stderr +++ b/src/test/ui/const-generics/issue-67375.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67375.rs:9:25 | LL | inner: [(); { [|_: &T| {}; 0].len() }], - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `T` is never used --> $DIR/issue-67375.rs:7:12 diff --git a/src/test/ui/const-generics/issue-67375.rs b/src/test/ui/const-generics/issue-67375.rs index 994ec92cfb501..78d3fcd89a73f 100644 --- a/src/test/ui/const-generics/issue-67375.rs +++ b/src/test/ui/const-generics/issue-67375.rs @@ -7,7 +7,7 @@ struct Bug { //~^ ERROR parameter `T` is never used inner: [(); { [|_: &T| {}; 0].len() }], - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ WARN cannot use constants which depend on generic parameters in types //[full]~^^^ WARN this was previously accepted by the compiler } 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 949b5da5920b1..1833a011c65df 100644 --- a/src/test/ui/const-generics/issue-67945-1.min.stderr +++ b/src/test/ui/const-generics/issue-67945-1.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-1.rs:14:16 | LL | let x: S = MaybeUninit::uninit(); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-1.rs:17:45 | LL | let b = &*(&x as *const _ as *const S); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `S` is never used --> $DIR/issue-67945-1.rs:11:12 diff --git a/src/test/ui/const-generics/issue-67945-1.rs b/src/test/ui/const-generics/issue-67945-1.rs index d1a83e978d1b8..a97c16373533c 100644 --- a/src/test/ui/const-generics/issue-67945-1.rs +++ b/src/test/ui/const-generics/issue-67945-1.rs @@ -12,10 +12,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations 0 }], } 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 ed445b3e8f790..dddc4f220fe30 100644 --- a/src/test/ui/const-generics/issue-67945-2.min.stderr +++ b/src/test/ui/const-generics/issue-67945-2.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-2.rs:12:16 | LL | let x: S = MaybeUninit::uninit(); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67945-2.rs:15:45 | LL | let b = &*(&x as *const _ as *const S); - | ^ non-trivial anonymous constants must not depend on the parameter `S` + | ^ cannot perform const operation using `S` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:9:12 diff --git a/src/test/ui/const-generics/issue-67945-2.rs b/src/test/ui/const-generics/issue-67945-2.rs index 7f789297df034..bc14a347b1c67 100644 --- a/src/test/ui/const-generics/issue-67945-2.rs +++ b/src/test/ui/const-generics/issue-67945-2.rs @@ -10,10 +10,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations 0 }], } 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 fdd9a569748e2..c1a4c67e84870 100644 --- a/src/test/ui/const-generics/issues/issue-61747.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61747.rs:8:30 | LL | fn successor() -> Const<{C + 1}> { - | ^ non-trivial anonymous constants must not depend on the parameter `C` + | ^ cannot perform const operation using `C` | - = help: it is currently only allowed to use either `C` or `{ C }` as generic constants + = help: const parameters may only be used as standalone arguments `C` 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 f461a31eeae3a..4802d6d8cc061 100644 --- a/src/test/ui/const-generics/issues/issue-61935.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-61935.rs:10:23 | LL | Self:FooImpl<{N==0}> - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.rs b/src/test/ui/const-generics/issues/issue-61935.rs index a181a8dabe5aa..5c0c4c2792b2e 100644 --- a/src/test/ui/const-generics/issues/issue-61935.rs +++ b/src/test/ui/const-generics/issues/issue-61935.rs @@ -9,7 +9,7 @@ impl Foo for [(); N] where Self:FooImpl<{N==0}> //[full]~^ERROR constant expression depends on a generic parameter -//[min]~^^ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ERROR generic parameters must not be used inside const evaluations {} trait FooImpl{} 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 84975e8f3be6b..2a890c1966a97 100644 --- a/src/test/ui/const-generics/issues/issue-62220.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62220.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-62220.rs:8:59 | LL | pub type TruncatedVector = Vector; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62220.rs b/src/test/ui/const-generics/issues/issue-62220.rs index 5694dc6d04da1..d25643ead38e9 100644 --- a/src/test/ui/const-generics/issues/issue-62220.rs +++ b/src/test/ui/const-generics/issues/issue-62220.rs @@ -6,7 +6,7 @@ pub struct Vector([T; N]); pub type TruncatedVector = Vector; -//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^ ERROR generic parameters must not be used inside const evaluations impl Vector { /// Drop the last component and return the vector with one fewer dimension. 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 f94ba8c0c9b87..2bf0d2130e776 100644 --- a/src/test/ui/const-generics/issues/issue-62456.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62456.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-62456.rs:7:20 | LL | let _ = [0u64; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62456.rs b/src/test/ui/const-generics/issues/issue-62456.rs index 338ec42799d17..53482a500bf69 100644 --- a/src/test/ui/const-generics/issues/issue-62456.rs +++ b/src/test/ui/const-generics/issues/issue-62456.rs @@ -6,7 +6,7 @@ fn foo() { let _ = [0u64; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} 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 f712171bbac61..900c4f0980df9 100644 --- a/src/test/ui/const-generics/issues/issue-64494.min.stderr +++ b/src/test/ui/const-generics/issues/issue-64494.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-64494.rs:16:38 | LL | impl MyTrait for T where Is<{T::VAL == 5}>: True {} - | ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T` + | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-64494.rs:19:38 | LL | impl MyTrait for T where Is<{T::VAL == 6}>: True {} - | ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T` + | ^^^^^^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error[E0119]: conflicting implementations of trait `MyTrait`: --> $DIR/issue-64494.rs:19:1 diff --git a/src/test/ui/const-generics/issues/issue-64494.rs b/src/test/ui/const-generics/issues/issue-64494.rs index b62ebf846d5b1..a822c79f51bbe 100644 --- a/src/test/ui/const-generics/issues/issue-64494.rs +++ b/src/test/ui/const-generics/issues/issue-64494.rs @@ -15,10 +15,10 @@ impl True for Is<{true}> {} impl MyTrait for T where Is<{T::VAL == 5}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations impl MyTrait for T where Is<{T::VAL == 6}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations //[min]~| ERROR conflicting implementations of trait `MyTrait` fn main() {} 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 a18126ccfef6d..691d9ca34426b 100644 --- a/src/test/ui/const-generics/issues/issue-66205.min.stderr +++ b/src/test/ui/const-generics/issues/issue-66205.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-66205.rs:8:14 | LL | fact::<{ N - 1 }>(); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-66205.rs b/src/test/ui/const-generics/issues/issue-66205.rs index 668f49852e1ef..e295fe3574ad3 100644 --- a/src/test/ui/const-generics/issues/issue-66205.rs +++ b/src/test/ui/const-generics/issues/issue-66205.rs @@ -7,7 +7,7 @@ fn fact() { fact::<{ N - 1 }>(); //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-67739.min.stderr b/src/test/ui/const-generics/issues/issue-67739.min.stderr index ba378de415654..03a936c2f0201 100644 --- a/src/test/ui/const-generics/issues/issue-67739.min.stderr +++ b/src/test/ui/const-generics/issues/issue-67739.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-67739.rs:12:30 | LL | [0u8; mem::size_of::()]; - | ^^^^^^^^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `Self` + | ^^^^^^^^^^^^^^^^ cannot perform const operation using `Self` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-67739.rs b/src/test/ui/const-generics/issues/issue-67739.rs index 296e4d423c48a..db64f4e40cc2a 100644 --- a/src/test/ui/const-generics/issues/issue-67739.rs +++ b/src/test/ui/const-generics/issues/issue-67739.rs @@ -11,7 +11,7 @@ pub trait Trait { fn associated_size(&self) -> usize { [0u8; mem::size_of::()]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations 0 } } 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 73d6fec6f9b56..b5bcedcb529bc 100644 --- a/src/test/ui/const-generics/issues/issue-68366.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68366.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68366.rs:12:37 | LL | impl Collatz<{Some(N)}> {} - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` 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-68366.rs b/src/test/ui/const-generics/issues/issue-68366.rs index ac313eb3b2ff3..b6f7171e3f320 100644 --- a/src/test/ui/const-generics/issues/issue-68366.rs +++ b/src/test/ui/const-generics/issues/issue-68366.rs @@ -11,7 +11,7 @@ struct Collatz>; impl Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters must not be used inside of non-trivial constant values +//[min]~^^ generic parameters must not be used inside const evaluations struct Foo; 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 59d2be3ce4b42..fa5cdb62a63cd 100644 --- a/src/test/ui/const-generics/issues/issue-68977.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68977.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68977.rs:29:17 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - | ^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `INT_BITS` + | ^^^^^^^^ cannot perform const operation using `INT_BITS` | - = help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants + = help: const parameters may only be used as standalone arguments `INT_BITS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-68977.rs:29:28 | LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - | ^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `FRAC_BITS` + | ^^^^^^^^^ cannot perform const operation using `FRAC_BITS` | - = help: it is currently only allowed to use either `FRAC_BITS` or `{ FRAC_BITS }` as generic constants + = help: const parameters may only be used as standalone arguments `FRAC_BITS` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-68977.rs b/src/test/ui/const-generics/issues/issue-68977.rs index 49b305a5a783f..d121d3382279f 100644 --- a/src/test/ui/const-generics/issues/issue-68977.rs +++ b/src/test/ui/const-generics/issues/issue-68977.rs @@ -27,8 +27,8 @@ fxp_storage_impls! { type FxpStorageHelper = PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values - //[min]~| ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~| ERROR generic parameters must not be used inside const evaluations struct Fxp where 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 a4c80b1d8c01e..68678259a3581 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:11:17 | LL | Condition<{ LHS <= RHS }>: True - | ^^^ non-trivial anonymous constants must not depend on the parameter `LHS` + | ^^^ cannot perform const operation using `LHS` | - = help: it is currently only allowed to use either `LHS` or `{ LHS }` as generic constants + = help: const parameters may only be used as standalone arguments `LHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:11:24 | LL | Condition<{ LHS <= RHS }>: True - | ^^^ non-trivial anonymous constants must not depend on the parameter `RHS` + | ^^^ cannot perform const operation using `RHS` | - = help: it is currently only allowed to use either `RHS` or `{ RHS }` as generic constants + = help: const parameters may only be used as standalone arguments `RHS` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:26:25 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ non-trivial anonymous constants must not depend on the parameter `I` + | ^ cannot perform const operation using `I` | - = help: it is currently only allowed to use either `I` or `{ I }` as generic constants + = help: const parameters may only be used as standalone arguments `I` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72787.rs:26:36 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ non-trivial anonymous constants must not depend on the parameter `J` + | ^ cannot perform const operation using `J` | - = help: it is currently only allowed to use either `J` or `{ J }` as generic constants + = help: const parameters may only be used as standalone arguments `J` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:22:26 diff --git a/src/test/ui/const-generics/issues/issue-72787.rs b/src/test/ui/const-generics/issues/issue-72787.rs index 779c1d2950e4d..76e10ed36d1f6 100644 --- a/src/test/ui/const-generics/issues/issue-72787.rs +++ b/src/test/ui/const-generics/issues/issue-72787.rs @@ -10,8 +10,8 @@ pub trait True {} impl True for IsLessOrEqual where Condition<{ LHS <= RHS }>: True //[full]~^ Error constant expression depends on a generic parameter -//[min]~^^ Error generic parameters must not be used inside of non-trivial constant values -//[min]~| Error generic parameters must not be used inside of non-trivial constant values +//[min]~^^ Error generic parameters must not be used inside const evaluations +//[min]~| Error generic parameters must not be used inside const evaluations { } impl True for Condition {} @@ -28,8 +28,8 @@ where //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter -//[min]~^^^^^ Error generic parameters must not be used inside of non-trivial constant values -//[min]~| Error generic parameters must not be used inside of non-trivial constant values +//[min]~^^^^^ Error generic parameters must not be used inside const evaluations +//[min]~| Error generic parameters must not be used inside const evaluations // Condition<{ 8 - I <= 8 - J }>: True, { fn print() { 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 afc14c7dcff57..41fe70c79b262 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-72819-generic-in-const-eval.rs:9:17 | LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs index 65c7f00a72ae5..7eaa8bbddc534 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs @@ -8,7 +8,7 @@ struct Arr where Assert::<{N < usize::max_value() / 2}>: IsTrue, //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values +//[min]~^^ ERROR generic parameters must not be used inside const evaluations { } 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 0db948d0a45db..fe683a3dfe311 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-76701-ty-param-in-const.rs:6:46 | LL | fn ty_param() -> [u8; std::mem::size_of::()] { - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 | LL | fn const_param() -> [u8; N + 1] { - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs index 3c5bfb03f0801..3d05813f63726 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs @@ -5,13 +5,13 @@ fn ty_param() -> [u8; std::mem::size_of::()] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations todo!() } fn const_param() -> [u8; N + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values + //[min]~^^ ERROR generic parameters must not be used inside const evaluations todo!() } diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index c6380f6394d01..3c9fd1ff47b29 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -7,19 +7,19 @@ fn ok() -> [u8; M] { } struct Break0([u8; { N + 1 }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters must not be used inside const evaluations struct Break1([u8; { { N } }]); -//~^ ERROR generic parameters must not be used inside of non-trivial constant values +//~^ ERROR generic parameters must not be used inside const evaluations fn break2() { let _: [u8; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ ERROR generic parameters must not be used inside const evaluations } fn break3() { let _ = [0; N + 1]; - //~^ ERROR generic parameters must not be used inside of non-trivial constant values + //~^ ERROR generic parameters must not be used inside const evaluations } trait Foo { 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 d8897f53d7f74..1282d7d7d620b 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 @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:9:38 | LL | struct Break0([u8; { N + 1 }]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:12:40 | LL | struct Break1([u8; { { N } }]); - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:16:17 | LL | let _: [u8; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/complex-expression.rs:21:17 | LL | let _ = [0; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 4 previous errors 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 7dc81bf45af9a..381c20125426b 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/self-ty-in-const-1.rs:4:41 | LL | fn t1() -> [u8; std::mem::size_of::()]; - | ^^^^ non-trivial anonymous constants must not depend on the parameter `Self` + | ^^^^ cannot perform const operation using `Self` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants 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 0dd591d891f2b..3bf3d41c88f8b 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 @@ -6,13 +6,13 @@ LL | struct Bar(T); | = note: using type defaults and const parameters in the same parameter list is currently not permitted -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo()]>(T, U); - | ^ non-trivial anonymous constants must not depend on the parameter `T` + | ^ cannot perform const operation using `T` | - = note: type parameters are currently not permitted in anonymous constants + = note: type parameters may not be used in anonymous constants 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/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index b9d74850f37d6..da37be6d87ae0 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -6,7 +6,7 @@ struct Foo()]>(T, U); //[full]~^ ERROR constant values inside of type parameter defaults -//[min]~^^ ERROR generic parameters must not be used inside of non-trivial +//[min]~^^ ERROR generic parameters must not be used inside const evaluations // FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. struct Bar(T); diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index 1c52d60174997..bd244a7d44d79 100644 --- a/src/test/ui/const-generics/wf-misc.min.stderr +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/wf-misc.rs:9:17 | LL | let _: [u8; N + 1]; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` -error: generic parameters must not be used inside of non-trivial constant values +error: generic parameters must not be used inside const evaluations --> $DIR/wf-misc.rs:17:21 | LL | let _: Const::<{N + 1}>; - | ^ non-trivial anonymous constants must not depend on the parameter `N` + | ^ cannot perform const operation using `N` | - = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + = help: const parameters may only be used as standalone arguments `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/wf-misc.rs b/src/test/ui/const-generics/wf-misc.rs index f8c41404c467b..8d68bf7765445 100644 --- a/src/test/ui/const-generics/wf-misc.rs +++ b/src/test/ui/const-generics/wf-misc.rs @@ -8,7 +8,7 @@ pub fn arr_len() { let _: [u8; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } struct Const; @@ -16,7 +16,7 @@ struct Const; pub fn func_call() { let _: Const::<{N + 1}>; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside of non-trivial + //[min]~^^ ERROR generic parameters must not be used inside const evaluations } fn main() {} From eec443681ef927d1c567c29401237f5c31f49aaf Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 07:18:29 -0500 Subject: [PATCH 2/5] Make error help clearer Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 83706e8a96f07..99773cd176426 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -477,7 +477,7 @@ impl<'a> Resolver<'a> { err.note("type parameters may not be used in anonymous constants"); } else { err.help(&format!( - "const parameters may only be used as standalone arguments `{}`", + "const parameters may only be used as standalone arguments, i.e. `{}`", name )); } From e62da8ff0b840f20107c17d1a1cd664b123e2b88 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 15:57:04 -0500 Subject: [PATCH 3/5] Remove a little jargon from error Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 99773cd176426..7e17f222a1589 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -474,7 +474,7 @@ impl<'a> Resolver<'a> { err.span_label(span, &format!("cannot perform const operation using `{}`", name)); if is_type { - err.note("type parameters may not be used in anonymous constants"); + err.note("type parameters may not be used in const expressions"); } else { err.help(&format!( "const parameters may only be used as standalone arguments, i.e. `{}`", From facb38d1dcdc7a311f96f965389a837829f8f8d6 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 15:58:06 -0500 Subject: [PATCH 4/5] A little rewording Co-authored-by: varkor --- compiler/rustc_resolve/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 7e17f222a1589..774a147c114ec 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -469,7 +469,7 @@ impl<'a> Resolver<'a> { ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => { let mut err = self.session.struct_span_err( span, - "generic parameters must not be used inside const evaluations", + "generic parameters may not be used in const operations", ); err.span_label(span, &format!("cannot perform const operation using `{}`", name)); From 79351b1d4a8e48c683cbd719171b53bbd1673a83 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Mon, 12 Oct 2020 22:27:59 +0100 Subject: [PATCH 5/5] Bless expected errors --- ...array-size-in-generic-struct-param.min.stderr | 8 ++++---- .../array-size-in-generic-struct-param.rs | 4 ++-- .../const-argument-if-length.min.stderr | 4 ++-- .../const-generics/const-argument-if-length.rs | 2 +- ...ure-gate-const_evaluatable_checked.min.stderr | 4 ++-- .../feature-gate-const_evaluatable_checked.rs | 2 +- .../const_evaluatable_checked/simple.min.stderr | 8 ++++---- .../simple_fail.min.stderr | 4 ++-- .../const_evaluatable_checked/simple_fail.rs | 2 +- ...eric-function-call-in-array-length.min.stderr | 8 ++++---- .../generic-function-call-in-array-length.rs | 4 ++-- .../generic-sum-in-array-length.min.stderr | 8 ++++---- .../generic-sum-in-array-length.rs | 4 ++-- ...insics-type_name-as-const-argument.min.stderr | 4 ++-- .../intrinsics-type_name-as-const-argument.rs | 2 +- .../issue-61522-array-len-succ.min.stderr | 8 ++++---- .../const-generics/issue-61522-array-len-succ.rs | 4 ++-- .../ui/const-generics/issue-67375.min.stderr | 4 ++-- src/test/ui/const-generics/issue-67375.rs | 2 +- .../ui/const-generics/issue-67945-1.min.stderr | 8 ++++---- src/test/ui/const-generics/issue-67945-1.rs | 4 ++-- .../ui/const-generics/issue-67945-2.min.stderr | 8 ++++---- src/test/ui/const-generics/issue-67945-2.rs | 4 ++-- .../const-generics/issues/issue-61747.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-61747.rs | 2 +- .../const-generics/issues/issue-61935.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-61935.rs | 2 +- .../const-generics/issues/issue-62220.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-62220.rs | 2 +- .../const-generics/issues/issue-62456.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-62456.rs | 2 +- .../const-generics/issues/issue-64494.min.stderr | 8 ++++---- src/test/ui/const-generics/issues/issue-64494.rs | 4 ++-- .../const-generics/issues/issue-66205.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-66205.rs | 2 +- .../const-generics/issues/issue-67739.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-67739.rs | 2 +- .../const-generics/issues/issue-68366.min.stderr | 4 ++-- src/test/ui/const-generics/issues/issue-68366.rs | 2 +- .../const-generics/issues/issue-68977.min.stderr | 8 ++++---- src/test/ui/const-generics/issues/issue-68977.rs | 4 ++-- .../const-generics/issues/issue-72787.min.stderr | 16 ++++++++-------- src/test/ui/const-generics/issues/issue-72787.rs | 8 ++++---- .../issue-72819-generic-in-const-eval.min.stderr | 4 ++-- .../issues/issue-72819-generic-in-const-eval.rs | 2 +- .../issue-76701-ty-param-in-const.min.stderr | 8 ++++---- .../issues/issue-76701-ty-param-in-const.rs | 4 ++-- .../min_const_generics/complex-expression.rs | 8 ++++---- .../min_const_generics/complex-expression.stderr | 16 ++++++++-------- .../min_const_generics/self-ty-in-const-1.stderr | 4 ++-- ...params-in-ct-in-ty-param-lazy-norm.min.stderr | 4 ++-- .../params-in-ct-in-ty-param-lazy-norm.rs | 2 +- src/test/ui/const-generics/wf-misc.min.stderr | 8 ++++---- src/test/ui/const-generics/wf-misc.rs | 4 ++-- 54 files changed, 132 insertions(+), 132 deletions(-) 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 31073683870e9..cfaacf7a5be33 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:9:48 | LL | struct ArithArrayLen([u32; 0 + N]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/array-size-in-generic-struct-param.rs:20:15 | LL | arr: [u8; CFG.arr_size], | ^^^ cannot perform const operation using `CFG` | - = help: const parameters may only be used as standalone arguments `CFG` + = help: const parameters may only be used as standalone arguments, i.e. `CFG` 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/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index 84591c1b724c6..768180d0813a9 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -8,7 +8,7 @@ #[allow(dead_code)] struct ArithArrayLen([u32; 0 + N]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations #[derive(PartialEq, Eq)] struct Config { @@ -19,7 +19,7 @@ struct B { //[min]~^ ERROR `Config` is forbidden arr: [u8; CFG.arr_size], //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } const C: Config = Config { arr_size: 5 }; 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 60f860838139b..bce701ade8651 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/const-argument-if-length.rs:19:24 | LL | pad: [u8; is_zst::()], | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in 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-argument-if-length.rs b/src/test/ui/const-generics/const-argument-if-length.rs index b8b49e100e6c9..a8bffd17b912c 100644 --- a/src/test/ui/const-generics/const-argument-if-length.rs +++ b/src/test/ui/const-generics/const-argument-if-length.rs @@ -17,7 +17,7 @@ pub struct AtLeastByte { value: T, //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::()], - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR evaluation of constant value failed } 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 93c92682c1216..359c2d2a22f02 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs index 3961b2568860f..9746adab29bf6 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs @@ -4,7 +4,7 @@ #![cfg_attr(min, feature(min_const_generics))] type Arr = [u8; N - 1]; -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations fn test() -> Arr where Arr: Default { //[full]~^ ERROR constant expression depends 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 a9a5e7b8f4ac2..46485262cc46e 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:53 | 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 `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple.rs:8:35 | 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 `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` 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 903baf9cc0add..981d993f58976 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/simple_fail.rs:7:33 | LL | type Arr = [u8; N - 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs index 47330c624c7e4..5e2c080927f86 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs @@ -5,7 +5,7 @@ #![allow(incomplete_features)] type Arr = [u8; N - 1]; //[full]~ ERROR evaluation of constant -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations fn test() -> Arr where Arr: Sized { todo!() 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 52262e33676fe..84449018e4609 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:9:39 | LL | fn bar() -> [u32; foo(N)] { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-function-call-in-array-length.rs:12:13 | LL | [0; foo(N)] | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/generic-function-call-in-array-length.rs index 653ad84e10fc3..c838070dc95af 100644 --- a/src/test/ui/const-generics/generic-function-call-in-array-length.rs +++ b/src/test/ui/const-generics/generic-function-call-in-array-length.rs @@ -7,10 +7,10 @@ const fn foo(n: usize) -> usize { n * 2 } fn bar() -> [u32; foo(N)] { - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR constant expression depends on a generic parameter [0; foo(N)] - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations } fn main() {} 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 611645b5eaac6..d3f7143327ead 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:53 | LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `A` | - = help: const parameters may only be used as standalone arguments `A` + = help: const parameters may only be used as standalone arguments, i.e. `A` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/generic-sum-in-array-length.rs:7:57 | LL | fn foo(bar: [usize; A + B]) {} | ^ cannot perform const operation using `B` | - = help: const parameters may only be used as standalone arguments `B` + = help: const parameters may only be used as standalone arguments, i.e. `B` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic-sum-in-array-length.rs b/src/test/ui/const-generics/generic-sum-in-array-length.rs index b7ba70863826c..84ddfe055dc3f 100644 --- a/src/test/ui/const-generics/generic-sum-in-array-length.rs +++ b/src/test/ui/const-generics/generic-sum-in-array-length.rs @@ -5,8 +5,8 @@ #![cfg_attr(min, feature(min_const_generics))] fn foo(bar: [usize; A + B]) {} -//[min]~^ ERROR generic parameters must not be used inside const evaluations -//[min]~| ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations +//[min]~| ERROR generic parameters may not be used in const operations //[full]~^^^ ERROR constant expression depends on a generic parameter fn main() {} 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 e58d4c4d37e48..20a8d9fdaab53 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/intrinsics-type_name-as-const-argument.rs:15:44 | LL | T: Trait<{std::intrinsics::type_name::()}> | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in 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/intrinsics-type_name-as-const-argument.rs b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs index 833e8ef06dde0..8971c00ed5a29 100644 --- a/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs +++ b/src/test/ui/const-generics/intrinsics-type_name-as-const-argument.rs @@ -13,7 +13,7 @@ trait Trait {} struct Bug where T: Trait<{std::intrinsics::type_name::()}> - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR constant expression depends on a generic parameter { t: T 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 ac3488b2aff42..526807f0a2474 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:7:45 | LL | pub struct MyArray([u8; COUNT + 1]); | ^^^^^ cannot perform const operation using `COUNT` | - = help: const parameters may only be used as standalone arguments `COUNT` + = help: const parameters may only be used as standalone arguments, i.e. `COUNT` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61522-array-len-succ.rs:12:30 | LL | fn inner(&self) -> &[u8; COUNT + 1] { | ^^^^^ cannot perform const operation using `COUNT` | - = help: const parameters may only be used as standalone arguments `COUNT` + = help: const parameters may only be used as standalone arguments, i.e. `COUNT` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.rs b/src/test/ui/const-generics/issue-61522-array-len-succ.rs index 81443b90d6156..8c0a3a0377468 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.rs +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.rs @@ -6,12 +6,12 @@ pub struct MyArray([u8; COUNT + 1]); //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used +//[min]~^^ ERROR generic parameters may not be used impl MyArray { fn inner(&self) -> &[u8; COUNT + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used + //[min]~^^ ERROR generic parameters may not be used &self.0 } } diff --git a/src/test/ui/const-generics/issue-67375.min.stderr b/src/test/ui/const-generics/issue-67375.min.stderr index 405d83e7c7ee7..3c344edbf1d15 100644 --- a/src/test/ui/const-generics/issue-67375.min.stderr +++ b/src/test/ui/const-generics/issue-67375.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67375.rs:9:25 | LL | inner: [(); { [|_: &T| {}; 0].len() }], | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0392]: parameter `T` is never used --> $DIR/issue-67375.rs:7:12 diff --git a/src/test/ui/const-generics/issue-67375.rs b/src/test/ui/const-generics/issue-67375.rs index 78d3fcd89a73f..ecc76bcae06c5 100644 --- a/src/test/ui/const-generics/issue-67375.rs +++ b/src/test/ui/const-generics/issue-67375.rs @@ -7,7 +7,7 @@ struct Bug { //~^ ERROR parameter `T` is never used inner: [(); { [|_: &T| {}; 0].len() }], - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ WARN cannot use constants which depend on generic parameters in types //[full]~^^^ WARN this was previously accepted by the compiler } 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 1833a011c65df..804236c30bd81 100644 --- a/src/test/ui/const-generics/issue-67945-1.min.stderr +++ b/src/test/ui/const-generics/issue-67945-1.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-1.rs:14:16 | LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-1.rs:17:45 | LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in 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-1.rs b/src/test/ui/const-generics/issue-67945-1.rs index a97c16373533c..6771603f2594b 100644 --- a/src/test/ui/const-generics/issue-67945-1.rs +++ b/src/test/ui/const-generics/issue-67945-1.rs @@ -12,10 +12,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations 0 }], } 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 dddc4f220fe30..2de942c1220cd 100644 --- a/src/test/ui/const-generics/issue-67945-2.min.stderr +++ b/src/test/ui/const-generics/issue-67945-2.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-2.rs:12:16 | LL | let x: S = MaybeUninit::uninit(); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67945-2.rs:15:45 | LL | let b = &*(&x as *const _ as *const S); | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:9:12 diff --git a/src/test/ui/const-generics/issue-67945-2.rs b/src/test/ui/const-generics/issue-67945-2.rs index bc14a347b1c67..72dbb674e66bd 100644 --- a/src/test/ui/const-generics/issue-67945-2.rs +++ b/src/test/ui/const-generics/issue-67945-2.rs @@ -10,10 +10,10 @@ struct Bug { //~^ ERROR parameter `S` is never used A: [(); { let x: S = MaybeUninit::uninit(); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations //[full]~^^ ERROR mismatched types let b = &*(&x as *const _ as *const S); - //[min]~^ ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations 0 }], } 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 c1a4c67e84870..b176f9d1c75aa 100644 --- a/src/test/ui/const-generics/issues/issue-61747.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61747.rs:8:30 | LL | fn successor() -> Const<{C + 1}> { | ^ cannot perform const operation using `C` | - = help: const parameters may only be used as standalone arguments `C` + = help: const parameters may only be used as standalone arguments, i.e. `C` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61747.rs b/src/test/ui/const-generics/issues/issue-61747.rs index 4e5cde17f39a9..3a4dd1cdd181d 100644 --- a/src/test/ui/const-generics/issues/issue-61747.rs +++ b/src/test/ui/const-generics/issues/issue-61747.rs @@ -7,7 +7,7 @@ struct Const; impl Const<{C}> { fn successor() -> Const<{C + 1}> { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used + //[min]~^^ ERROR generic parameters may not be used Const } } 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 4802d6d8cc061..9e31466259fd9 100644 --- a/src/test/ui/const-generics/issues/issue-61935.min.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-61935.rs:10:23 | LL | Self:FooImpl<{N==0}> | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61935.rs b/src/test/ui/const-generics/issues/issue-61935.rs index 5c0c4c2792b2e..9fa02329a7124 100644 --- a/src/test/ui/const-generics/issues/issue-61935.rs +++ b/src/test/ui/const-generics/issues/issue-61935.rs @@ -9,7 +9,7 @@ impl Foo for [(); N] where Self:FooImpl<{N==0}> //[full]~^ERROR constant expression depends on a generic parameter -//[min]~^^ERROR generic parameters must not be used inside const evaluations +//[min]~^^ERROR generic parameters may not be used in const operations {} trait FooImpl{} 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 2a890c1966a97..3bd127ee74a59 100644 --- a/src/test/ui/const-generics/issues/issue-62220.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62220.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-62220.rs:8:59 | LL | pub type TruncatedVector = Vector; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62220.rs b/src/test/ui/const-generics/issues/issue-62220.rs index d25643ead38e9..2017473fa9e24 100644 --- a/src/test/ui/const-generics/issues/issue-62220.rs +++ b/src/test/ui/const-generics/issues/issue-62220.rs @@ -6,7 +6,7 @@ pub struct Vector([T; N]); pub type TruncatedVector = Vector; -//[min]~^ ERROR generic parameters must not be used inside const evaluations +//[min]~^ ERROR generic parameters may not be used in const operations impl Vector { /// Drop the last component and return the vector with one fewer dimension. 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 2bf0d2130e776..c73f62a4a07d9 100644 --- a/src/test/ui/const-generics/issues/issue-62456.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62456.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-62456.rs:7:20 | LL | let _ = [0u64; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-62456.rs b/src/test/ui/const-generics/issues/issue-62456.rs index 53482a500bf69..cbb2a11a931ae 100644 --- a/src/test/ui/const-generics/issues/issue-62456.rs +++ b/src/test/ui/const-generics/issues/issue-62456.rs @@ -6,7 +6,7 @@ fn foo() { let _ = [0u64; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {} 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 900c4f0980df9..8b02fd108bd5b 100644 --- a/src/test/ui/const-generics/issues/issue-64494.min.stderr +++ b/src/test/ui/const-generics/issues/issue-64494.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:16:38 | 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 anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-64494.rs:19:38 | 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 anonymous constants + = note: type parameters may not be used in 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-64494.rs b/src/test/ui/const-generics/issues/issue-64494.rs index a822c79f51bbe..014742be03db6 100644 --- a/src/test/ui/const-generics/issues/issue-64494.rs +++ b/src/test/ui/const-generics/issues/issue-64494.rs @@ -15,10 +15,10 @@ impl True for Is<{true}> {} impl MyTrait for T where Is<{T::VAL == 5}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations impl MyTrait for T where Is<{T::VAL == 6}>: True {} //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations //[min]~| ERROR conflicting implementations of trait `MyTrait` fn main() {} 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 691d9ca34426b..282f72be6da6e 100644 --- a/src/test/ui/const-generics/issues/issue-66205.min.stderr +++ b/src/test/ui/const-generics/issues/issue-66205.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-66205.rs:8:14 | LL | fact::<{ N - 1 }>(); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-66205.rs b/src/test/ui/const-generics/issues/issue-66205.rs index e295fe3574ad3..4e37c247d008e 100644 --- a/src/test/ui/const-generics/issues/issue-66205.rs +++ b/src/test/ui/const-generics/issues/issue-66205.rs @@ -7,7 +7,7 @@ fn fact() { fact::<{ N - 1 }>(); //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-67739.min.stderr b/src/test/ui/const-generics/issues/issue-67739.min.stderr index 03a936c2f0201..35d97c4624811 100644 --- a/src/test/ui/const-generics/issues/issue-67739.min.stderr +++ b/src/test/ui/const-generics/issues/issue-67739.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-67739.rs:12:30 | LL | [0u8; mem::size_of::()]; | ^^^^^^^^^^^^^^^^ cannot perform const operation using `Self` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-67739.rs b/src/test/ui/const-generics/issues/issue-67739.rs index db64f4e40cc2a..21d13de22ebfc 100644 --- a/src/test/ui/const-generics/issues/issue-67739.rs +++ b/src/test/ui/const-generics/issues/issue-67739.rs @@ -11,7 +11,7 @@ pub trait Trait { fn associated_size(&self) -> usize { [0u8; mem::size_of::()]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations 0 } } 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 b5bcedcb529bc..b900a0d096ac2 100644 --- a/src/test/ui/const-generics/issues/issue-68366.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68366.min.stderr @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68366.rs:12:37 | LL | impl Collatz<{Some(N)}> {} | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` 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-68366.rs b/src/test/ui/const-generics/issues/issue-68366.rs index b6f7171e3f320..474cdb7258d96 100644 --- a/src/test/ui/const-generics/issues/issue-68366.rs +++ b/src/test/ui/const-generics/issues/issue-68366.rs @@ -11,7 +11,7 @@ struct Collatz>; impl Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters must not be used inside const evaluations +//[min]~^^ generic parameters may not be used in const operations struct Foo; 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 fa5cdb62a63cd..7828d85939497 100644 --- a/src/test/ui/const-generics/issues/issue-68977.min.stderr +++ b/src/test/ui/const-generics/issues/issue-68977.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68977.rs:29:17 | 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 `INT_BITS` + = help: const parameters may only be used as standalone arguments, i.e. `INT_BITS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-68977.rs:29:28 | 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 `FRAC_BITS` + = help: const parameters may only be used as standalone arguments, i.e. `FRAC_BITS` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-68977.rs b/src/test/ui/const-generics/issues/issue-68977.rs index d121d3382279f..4fea94cb4652b 100644 --- a/src/test/ui/const-generics/issues/issue-68977.rs +++ b/src/test/ui/const-generics/issues/issue-68977.rs @@ -27,8 +27,8 @@ fxp_storage_impls! { type FxpStorageHelper = PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; - //[min]~^ ERROR generic parameters must not be used inside const evaluations - //[min]~| ERROR generic parameters must not be used inside const evaluations + //[min]~^ ERROR generic parameters may not be used in const operations + //[min]~| ERROR generic parameters may not be used in const operations struct Fxp where 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 68678259a3581..d960d9513b752 100644 --- a/src/test/ui/const-generics/issues/issue-72787.min.stderr +++ b/src/test/ui/const-generics/issues/issue-72787.min.stderr @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:11:17 | LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `LHS` | - = help: const parameters may only be used as standalone arguments `LHS` + = help: const parameters may only be used as standalone arguments, i.e. `LHS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:11:24 | LL | Condition<{ LHS <= RHS }>: True | ^^^ cannot perform const operation using `RHS` | - = help: const parameters may only be used as standalone arguments `RHS` + = help: const parameters may only be used as standalone arguments, i.e. `RHS` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:25 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `I` | - = help: const parameters may only be used as standalone arguments `I` + = help: const parameters may only be used as standalone arguments, i.e. `I` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72787.rs:26:36 | LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, | ^ cannot perform const operation using `J` | - = help: const parameters may only be used as standalone arguments `J` + = help: const parameters may only be used as standalone arguments, i.e. `J` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:22:26 diff --git a/src/test/ui/const-generics/issues/issue-72787.rs b/src/test/ui/const-generics/issues/issue-72787.rs index 76e10ed36d1f6..57572e23aa4de 100644 --- a/src/test/ui/const-generics/issues/issue-72787.rs +++ b/src/test/ui/const-generics/issues/issue-72787.rs @@ -10,8 +10,8 @@ pub trait True {} impl True for IsLessOrEqual where Condition<{ LHS <= RHS }>: True //[full]~^ Error constant expression depends on a generic parameter -//[min]~^^ Error generic parameters must not be used inside const evaluations -//[min]~| Error generic parameters must not be used inside const evaluations +//[min]~^^ Error generic parameters may not be used in const operations +//[min]~| Error generic parameters may not be used in const operations { } impl True for Condition {} @@ -28,8 +28,8 @@ where //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter //[full]~| constant expression depends on a generic parameter -//[min]~^^^^^ Error generic parameters must not be used inside const evaluations -//[min]~| Error generic parameters must not be used inside const evaluations +//[min]~^^^^^ Error generic parameters may not be used in const operations +//[min]~| Error generic parameters may not be used in const operations // Condition<{ 8 - I <= 8 - J }>: True, { fn print() { 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 41fe70c79b262..9fec3eb946d83 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-72819-generic-in-const-eval.rs:9:17 | 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 `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs index 7eaa8bbddc534..6182042bde781 100644 --- a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs @@ -8,7 +8,7 @@ struct Arr where Assert::<{N < usize::max_value() / 2}>: IsTrue, //[full]~^ ERROR constant expression depends on a generic parameter -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations { } 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 fe683a3dfe311..c10db84ea6ecc 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 @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:6:46 | LL | fn ty_param() -> [u8; std::mem::size_of::()] { | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in const expressions -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/issue-76701-ty-param-in-const.rs:12:42 | LL | fn const_param() -> [u8; N + 1] { | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs index 3d05813f63726..9051c36fe81f4 100644 --- a/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs +++ b/src/test/ui/const-generics/issues/issue-76701-ty-param-in-const.rs @@ -5,13 +5,13 @@ fn ty_param() -> [u8; std::mem::size_of::()] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations todo!() } fn const_param() -> [u8; N + 1] { //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations todo!() } diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index 3c9fd1ff47b29..8257ffbf4915b 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -7,19 +7,19 @@ fn ok() -> [u8; M] { } struct Break0([u8; { N + 1 }]); -//~^ ERROR generic parameters must not be used inside const evaluations +//~^ ERROR generic parameters may not be used in const operations struct Break1([u8; { { N } }]); -//~^ ERROR generic parameters must not be used inside const evaluations +//~^ ERROR generic parameters may not be used in const operations fn break2() { let _: [u8; N + 1]; - //~^ ERROR generic parameters must not be used inside const evaluations + //~^ ERROR generic parameters may not be used in const operations } fn break3() { let _ = [0; N + 1]; - //~^ ERROR generic parameters must not be used inside const evaluations + //~^ ERROR generic parameters may not be used in const operations } trait Foo { 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 1282d7d7d620b..73768ac03a4b1 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 @@ -1,34 +1,34 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:9:38 | LL | struct Break0([u8; { N + 1 }]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:12:40 | LL | struct Break1([u8; { { N } }]); | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:16:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/complex-expression.rs:21:17 | LL | let _ = [0; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 4 previous errors 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 381c20125426b..64da5e07df2f4 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 @@ -1,10 +1,10 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/self-ty-in-const-1.rs:4:41 | LL | fn t1() -> [u8; std::mem::size_of::()]; | ^^^^ cannot perform const operation using `Self` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in 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 3bf3d41c88f8b..39aa8087cec50 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 @@ -6,13 +6,13 @@ LL | struct Bar(T); | = note: using type defaults and const parameters in the same parameter list is currently not permitted -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo()]>(T, U); | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in anonymous constants + = note: type parameters may not be used in 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/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index da37be6d87ae0..51f0cff3f215e 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -6,7 +6,7 @@ struct Foo()]>(T, U); //[full]~^ ERROR constant values inside of type parameter defaults -//[min]~^^ ERROR generic parameters must not be used inside const evaluations +//[min]~^^ ERROR generic parameters may not be used in const operations // FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. struct Bar(T); diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr index bd244a7d44d79..935f12dd2c304 100644 --- a/src/test/ui/const-generics/wf-misc.min.stderr +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -1,18 +1,18 @@ -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/wf-misc.rs:9:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` -error: generic parameters must not be used inside const evaluations +error: generic parameters may not be used in const operations --> $DIR/wf-misc.rs:17:21 | LL | let _: Const::<{N + 1}>; | ^ cannot perform const operation using `N` | - = help: const parameters may only be used as standalone arguments `N` + = help: const parameters may only be used as standalone arguments, i.e. `N` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/wf-misc.rs b/src/test/ui/const-generics/wf-misc.rs index 8d68bf7765445..103c580f28fc4 100644 --- a/src/test/ui/const-generics/wf-misc.rs +++ b/src/test/ui/const-generics/wf-misc.rs @@ -8,7 +8,7 @@ pub fn arr_len() { let _: [u8; N + 1]; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } struct Const; @@ -16,7 +16,7 @@ struct Const; pub fn func_call() { let _: Const::<{N + 1}>; //[full]~^ ERROR constant expression depends on a generic parameter - //[min]~^^ ERROR generic parameters must not be used inside const evaluations + //[min]~^^ ERROR generic parameters may not be used in const operations } fn main() {}