1
Fork 0

bless tests

This commit is contained in:
b-naber 2022-02-16 10:56:01 +01:00
parent 07a461ad52
commit 9d843171d1
41 changed files with 289 additions and 207 deletions

View file

@ -2327,6 +2327,7 @@ dependencies = [
"compiletest_rs",
"env_logger 0.9.0",
"getrandom 0.2.0",
"hex 0.4.2",
"libc",
"log",
"measureme 9.1.2",

View file

@ -21,44 +21,44 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 16, align: 8) {
alloc28 03 00 00 00 00 00 00 00 ........
alloc22 03 00 00 00 00 00 00 00 ........
}
alloc28 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc13 ....
alloc22 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc9 ....
0x10 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ ............
0x20 alloc18 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc26 ....*...
0x20 alloc14 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc20 ....*...
0x40 03 00 00 00 00 00 00 00 ........
}
alloc13 (size: 0, align: 8) {}
alloc9 (size: 0, align: 8) {}
alloc18 (size: 16, align: 8) {
alloc16 alloc17
alloc14 (size: 16, align: 8) {
alloc12 alloc13
}
alloc16 (size: 1, align: 1) {
alloc12 (size: 1, align: 1) {
05 .
}
alloc17 (size: 1, align: 1) {
alloc13 (size: 1, align: 1) {
06 .
}
alloc26 (size: 24, align: 8) {
0x00 alloc22+0x3 alloc23
0x10 alloc25+0x2
alloc20 (size: 24, align: 8) {
0x00 alloc17+0x3 alloc18
0x10 alloc19+0x2
}
alloc22 (size: 4, align: 1) {
alloc17 (size: 4, align: 1) {
2a 45 15 6f *E.o
}
alloc23 (size: 1, align: 1) {
alloc18 (size: 1, align: 1) {
2a *
}
alloc25 (size: 4, align: 1) {
alloc19 (size: 4, align: 1) {
2a 45 15 6f *E.o
}

View file

@ -26,7 +26,7 @@
- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
+ _2 = transmute::<&str, &[u8]>(move _8) -> bb12; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/str/mod.rs:LL:COL
// + span: $DIR/deduplicate_blocks.rs:3:11: 3:23
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {transmute::<&str, &[u8]>}, val: Value(Scalar(<ZST>)) }
}

View file

@ -39,7 +39,7 @@
// mir::Constant
- // + span: $DIR/inline-diverging.rs:16:9: 16:14
- // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar(<ZST>)) }
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
+ // + span: $DIR/inline-diverging.rs:16:9: 16:16
+ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
+ // mir::Constant
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL

View file

@ -34,7 +34,10 @@
- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ // ty::Const
+ // + ty: alloc::raw_vec::RawVec<u32>
+ // + val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None)
// mir::Constant
- // + span: $DIR/inline-into-box-place.rs:8:33: 8:41
- // + user_ty: UserType(1)
@ -44,8 +47,8 @@
- bb2: {
+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+ // + user_ty: UserType(0)
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(5:77 ~ alloc[25db]::raw_vec::{impl#0}::NEW), const_param_did: None }, substs: [u32], promoted: None }) }
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
_1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43

View file

@ -38,7 +38,7 @@ fn num_to_digit(_1: char) -> u32 {
_8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
_7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
// + span: $DIR/issue-59352.rs:14:8: 14:23
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) }
}

View file

@ -58,7 +58,7 @@
_14 = &mut (*_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
_7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
// + span: $DIR/remove_storage_markers.rs:8:14: 8:19
// + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
}

View file

@ -4,6 +4,7 @@
// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
const A: u8 = Self::B;
//~^ ERROR cycle detected when const-evaluating + checking `Tr::A`
const B: u8 = Self::A;
}

View file

@ -1,37 +1,15 @@
error[E0391]: cycle detected when normalizing `<() as Tr>::A`
|
note: ...which requires simplifying constant for the type system `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
error[E0391]: cycle detected when const-evaluating + checking `Tr::A`
--> $DIR/defaults-cyclic-fail.rs:5:5
|
LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
|
LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
|
LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `<() as Tr>::B`...
note: ...which requires simplifying constant for the type system `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5
|
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5
|
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5
|
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle
= note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle
note: cycle used when const-evaluating + checking `main::promoted[1]`
--> $DIR/defaults-cyclic-fail.rs:14:1
|

View file

@ -6,10 +6,6 @@ LL | const BAR: u32 = TRAIT_REF_BAR;
|
= note: ...which requires normalizing `TRAIT_REF_BAR`...
note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
@ -31,6 +27,9 @@ note: ...which requires simplifying constant for the type system `<impl at $DIR/
|
LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
=======
|
>>>>>>> 53eca42efca (bless tests)
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
|

View file

@ -1,6 +1,8 @@
// Regression test related to issue 88434
const _CONST: &() = &f(&|_| {});
//~^ ERROR any use of this value will cause an error
//~| WARNING this was previously accepted by the compiler but is being phased out
const fn f<F>(_: &F)
where

View file

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-minimal-example.rs:9:5
--> $DIR/issue-88434-minimal-example.rs:12:5
|
LL | const _CONST: &() = &f(&|_| {});
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
@ -7,11 +7,23 @@ LL | const _CONST: &() = &f(&|_| {});
LL | panic!()
| ^^^^^^^^
| |
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:9:5
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:12:5
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:4:25: 4:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error: any use of this value will cause an error
--> $DIR/issue-88434-minimal-example.rs:4:21
|
LL | const _CONST: &() = &f(&|_| {});
| --------------------^^^^^^^^^^^-
| |
| referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -1,6 +1,8 @@
// Regression test for issue 88434
const _CONST: &[u8] = &f(&[], |_| {});
//~^ ERROR any use of this value will cause an error
//~| WARNING this was previously
const fn f<F>(_: &[u8], _: F) -> &[u8]
where

View file

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-removal-index-should-be-less.rs:9:5
--> $DIR/issue-88434-removal-index-should-be-less.rs:12:5
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
@ -7,11 +7,23 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
LL | panic!()
| ^^^^^^^^
| |
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:9:5
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:12:5
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error: any use of this value will cause an error
--> $DIR/issue-88434-removal-index-should-be-less.rs:4:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ----------------------^^^^^^^^^^^^^^^-
| |
| referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
::: $DIR/out_of_bounds_read.rs:12:33
@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -37,7 +37,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL

View file

@ -23,5 +23,7 @@ const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
fn main() {
let x: &'static i32 = &X;
//~^ ERROR evaluation of constant value failed
//~| ERROR erroneous constant used
//~| WARNING this was previously accepted by the compiler
println!("x={}", x);
}

View file

@ -1,5 +1,5 @@
warning: any use of this value will cause an error
--> $DIR/const-eval-query-stack.rs:20:16
--> $DIR/const-eval-query-stack.rs:19:16
|
LL | const X: i32 = 1 / 0;
| ---------------^^^^^-
@ -7,7 +7,7 @@ LL | const X: i32 = 1 / 0;
| attempt to divide `1_i32` by zero
|
note: the lint level is defined here
--> $DIR/const-eval-query-stack.rs:19:8
--> $DIR/const-eval-query-stack.rs:18:8
|
LL | #[warn(const_err)]
| ^^^^^^^^^
@ -15,10 +15,21 @@ LL | #[warn(const_err)]
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error[E0080]: evaluation of constant value failed
--> $DIR/const-eval-query-stack.rs:24:28
--> $DIR/const-eval-query-stack.rs:23:28
|
LL | let x: &'static i32 = &X;
| ^ referenced constant has errors
error: erroneous constant used
--> $DIR/const-eval-query-stack.rs:23:27
|
LL | let x: &'static i32 = &X;
| ^^ referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
query stack during panic:
#0 [try_normalize_mir_const_after_erasing_regions] normalizing `main::promoted[1]`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`

View file

@ -6,6 +6,7 @@ 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
@ -15,6 +16,7 @@ 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
@ -24,6 +26,7 @@ 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
@ -33,36 +36,43 @@ 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;

View file

@ -16,96 +16,157 @@ 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:10:19
--> $DIR/const-integer-bool-ops.rs:11:19
|
LL | const X1: usize = 42 || 39;
| ^^ expected `bool`, found integer
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:10:25
--> $DIR/const-integer-bool-ops.rs:11:25
|
LL | const X1: usize = 42 || 39;
| ^^ expected `bool`, found integer
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:10:19
--> $DIR/const-integer-bool-ops.rs:11: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:19:19
--> $DIR/const-integer-bool-ops.rs:21:19
|
LL | const X2: usize = -42 || -39;
| ^^^ expected `bool`, found integer
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:19:26
--> $DIR/const-integer-bool-ops.rs:21:26
|
LL | const X2: usize = -42 || -39;
| ^^^ expected `bool`, found integer
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:19:19
--> $DIR/const-integer-bool-ops.rs:21:19
|
LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
error[E0308]: mismatched types
error[E0080]: evaluation of constant value failed
--> $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:28:26
--> $DIR/const-integer-bool-ops.rs:31:26
|
LL | const X3: usize = -42 && -39;
| ^^^ expected `bool`, found integer
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:28:19
--> $DIR/const-integer-bool-ops.rs:31: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:37:18
--> $DIR/const-integer-bool-ops.rs:41:18
|
LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:42:19
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:44:19
|
LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
LL | const ARRR: [i32; Y] = [99; 1];
| ^ referenced constant has errors
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47: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
|
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:52:19
--> $DIR/const-integer-bool-ops.rs:59: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:57:19
--> $DIR/const-integer-bool-ops.rs:65: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:62:19
--> $DIR/const-integer-bool-ops.rs:71:19
|
LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
error: aborting due to 18 previous errors
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
For more information about this error, try `rustc --explain E0308`.
error: aborting due to 28 previous errors
Some errors have detailed explanations: E0080, E0308.
For more information about an error, try `rustc --explain E0080`.

View file

@ -19,7 +19,13 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable
error: aborting due to 3 previous errors
error[E0080]: evaluation of constant value failed
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
| ^ referenced constant has errors
Some errors have detailed explanations: E0596, E0658, E0764.
For more information about an error, try `rustc --explain E0596`.
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0596, E0658, E0764.
For more information about an error, try `rustc --explain E0080`.

View file

@ -9,6 +9,7 @@ const S: &'static mut str = &mut " hello ";
const fn trigger() -> [(); unsafe {
let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
//~^ ERROR evaluation of constant value failed
0
}] {
[(); 0]

View file

@ -4,6 +4,7 @@ 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() {
}

View file

@ -11,6 +11,13 @@ help: use a trailing comma to create a tuple with one element
LL | const TUP: (usize,) = (5usize << 64,);
| + ++
error: aborting due to previous error
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
For more information about this error, try `rustc --explain E0308`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0080, E0308.
For more information about an error, try `rustc --explain E0080`.

View file

@ -6,7 +6,7 @@ LL | fn main() {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
╾───────alloc7────────╼ │ ╾──────╼
╾───────alloc6────────╼ │ ╾──────╼
}
error: erroneous constant used

View file

@ -1,48 +1,20 @@
error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{constant#0}`
error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
|
note: ...which requires simplifying constant for the type system `Foo::B::{constant#0}`...
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
note: ...which requires const-evaluating + checking `Foo::B::{constant#0}`...
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
= note: ...which requires normalizing `A`...
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-36163.rs:1:1
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-36163.rs:1:1
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-36163.rs:1:1
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `A`...
= note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/issue-36163.rs:1:1
= note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
LL | / const A: isize = Foo::B as isize;
LL | |
LL | | enum Foo {
LL | | B = A,
LL | | }
LL | |
LL | | fn main() {}
| |____________^
LL | B = A,
| ^
error: aborting due to previous error

View file

@ -1,21 +1,10 @@
error[E0391]: cycle detected when normalizing `FOO`
|
note: ...which requires simplifying constant for the type system `FOO`...
error[E0391]: cycle detected when const-evaluating + checking `FOO`
--> $DIR/issue-17252.rs:1:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `FOO`...
--> $DIR/issue-17252.rs:1:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `FOO`...
--> $DIR/issue-17252.rs:1:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires normalizing `FOO`, completing the cycle
= note: ...which immediately requires const-evaluating + checking `FOO` again
note: cycle used when const-evaluating + checking `main::{constant#0}`
--> $DIR/issue-17252.rs:4:18
|

View file

@ -1,26 +1,15 @@
error[E0391]: cycle detected when simplifying constant for the type system `X::A::{constant#0}`
error[E0391]: cycle detected when const-evaluating + checking `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `X::A::{constant#0}`...
= note: ...which immediately requires const-evaluating + checking `X::A::{constant#0}` again
note: cycle used when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `X::A::{constant#0}`...
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
= note: ...which requires normalizing `X::A as isize`...
= note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/issue-23302-1.rs:3:1
|
LL | enum X {
| ^^^^^^
error: aborting due to previous error

View file

@ -1,26 +1,15 @@
error[E0391]: cycle detected when simplifying constant for the type system `Y::A::{constant#0}`
error[E0391]: cycle detected when const-evaluating + checking `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `Y::A::{constant#0}`...
= note: ...which immediately requires const-evaluating + checking `Y::A::{constant#0}` again
note: cycle used when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Y::A::{constant#0}`...
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
= note: ...which requires normalizing `Y::B as isize`...
= note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/issue-23302-2.rs:3:1
|
LL | enum Y {
| ^^^^^^
error: aborting due to previous error

View file

@ -1,38 +1,20 @@
error[E0391]: cycle detected when simplifying constant for the type system `A`
error[E0391]: cycle detected when const-evaluating + checking `A`
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `B`...
note: ...which requires simplifying constant for the type system `B`...
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `B`...
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `B`...
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `A`...
= note: ...which again requires simplifying constant for the type system `A`, completing the cycle
= note: cycle used when running analysis passes on this crate
= note: ...which again requires const-evaluating + checking `A`, completing the cycle
note: cycle used when simplifying constant for the type system `A`
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -5,6 +5,7 @@ enum Foo {
enum Bar {
A = Foo::A as isize
//~^ ERROR evaluation of constant value failed
}
fn main() {}

View file

@ -6,6 +6,13 @@ LL | A = "" + 1
| |
| &str
error: aborting due to previous error
error[E0080]: evaluation of constant value failed
--> $DIR/issue-41394.rs:7: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 have detailed explanations: E0080, E0369.
For more information about an error, try `rustc --explain E0080`.

View file

@ -9,6 +9,8 @@ trait Tt {
}
fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
//~^ ERROR evaluation of constant value failed
//~| ERROR evaluation of constant value failed
z
}

View file

@ -12,7 +12,19 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
|
= note: cannot satisfy `_: Tt`
error: aborting due to 2 previous errors
error[E0080]: evaluation of constant value failed
--> $DIR/issue-54954.rs:11:15
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^ referenced constant has errors
Some errors have detailed explanations: E0283, E0379.
For more information about an error, try `rustc --explain E0283`.
error[E0080]: evaluation of constant value failed
--> $DIR/issue-54954.rs:11: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`.

View file

@ -19,4 +19,5 @@ impl TraitB for B { //~ ERROR not all trait items implemented, missing: `MyA`
fn main() {
let _ = [0; B::VALUE];
//~^ ERROR evaluation of constant value failed
}

View file

@ -13,7 +13,13 @@ LL | type MyA: TraitA;
LL | impl TraitB for B {
| ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation
error: aborting due to 2 previous errors
error[E0080]: evaluation of constant value failed
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17
|
LL | let _ = [0; B::VALUE];
| ^^^^^^^^ referenced constant has errors
Some errors have detailed explanations: E0046, E0437.
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0080, E0437.
For more information about an error, try `rustc --explain E0046`.

View file

@ -1,5 +1,6 @@
fn main() {
[1; <Multiply<Five, Five>>::VAL];
//~^ ERROR evaluation of constant value failed
}
trait TypeVal<T> {
const VAL: T;

View file

@ -1,5 +1,5 @@
error[E0412]: cannot find type `PhantomData` in this scope
--> $DIR/issue-77919.rs:9:9
--> $DIR/issue-77919.rs:10:9
|
LL | _n: PhantomData,
| ^^^^^^^^^^^ not found in this scope
@ -10,7 +10,7 @@ LL | use std::marker::PhantomData;
|
error[E0412]: cannot find type `VAL` in this scope
--> $DIR/issue-77919.rs:11:63
--> $DIR/issue-77919.rs:12:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope
@ -18,7 +18,7 @@ LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| help: you might be missing a type parameter: `, VAL`
error[E0046]: not all trait items implemented, missing: `VAL`
--> $DIR/issue-77919.rs:11:1
--> $DIR/issue-77919.rs:12:1
|
LL | const VAL: T;
| ------------- `VAL` from trait
@ -26,7 +26,13 @@ LL | const VAL: T;
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
error: aborting due to 3 previous errors
error[E0080]: evaluation of constant value failed
--> $DIR/issue-77919.rs:2:9
|
LL | [1; <Multiply<Five, Five>>::VAL];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
Some errors have detailed explanations: E0046, E0412.
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0046, E0080, E0412.
For more information about an error, try `rustc --explain E0046`.

View file

@ -2,4 +2,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
}

View file

@ -11,6 +11,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:4: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 have detailed explanations: E0080, E0425.
For more information about an error, try `rustc --explain E0080`.

View file

@ -2,4 +2,5 @@ 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
}

View file

@ -6,6 +6,13 @@ LL | const l: usize = v.count();
| |
| help: consider using `let` instead of `const`: `let l`
error: aborting due to previous error
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
For more information about this error, try `rustc --explain E0435`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0080, E0435.
For more information about an error, try `rustc --explain E0080`.