Replace "non trivial" with "non-trivial"
This commit is contained in:
parent
1db05e032d
commit
488b759d5c
@ -581,7 +581,7 @@ declare_features! (
|
||||
/// Allows `if let` guard in match arms.
|
||||
(active, if_let_guard, "1.47.0", Some(51114), None),
|
||||
|
||||
/// Allows non trivial generic constants which have to be manually propageted upwards.
|
||||
/// Allows non-trivial generic constants which have to be manually propageted upwards.
|
||||
(active, const_evaluatable_checked, "1.48.0", Some(76560), None),
|
||||
|
||||
/// Allows basic arithmetic on floating point types in a `const fn`.
|
||||
|
@ -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 of non trivial constant values",
|
||||
"generic parameters must not be used inside of non-trivial constant values",
|
||||
);
|
||||
err.span_label(
|
||||
span,
|
||||
|
@ -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 of non-trivial constant values.
|
||||
///
|
||||
/// This error is only emitted when using `min_const_generics`.
|
||||
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/array-size-in-generic-struct-param.rs:9:48
|
||||
|
|
||||
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
|
||||
@ -6,7 +6,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/array-size-in-generic-struct-param.rs:20:15
|
||||
|
|
||||
LL | arr: [u8; CFG.arr_size],
|
||||
|
@ -8,7 +8,7 @@
|
||||
#[allow(dead_code)]
|
||||
struct ArithArrayLen<const N: usize>([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 of non-trivial constant values
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
struct Config {
|
||||
@ -19,7 +19,7 @@ struct B<const CFG: Config> {
|
||||
//[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 of non-trivial
|
||||
}
|
||||
|
||||
const C: Config = Config { arr_size: 5 };
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:33
|
||||
|
|
||||
LL | type Arr<const N: usize> = [u8; N - 1];
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![cfg_attr(min, feature(min_const_generics))]
|
||||
|
||||
type Arr<const N: usize> = [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 of non-trivial constant values
|
||||
|
||||
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
|
||||
//[full]~^ ERROR constant expression depends
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/simple.rs:8:53
|
||||
|
|
||||
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
|
||||
@ -6,7 +6,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/simple.rs:8:35
|
||||
|
|
||||
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/simple_fail.rs:7:33
|
||||
|
|
||||
LL | type Arr<const N: usize> = [u8; N - 1];
|
||||
|
@ -5,7 +5,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
type Arr<const N: usize> = [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 of non-trivial constant values
|
||||
|
||||
fn test<const N: usize>() -> Arr<N> where Arr<N>: Sized {
|
||||
todo!()
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-61522-array-len-succ.rs:7:45
|
||||
|
|
||||
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
|
||||
@ -6,7 +6,7 @@ LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
|
||||
|
|
||||
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-61522-array-len-succ.rs:12:30
|
||||
|
|
||||
LL | fn inner(&self) -> &[u8; COUNT + 1] {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-61747.rs:8:30
|
||||
|
|
||||
LL | fn successor() -> Const<{C + 1}> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-61935.rs:10:23
|
||||
|
|
||||
LL | Self:FooImpl<{N==0}>
|
||||
|
@ -9,7 +9,7 @@ impl<const N: usize> 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 of non-trivial constant values
|
||||
{}
|
||||
|
||||
trait FooImpl<const IS_ZERO: bool>{}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-62220.rs:8:59
|
||||
|
|
||||
LL | pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;
|
||||
|
@ -6,7 +6,7 @@
|
||||
pub struct Vector<T, const N: usize>([T; N]);
|
||||
|
||||
pub type TruncatedVector<T, const N: usize> = Vector<T, { 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 of non-trivial constant values
|
||||
|
||||
impl<T, const N: usize> Vector<T, { N }> {
|
||||
/// Drop the last component and return the vector with one fewer dimension.
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-62456.rs:7:20
|
||||
|
|
||||
LL | let _ = [0u64; N + 1];
|
||||
|
@ -6,7 +6,7 @@
|
||||
fn foo<const N: usize>() {
|
||||
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 of non-trivial constant values
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-64494.rs:16:38
|
||||
|
|
||||
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
|
||||
@ -6,7 +6,7 @@ LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
|
||||
|
|
||||
= note: type parameters are currently not permitted in anonymous constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-64494.rs:19:38
|
||||
|
|
||||
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
|
||||
|
@ -15,10 +15,10 @@ impl True for Is<{true}> {}
|
||||
|
||||
impl<T: Foo> 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 of non-trivial constant values
|
||||
impl<T: Foo> 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 of non-trivial constant values
|
||||
//[min]~| ERROR conflicting implementations of trait `MyTrait`
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-66205.rs:8:14
|
||||
|
|
||||
LL | fact::<{ N - 1 }>();
|
||||
|
@ -7,7 +7,7 @@
|
||||
fn fact<const N: usize>() {
|
||||
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 of non-trivial constant values
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67739.rs:12:30
|
||||
|
|
||||
LL | [0u8; mem::size_of::<Self::Associated>()];
|
||||
|
@ -11,7 +11,7 @@ pub trait Trait {
|
||||
fn associated_size(&self) -> usize {
|
||||
[0u8; mem::size_of::<Self::Associated>()];
|
||||
//[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
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-68366.rs:12:37
|
||||
|
|
||||
LL | impl <const N: usize> Collatz<{Some(N)}> {}
|
||||
|
@ -11,7 +11,7 @@ struct Collatz<const N: Option<usize>>;
|
||||
|
||||
impl <const N: usize> 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 of non-trivial constant values
|
||||
|
||||
struct Foo;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-68977.rs:29:17
|
||||
|
|
||||
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
|
||||
@ -6,7 +6,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
|
||||
|
|
||||
= help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-68977.rs:29:28
|
||||
|
|
||||
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
|
||||
|
@ -27,8 +27,8 @@ fxp_storage_impls! {
|
||||
|
||||
type FxpStorageHelper<const INT_BITS: u8, const FRAC_BITS: u8> =
|
||||
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 of non-trivial constant values
|
||||
//[min]~| ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
|
||||
struct Fxp<const INT_BITS: u8, const FRAC_BITS: u8>
|
||||
where
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-72787.rs:11:17
|
||||
|
|
||||
LL | Condition<{ LHS <= RHS }>: True
|
||||
@ -6,7 +6,7 @@ LL | Condition<{ LHS <= RHS }>: True
|
||||
|
|
||||
= help: it is currently only allowed to use either `LHS` or `{ LHS }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-72787.rs:11:24
|
||||
|
|
||||
LL | Condition<{ LHS <= RHS }>: True
|
||||
@ -14,7 +14,7 @@ LL | Condition<{ LHS <= RHS }>: True
|
||||
|
|
||||
= help: it is currently only allowed to use either `RHS` or `{ RHS }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-72787.rs:26:25
|
||||
|
|
||||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
|
||||
@ -22,7 +22,7 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
|
||||
|
|
||||
= help: it is currently only allowed to use either `I` or `{ I }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-72787.rs:26:36
|
||||
|
|
||||
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
|
||||
|
@ -10,8 +10,8 @@ pub trait True {}
|
||||
impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> 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 of non-trivial constant values
|
||||
//[min]~| Error generic parameters must not be used inside of non-trivial constant values
|
||||
{
|
||||
}
|
||||
impl True for Condition<true> {}
|
||||
@ -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 of non-trivial constant values
|
||||
//[min]~| Error generic parameters must not be used inside of non-trivial constant values
|
||||
// Condition<{ 8 - I <= 8 - J }>: True,
|
||||
{
|
||||
fn print() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-72819-generic-in-const-eval.rs:9:17
|
||||
|
|
||||
LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
|
||||
|
@ -8,7 +8,7 @@
|
||||
struct Arr<const N: usize>
|
||||
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 of non-trivial constant values
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-76701-ty-param-in-const.rs:6:46
|
||||
|
|
||||
LL | fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
|
||||
@ -6,7 +6,7 @@ LL | fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
|
||||
|
|
||||
= note: type parameters are currently not permitted in anonymous constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-76701-ty-param-in-const.rs:12:42
|
||||
|
|
||||
LL | fn const_param<const N: usize>() -> [u8; N + 1] {
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
|
||||
//[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
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn const_param<const N: usize>() -> [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 of non-trivial constant values
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,19 @@ fn ok<const M: usize>() -> [u8; M] {
|
||||
}
|
||||
|
||||
struct Break0<const N: usize>([u8; { N + 1 }]);
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
|
||||
struct Break1<const N: usize>([u8; { { N } }]);
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
|
||||
fn break2<const N: usize>() {
|
||||
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 of non-trivial constant values
|
||||
}
|
||||
|
||||
fn break3<const N: usize>() {
|
||||
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 of non-trivial constant values
|
||||
}
|
||||
|
||||
trait Foo {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/complex-expression.rs:9:38
|
||||
|
|
||||
LL | struct Break0<const N: usize>([u8; { N + 1 }]);
|
||||
@ -6,7 +6,7 @@ LL | struct Break0<const N: usize>([u8; { N + 1 }]);
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/complex-expression.rs:12:40
|
||||
|
|
||||
LL | struct Break1<const N: usize>([u8; { { N } }]);
|
||||
@ -14,7 +14,7 @@ LL | struct Break1<const N: usize>([u8; { { N } }]);
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/complex-expression.rs:16:17
|
||||
|
|
||||
LL | let _: [u8; N + 1];
|
||||
@ -22,7 +22,7 @@ LL | let _: [u8; N + 1];
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/complex-expression.rs:21:17
|
||||
|
|
||||
LL | let _ = [0; N + 1];
|
||||
|
@ -12,7 +12,7 @@ pub struct AtLeastByte<T: ?Sized> {
|
||||
value: T,
|
||||
//~^ ERROR the size for values of type `T` cannot be known at compilation time
|
||||
pad: [u8; is_zst::<T>()],
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/const-argument-if-length.rs:14:24
|
||||
|
|
||||
LL | pad: [u8; is_zst::<T>()],
|
||||
|
@ -3,9 +3,9 @@
|
||||
const fn foo(n: usize) -> usize { n * 2 }
|
||||
|
||||
fn bar<const N: usize>() -> [u32; foo(N)] {
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
[0; foo(N)]
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![feature(min_const_generics)]
|
||||
|
||||
fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~| ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
//~| ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/generic-sum-in-array-length.rs:3:53
|
||||
|
|
||||
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
|
||||
@ -6,7 +6,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
|
||||
|
|
||||
= help: it is currently only allowed to use either `A` or `{ A }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/generic-sum-in-array-length.rs:3:57
|
||||
|
|
||||
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
|
||||
|
@ -7,7 +7,7 @@ trait Trait<const S: &'static str> {}
|
||||
struct Bug<T>
|
||||
where
|
||||
T: Trait<{std::intrinsics::type_name::<T>()}>
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
{
|
||||
t: T
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/intrinsics-type_name-as-const-argument.rs:9:44
|
||||
|
|
||||
LL | T: Trait<{std::intrinsics::type_name::<T>()}>
|
||||
|
@ -3,7 +3,7 @@
|
||||
struct Bug<T> {
|
||||
//~^ ERROR parameter `T` is never used
|
||||
inner: [(); { [|_: &T| {}; 0].len() }],
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67375.rs:5:25
|
||||
|
|
||||
LL | inner: [(); { [|_: &T| {}; 0].len() }],
|
||||
|
@ -8,9 +8,9 @@ struct Bug<S> {
|
||||
//~^ ERROR parameter `S` is never used
|
||||
A: [(); {
|
||||
let x: S = MaybeUninit::uninit();
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
let b = &*(&x as *const _ as *const S);
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
0
|
||||
}],
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67945-1.rs:10:16
|
||||
|
|
||||
LL | let x: S = MaybeUninit::uninit();
|
||||
@ -6,7 +6,7 @@ LL | let x: S = MaybeUninit::uninit();
|
||||
|
|
||||
= note: type parameters are currently not permitted in anonymous constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67945-1.rs:12:45
|
||||
|
|
||||
LL | let b = &*(&x as *const _ as *const S);
|
||||
|
@ -6,9 +6,9 @@ struct Bug<S> {
|
||||
//~^ ERROR parameter `S` is never used
|
||||
A: [(); {
|
||||
let x: S = MaybeUninit::uninit();
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
let b = &*(&x as *const _ as *const S);
|
||||
//~^ ERROR generic parameters must not be used inside of non trivial constant values
|
||||
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
|
||||
0
|
||||
}],
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67945-2.rs:8:16
|
||||
|
|
||||
LL | let x: S = MaybeUninit::uninit();
|
||||
@ -6,7 +6,7 @@ LL | let x: S = MaybeUninit::uninit();
|
||||
|
|
||||
= note: type parameters are currently not permitted in anonymous constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/issue-67945-2.rs:10:45
|
||||
|
|
||||
LL | let b = &*(&x as *const _ as *const S);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/self-ty-in-const-1.rs:4:41
|
||||
|
|
||||
LL | fn t1() -> [u8; std::mem::size_of::<Self>()];
|
||||
|
@ -6,7 +6,7 @@ LL | struct Bar<T = [u8; N], const N: usize>(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 of non-trivial constant values
|
||||
--> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44
|
||||
|
|
||||
LL | struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(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 of non-trivial
|
||||
|
||||
// FIXME(const_generics:defaults): We still don't know how to we deal with type defaults.
|
||||
struct Bar<T = [u8; N], const N: usize>(T);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/wf-misc.rs:9:17
|
||||
|
|
||||
LL | let _: [u8; N + 1];
|
||||
@ -6,7 +6,7 @@ LL | let _: [u8; N + 1];
|
||||
|
|
||||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
|
||||
|
||||
error: generic parameters must not be used inside of non trivial constant values
|
||||
error: generic parameters must not be used inside of non-trivial constant values
|
||||
--> $DIR/wf-misc.rs:17:21
|
||||
|
|
||||
LL | let _: Const::<{N + 1}>;
|
||||
|
@ -8,7 +8,7 @@
|
||||
pub fn arr_len<const N: usize>() {
|
||||
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 of non-trivial
|
||||
}
|
||||
|
||||
struct Const<const N: usize>;
|
||||
@ -16,7 +16,7 @@ struct Const<const N: usize>;
|
||||
pub fn func_call<const N: usize>() {
|
||||
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 of non-trivial
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user