mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
ty: convert ErrorHandled::Reported
to ConstKind::Error
.
This commit is contained in:
parent
d7c4081b18
commit
77f38dc284
@ -18,6 +18,7 @@ use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS};
|
||||
use polonius_engine::Atom;
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_index::vec::Idx;
|
||||
@ -2340,6 +2341,8 @@ impl<'tcx> Const<'tcx> {
|
||||
/// unevaluated constant.
|
||||
pub fn eval(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> &Const<'tcx> {
|
||||
if let ConstKind::Unevaluated(did, substs, promoted) = self.val {
|
||||
use crate::mir::interpret::ErrorHandled;
|
||||
|
||||
let param_env_and_substs = param_env.with_reveal_all().and(substs);
|
||||
|
||||
// HACK(eddyb) this erases lifetimes even though `const_eval_resolve`
|
||||
@ -2369,8 +2372,10 @@ impl<'tcx> Const<'tcx> {
|
||||
// (which may be identity substs, see above),
|
||||
// can leak through `val` into the const we return.
|
||||
Ok(val) => Const::from_value(tcx, val, self.ty),
|
||||
|
||||
Err(_) => self,
|
||||
Err(ErrorHandled::TooGeneric | ErrorHandled::Linted) => self,
|
||||
Err(ErrorHandled::Reported(ErrorReported)) => {
|
||||
tcx.mk_const(ty::Const { val: ty::ConstKind::Error, ty: self.ty })
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self
|
||||
|
@ -1,11 +1,9 @@
|
||||
fn main() {
|
||||
loop {
|
||||
|_: [_; break]| {} //~ ERROR: `break` outside of a loop
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
loop {
|
||||
|_: [_; continue]| {} //~ ERROR: `continue` outside of a loop
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
@ -5,30 +5,11 @@ LL | |_: [_; break]| {}
|
||||
| ^^^^^ cannot `break` outside of a loop
|
||||
|
||||
error[E0268]: `continue` outside of a loop
|
||||
--> $DIR/array-break-length.rs:8:17
|
||||
--> $DIR/array-break-length.rs:7:17
|
||||
|
|
||||
LL | |_: [_; continue]| {}
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/array-break-length.rs:3:9
|
||||
|
|
||||
LL | |_: [_; break]| {}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/array-break-length.rs:3:9: 3:27]`
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/array-break-length.rs:8:9
|
||||
|
|
||||
LL | |_: [_; continue]| {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/array-break-length.rs:8:9: 8:30]`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0268, E0308.
|
||||
For more information about an error, try `rustc --explain E0268`.
|
||||
For more information about this error, try `rustc --explain E0268`.
|
||||
|
@ -2,8 +2,6 @@ fn main() {
|
||||
|_: [_; continue]| {}; //~ ERROR: `continue` outside of a loop
|
||||
|
||||
while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of a loop
|
||||
//~^ ERROR mismatched types
|
||||
|
||||
while |_: [_; break]| {} {} //~ ERROR: `break` outside of a loop
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
@ -11,30 +11,11 @@ LL | while |_: [_; continue]| {} {}
|
||||
| ^^^^^^^^ cannot `continue` outside of a loop
|
||||
|
||||
error[E0268]: `break` outside of a loop
|
||||
--> $DIR/closure-array-break-length.rs:7:19
|
||||
--> $DIR/closure-array-break-length.rs:6:19
|
||||
|
|
||||
LL | while |_: [_; break]| {} {}
|
||||
| ^^^^^ cannot `break` outside of a loop
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-array-break-length.rs:4:11
|
||||
|
|
||||
LL | while |_: [_; continue]| {} {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found closure `[closure@$DIR/closure-array-break-length.rs:4:11: 4:32]`
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-array-break-length.rs:7:11
|
||||
|
|
||||
LL | while |_: [_; break]| {} {}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found closure `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0268, E0308.
|
||||
For more information about an error, try `rustc --explain E0268`.
|
||||
For more information about this error, try `rustc --explain E0268`.
|
||||
|
@ -19,7 +19,6 @@ const A_I8_I
|
||||
: [u32; (i8::MAX as usize) + 1]
|
||||
= [0; (i8::MAX + 1) as usize];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {
|
||||
foo(&A_I8_I[..]);
|
||||
|
@ -4,16 +4,6 @@ error[E0080]: evaluation of constant value failed
|
||||
LL | = [0; (i8::MAX + 1) as usize];
|
||||
| ^^^^^^^^^^^^^ attempt to add with overflow
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-overflow-3.rs:20:7
|
||||
|
|
||||
LL | = [0; (i8::MAX + 1) as usize];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `128usize`, found `(i8::MAX + 1) as usize`
|
||||
|
|
||||
= note: expected array `[u32; 128]`
|
||||
found array `[u32; _]`
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0308.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -18,7 +18,6 @@ const A_I8_I
|
||||
= [0; (i8::MAX + 1u8) as usize];
|
||||
//~^ ERROR mismatched types
|
||||
//~| ERROR cannot add `u8` to `i8`
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {
|
||||
foo(&A_I8_I[..]);
|
||||
|
@ -12,16 +12,7 @@ LL | = [0; (i8::MAX + 1u8) as usize];
|
||||
|
|
||||
= help: the trait `std::ops::Add<u8>` is not implemented for `i8`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-overflow-3b.rs:18:7
|
||||
|
|
||||
LL | = [0; (i8::MAX + 1u8) as usize];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `128usize`, found `(i8::MAX + 1u8) as usize`
|
||||
|
|
||||
= note: expected array `[u32; 128]`
|
||||
found array `[u32; _]`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -2,7 +2,7 @@ fn main() {
|
||||
// Make sure match uses the usual pointer comparison code path -- i.e., it should complain
|
||||
// that pointer comparison is disallowed, not that parts of a pointer are accessed as raw
|
||||
// bytes.
|
||||
let _: [u8; 0] = [4; { //~ ERROR mismatched types
|
||||
let _: [u8; 0] = [4; {
|
||||
match &1 as *const i32 as usize {
|
||||
//~^ ERROR casting pointers to integers in constants
|
||||
//~| ERROR `match` is not allowed in a `const`
|
||||
|
@ -28,30 +28,7 @@ error[E0080]: evaluation of constant value failed
|
||||
LL | match &1 as *const i32 as usize {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/match-test-ptr-null.rs:5:22
|
||||
|
|
||||
LL | let _: [u8; 0] = [4; {
|
||||
| ____________-------___^
|
||||
| | |
|
||||
| | expected due to this
|
||||
LL | | match &1 as *const i32 as usize {
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }];
|
||||
| |______^ expected `0usize`, found `{
|
||||
match &1 as *const i32 as usize {
|
||||
0 => 42,
|
||||
n => n,
|
||||
}
|
||||
}`
|
||||
|
|
||||
= note: expected array `[u8; 0]`
|
||||
found array `[u8; _]`
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0308, E0658.
|
||||
Some errors have detailed explanations: E0080, E0658.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
|
@ -6,7 +6,6 @@ const X: usize = 42 && 39;
|
||||
//~| ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR: [i32; X] = [99; 34];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X1: usize = 42 || 39;
|
||||
//~^ ERROR mismatched types
|
||||
@ -16,7 +15,6 @@ const X1: usize = 42 || 39;
|
||||
//~| ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR1: [i32; X1] = [99; 47];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X2: usize = -42 || -39;
|
||||
//~^ ERROR mismatched types
|
||||
@ -26,7 +24,6 @@ const X2: usize = -42 || -39;
|
||||
//~| ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR2: [i32; X2] = [99; 18446744073709551607];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X3: usize = -42 && -39;
|
||||
//~^ ERROR mismatched types
|
||||
@ -36,43 +33,36 @@ const X3: usize = -42 && -39;
|
||||
//~| ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR3: [i32; X3] = [99; 6];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y: usize = 42.0 == 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR: [i32; Y] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y1: usize = 42.0 >= 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR1: [i32; Y1] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y2: usize = 42.0 <= 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR2: [i32; Y2] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y3: usize = 42.0 > 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR3: [i32; Y3] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y4: usize = 42.0 < 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR4: [i32; Y4] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y5: usize = 42.0 != 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR5: [i32; Y5] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
fn main() {
|
||||
let _ = ARR;
|
||||
|
@ -16,157 +16,96 @@ error[E0308]: mismatched types
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:8:18
|
||||
|
|
||||
LL | const ARR: [i32; X] = [99; 34];
|
||||
| ^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:19
|
||||
--> $DIR/const-integer-bool-ops.rs:10:19
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:25
|
||||
--> $DIR/const-integer-bool-ops.rs:10:25
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:19
|
||||
--> $DIR/const-integer-bool-ops.rs:10:19
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:18:19
|
||||
|
|
||||
LL | const ARR1: [i32; X1] = [99; 47];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:19
|
||||
--> $DIR/const-integer-bool-ops.rs:19:19
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:26
|
||||
--> $DIR/const-integer-bool-ops.rs:19:26
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:19
|
||||
--> $DIR/const-integer-bool-ops.rs:19:19
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:28:19
|
||||
|
|
||||
LL | const ARR2: [i32; X2] = [99; 18446744073709551607];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:19
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:26
|
||||
--> $DIR/const-integer-bool-ops.rs:28:26
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:19
|
||||
--> $DIR/const-integer-bool-ops.rs:28:19
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:38:19
|
||||
|
|
||||
LL | const ARR3: [i32; X3] = [99; 6];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:41:18
|
||||
--> $DIR/const-integer-bool-ops.rs:37:18
|
||||
|
|
||||
LL | const Y: usize = 42.0 == 42.0;
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:44:19
|
||||
|
|
||||
LL | const ARRR: [i32; Y] = [99; 1];
|
||||
| ^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:47:19
|
||||
--> $DIR/const-integer-bool-ops.rs:42:19
|
||||
|
|
||||
LL | const Y1: usize = 42.0 >= 42.0;
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:50:20
|
||||
|
|
||||
LL | const ARRR1: [i32; Y1] = [99; 1];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:53:19
|
||||
--> $DIR/const-integer-bool-ops.rs:47:19
|
||||
|
|
||||
LL | const Y2: usize = 42.0 <= 42.0;
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:56:20
|
||||
|
|
||||
LL | const ARRR2: [i32; Y2] = [99; 1];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:59:19
|
||||
--> $DIR/const-integer-bool-ops.rs:52:19
|
||||
|
|
||||
LL | const Y3: usize = 42.0 > 42.0;
|
||||
| ^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:62:20
|
||||
|
|
||||
LL | const ARRR3: [i32; Y3] = [99; 0];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:65:19
|
||||
--> $DIR/const-integer-bool-ops.rs:57:19
|
||||
|
|
||||
LL | const Y4: usize = 42.0 < 42.0;
|
||||
| ^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:68:20
|
||||
|
|
||||
LL | const ARRR4: [i32; Y4] = [99; 0];
|
||||
| ^^ referenced constant has errors
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:71:19
|
||||
--> $DIR/const-integer-bool-ops.rs:62:19
|
||||
|
|
||||
LL | const Y5: usize = 42.0 != 42.0;
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:74:20
|
||||
|
|
||||
LL | const ARRR5: [i32; Y5] = [99; 0];
|
||||
| ^^ referenced constant has errors
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
error: aborting due to 28 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0308.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -4,7 +4,6 @@ const TUP: (usize,) = 5usize << 64;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected tuple, found `usize`
|
||||
const ARR: [i32; TUP.0] = [];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
@ -7,13 +7,6 @@ LL | const TUP: (usize,) = 5usize << 64;
|
||||
= note: expected tuple `(usize,)`
|
||||
found type `usize`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-tup-index-span.rs:6:18
|
||||
|
|
||||
LL | const ARR: [i32; TUP.0] = [];
|
||||
| ^^^ referenced constant has errors
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0308.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -17,5 +17,4 @@ fn main() {
|
||||
= [0; Dim3::dim()];
|
||||
//~^ ERROR E0015
|
||||
//~| ERROR E0080
|
||||
//~| ERROR mismatched types
|
||||
}
|
||||
|
@ -22,19 +22,7 @@ error[E0080]: evaluation of constant value failed
|
||||
LL | = [0; Dim3::dim()];
|
||||
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-39559-2.rs:17:11
|
||||
|
|
||||
LL | let array: [usize; Dim3::dim()]
|
||||
| -------------------- expected due to this
|
||||
...
|
||||
LL | = [0; Dim3::dim()];
|
||||
| ^^^^^^^^^^^^^^^^ expected `Dim3::dim()`, found `Dim3::dim()`
|
||||
|
|
||||
= note: expected array `[usize; _]`
|
||||
found array `[usize; _]`
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0080, E0308.
|
||||
Some errors have detailed explanations: E0015, E0080.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
@ -5,7 +5,6 @@ enum Foo {
|
||||
|
||||
enum Bar {
|
||||
A = Foo::A as isize
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -6,13 +6,6 @@ LL | A = "" + 1
|
||||
| |
|
||||
| &str
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-41394.rs:7:9
|
||||
|
|
||||
LL | A = Foo::A as isize
|
||||
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0369.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0369`.
|
||||
|
@ -2,5 +2,4 @@ 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
|
||||
}
|
||||
|
@ -11,13 +11,6 @@ LL | use std::f32::consts::LOG10_2;
|
||||
LL | use std::f64::consts::LOG10_2;
|
||||
|
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-50599.rs:4:29
|
||||
|
|
||||
LL | let mut digits = [0u32; M];
|
||||
| ^ referenced constant has errors
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0425.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
@ -4,6 +4,5 @@ static A: &'static [u32] = &[1];
|
||||
static B: [u32; 1] = [0; A.len()];
|
||||
//~^ ERROR [E0013]
|
||||
//~| ERROR evaluation of constant value failed
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {}
|
||||
|
@ -12,16 +12,7 @@ error[E0080]: evaluation of constant value failed
|
||||
LL | static B: [u32; 1] = [0; A.len()];
|
||||
| ^ constant accesses static
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-52060.rs:4:22
|
||||
|
|
||||
LL | static B: [u32; 1] = [0; A.len()];
|
||||
| ^^^^^^^^^^^^ expected `1usize`, found `A.len()`
|
||||
|
|
||||
= note: expected array `[u32; 1]`
|
||||
found array `[u32; _]`
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0013, E0080, E0308.
|
||||
Some errors have detailed explanations: E0013, E0080.
|
||||
For more information about an error, try `rustc --explain E0013`.
|
||||
|
@ -11,8 +11,6 @@ trait Tt {
|
||||
}
|
||||
|
||||
fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
//~| ERROR evaluation of constant value failed
|
||||
z
|
||||
}
|
||||
|
||||
|
@ -15,19 +15,7 @@ LL | const fn const_val<T: Sized>() -> usize {
|
||||
|
|
||||
= note: cannot satisfy `_: Tt`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-54954.rs:13:15
|
||||
|
|
||||
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
|
||||
| ^^^^^^^ referenced constant has errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-54954.rs:13:34
|
||||
|
|
||||
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
|
||||
| ^^^^^^^ referenced constant has errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0283, E0379.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
Some errors have detailed explanations: E0283, E0379.
|
||||
For more information about an error, try `rustc --explain E0283`.
|
||||
|
@ -23,8 +23,7 @@ fn h<const N: usize>() {
|
||||
fn i<const N: usize>() {
|
||||
static a: [u8; N] = [0; N];
|
||||
//~^ ERROR can't use generic parameters from outer function
|
||||
//~^^ ERROR can't use generic parameters from outer function
|
||||
//~| ERROR mismatched types
|
||||
//~| ERROR can't use generic parameters from outer function
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -48,16 +48,6 @@ LL | #![feature(const_generics)]
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-65035-static-with-parent-generics.rs:24:25
|
||||
|
|
||||
LL | static a: [u8; N] = [0; N];
|
||||
| ^^^^^^ expected `N`, found `N`
|
||||
|
|
||||
= note: expected array `[u8; _]`
|
||||
found array `[u8; _]`
|
||||
error: aborting due to 5 previous errors; 1 warning emitted
|
||||
|
||||
error: aborting due to 6 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0308, E0401.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
For more information about this error, try `rustc --explain E0401`.
|
||||
|
@ -2,6 +2,4 @@ fn main() {
|
||||
let v = vec![0];
|
||||
const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
|
||||
let s: [u32; l] = v.into_iter().collect();
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
//~^^ ERROR a value of type
|
||||
}
|
||||
|
@ -4,21 +4,6 @@ error[E0435]: attempt to use a non-constant value in a constant
|
||||
LL | const l: usize = v.count();
|
||||
| ^ non-constant value
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/type-dependent-def-issue-49241.rs:4:18
|
||||
|
|
||||
LL | let s: [u32; l] = v.into_iter().collect();
|
||||
| ^ referenced constant has errors
|
||||
error: aborting due to previous error
|
||||
|
||||
error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}`
|
||||
--> $DIR/type-dependent-def-issue-49241.rs:4:37
|
||||
|
|
||||
LL | let s: [u32; l] = v.into_iter().collect();
|
||||
| ^^^^^^^ value of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>`
|
||||
|
|
||||
= help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0277, E0435.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0435`.
|
||||
|
Loading…
Reference in New Issue
Block a user