mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Bless expected errors
This commit is contained in:
parent
facb38d1dc
commit
79351b1d4a
@ -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<const N: usize>([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
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
#[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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
const C: Config = Config { arr_size: 5 };
|
||||
|
@ -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::<T>()],
|
||||
| ^ 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
|
||||
|
@ -17,7 +17,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>()],
|
||||
//[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
|
||||
}
|
||||
|
||||
|
@ -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<const N: usize> = [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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
|
||||
//[full]~^ ERROR constant expression depends
|
||||
|
@ -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<const N: usize>() -> [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<const N: usize>() -> [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
|
||||
|
||||
|
@ -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<const N: usize> = [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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
fn test<const N: usize>() -> Arr<N> where Arr<N>: Sized {
|
||||
todo!()
|
||||
|
@ -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<const N: usize>() -> [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
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
const fn foo(n: usize) -> usize { n * 2 }
|
||||
|
||||
fn bar<const N: usize>() -> [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() {}
|
||||
|
@ -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<const A: usize, const B: usize>(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<const A: usize, const B: usize>(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
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
#![cfg_attr(min, feature(min_const_generics))]
|
||||
|
||||
fn foo<const A: usize, const B: usize>(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() {}
|
||||
|
@ -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::<T>()}>
|
||||
| ^ 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
|
||||
|
@ -13,7 +13,7 @@ trait Trait<const S: &'static str> {}
|
||||
struct Bug<T>
|
||||
where
|
||||
T: Trait<{std::intrinsics::type_name::<T>()}>
|
||||
//[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
|
||||
|
@ -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<const COUNT: usize>([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
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
pub struct MyArray<const COUNT: usize>([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<const COUNT: usize> MyArray<COUNT> {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -7,7 +7,7 @@
|
||||
struct Bug<T> {
|
||||
//~^ 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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -12,10 +12,10 @@ struct Bug<S> {
|
||||
//~^ 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
|
||||
}],
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -10,10 +10,10 @@ struct Bug<S> {
|
||||
//~^ 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
|
||||
}],
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -7,7 +7,7 @@ struct Const<const N: usize>;
|
||||
impl<const C: usize> 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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ERROR generic parameters may not be used in const operations
|
||||
{}
|
||||
|
||||
trait FooImpl<const IS_ZERO: bool>{}
|
||||
|
@ -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<T, const N: usize> = Vector<T, { 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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
impl<T, const N: usize> Vector<T, { N }> {
|
||||
/// Drop the last component and return the vector with one fewer dimension.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -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<T: Foo> 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<T: Foo> 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
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
//[min]~| ERROR conflicting implementations of trait `MyTrait`
|
||||
|
||||
fn main() {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -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::<Self::Associated>()];
|
||||
| ^^^^^^^^^^^^^^^^ 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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
0
|
||||
}
|
||||
}
|
||||
|
@ -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 <const N: usize> 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
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ generic parameters may not be used in const operations
|
||||
|
||||
struct Foo;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 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<const INT_BITS: u8, const FRAC_BITS: u8>
|
||||
where
|
||||
|
@ -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
|
||||
|
@ -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 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<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 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() {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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<T>() -> [u8; std::mem::size_of::<T>()] {
|
||||
| ^ 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<const N: usize>() -> [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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
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 const evaluations
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
struct Break1<const N: usize>([u8; { { N } }]);
|
||||
//~^ ERROR generic parameters must not be used inside const evaluations
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
|
||||
fn break2<const N: usize>() {
|
||||
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<const N: usize>() {
|
||||
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 {
|
||||
|
@ -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<const N: usize>([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<const N: usize>([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
|
||||
|
||||
|
@ -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::<Self>()];
|
||||
| ^^^^ 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
|
||||
|
@ -6,13 +6,13 @@ 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 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 = [u8; std::mem::size_of::<T>()]>(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
|
||||
|
@ -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 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 = [u8; N], const N: usize>(T);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
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 const evaluations
|
||||
//[min]~^^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user