Report const eval error inside the query
This commit is contained in:
parent
3476ac0bee
commit
7fdf06cdde
135 changed files with 1472 additions and 1090 deletions
|
|
@ -4,12 +4,24 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
|
|||
LL | let array: [usize; Dim3::dim()]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-39559-2.rs:24:24
|
||||
|
|
||||
LL | let array: [usize; Dim3::dim()]
|
||||
| ^^^^^^^^^^^ calling non-const fn `<Dim3 as Dim>::dim`
|
||||
|
||||
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-39559-2.rs:26:15
|
||||
|
|
||||
LL | = [0; Dim3::dim()];
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-39559-2.rs:27:15
|
||||
|
|
||||
LL | = [0; Dim3::dim()];
|
||||
| ^^^^^^^^^^^ calling non-const fn `<Dim3 as Dim>::dim`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ enum Foo {
|
|||
|
||||
enum Bar {
|
||||
A = Foo::A as isize
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@ LL | A = "" + 1
|
|||
|
|
||||
= note: an implementation of `std::ops::Add` might be missing for `&str`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-41394.rs:17:9
|
||||
|
|
||||
LL | A = Foo::A as isize
|
||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0369`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors occurred: E0080, E0369.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ fn xyz() -> u8 { 42 }
|
|||
|
||||
const NUM: u8 = xyz();
|
||||
//~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
//~| ERROR any use of this value will cause an error
|
||||
|
||||
fn main() {
|
||||
match 1 {
|
||||
NUM => unimplemented!(),
|
||||
NUM => unimplemented!(), //~ ERROR could not evaluate constant pattern
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,22 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
|
|||
LL | const NUM: u8 = xyz();
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: any use of this value will cause an error
|
||||
--> $DIR/issue-43105.rs:13:1
|
||||
|
|
||||
LL | const NUM: u8 = xyz();
|
||||
| ^^^^^^^^^^^^^^^^-----^
|
||||
| |
|
||||
| calling non-const fn `xyz`
|
||||
|
|
||||
= note: #[deny(const_err)] on by default
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/issue-43105.rs:19:9
|
||||
|
|
||||
LL | NUM => unimplemented!(), //~ ERROR could not evaluate constant pattern
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
error[E0391]: cycle detected when computing layout of `Foo`
|
||||
|
|
||||
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
|
||||
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
|
||||
--> $DIR/issue-44415.rs:19:17
|
||||
|
|
||||
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||
| ^^^^^^
|
||||
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
|
||||
--> $DIR/issue-44415.rs:19:26
|
||||
|
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ fn main() {
|
|||
const N: u32 = 1_000;
|
||||
const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value
|
||||
let mut digits = [0u32; M];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,13 @@ LL | use std::f32::consts::LOG10_2;
|
|||
LL | use std::f64::consts::LOG10_2;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-50599.rs:14:29
|
||||
|
|
||||
LL | let mut digits = [0u32; M];
|
||||
| ^ referenced constant has errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors occurred: E0080, E0425.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue