const-eval error: always say in which item the error occurred

also adjust the wording a little so that we don't say "the error occurred here" for two different spans
This commit is contained in:
Ralf Jung
2025-06-07 11:32:09 +02:00
parent 1dc9ae6d10
commit 17946c22b1
180 changed files with 938 additions and 952 deletions

View File

@@ -88,11 +88,9 @@ const_eval_division_overflow =
const_eval_dyn_call_not_a_method =
`dyn` call trying to call something that is not a method
const_eval_error = {$error_kind ->
[static] evaluation of static initializer failed here
[const] evaluation of constant value failed here
[const_with_path] evaluation of `{$instance}` failed here
*[other] {""}
const_eval_error = evaluation of `{$instance}` failed {$num_frames ->
[0] here
*[other] inside this call
}
const_eval_exact_div_has_remainder =

View File

@@ -430,20 +430,7 @@ fn report_eval_error<'tcx>(
let (error, backtrace) = error.into_parts();
backtrace.print_backtrace();
let (kind, instance) = if ecx.tcx.is_static(cid.instance.def_id()) {
("static", String::new())
} else {
// If the current item has generics, we'd like to enrich the message with the
// instance and its args: to show the actual compile-time values, in addition to
// the expression, leading to the const eval error.
let instance = &cid.instance;
if !instance.args.is_empty() {
let instance = with_no_trimmed_paths!(instance.to_string());
("const_with_path", instance)
} else {
("const", String::new())
}
};
let instance = with_no_trimmed_paths!(cid.instance.to_string());
super::report(
*ecx.tcx,
@@ -451,6 +438,7 @@ fn report_eval_error<'tcx>(
DUMMY_SP,
|| super::get_span_and_frames(ecx.tcx, ecx.stack()),
|diag, span, frames| {
let num_frames = frames.len();
// FIXME(oli-obk): figure out how to use structured diagnostics again.
diag.code(E0080);
diag.span_label(span, crate::fluent_generated::const_eval_error);
@@ -459,7 +447,7 @@ fn report_eval_error<'tcx>(
}
// Add after the frame rendering above, as it adds its own `instance` args.
diag.arg("instance", instance);
diag.arg("error_kind", kind);
diag.arg("num_frames", num_frames);
},
)
}

View File

@@ -2,7 +2,7 @@ error[E0080]: accessing memory based on pointer with alignment ALIGN, but alignm
--> tests/fail/const-ub-checks.rs:LL:CC
|
LL | ptr.read();
| ^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^ evaluation of `UNALIGNED_READ` failed here
note: erroneous constant encountered
--> tests/fail/const-ub-checks.rs:LL:CC

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `5_u32 - 6_u32`, which would overflow
--> tests/fail/erroneous_const2.rs:LL:CC
|
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `FOO` failed here
note: erroneous constant encountered
--> tests/fail/erroneous_const2.rs:LL:CC

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `0_usize - 1_usize`, which would overflow
--> $DIR/const-evalutation-ice.rs:10:22
|
LL | pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `N` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 0 but the index is 1
--> $DIR/array_const_index-0.rs:2:16
|
LL | const B: i32 = (&A)[1];
| ^^^^^^^ evaluation of constant value failed here
| ^^^^^^^ evaluation of `B` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 0 but the index is 1
--> $DIR/array_const_index-1.rs:2:16
|
LL | const B: i32 = A[1];
| ^^^^ evaluation of constant value failed here
| ^^^^ evaluation of `B` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/issue-81899.rs:6:24
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `_CONST` failed inside this call
|
note: inside `f::<{closure@$DIR/issue-81899.rs:6:31: 6:34}>`
--> $DIR/issue-81899.rs:13:5

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/issue-88434-minimal-example.rs:5:22
|
LL | const _CONST: &() = &f(&|_| {});
| ^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^ evaluation of `_CONST` failed inside this call
|
note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:5:25: 5:28}>`
--> $DIR/issue-88434-minimal-example.rs:12:5

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/issue-88434-removal-index-should-be-less.rs:5:24
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `_CONST` failed inside this call
|
note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:5:31: 5:34}>`
--> $DIR/issue-88434-removal-index-should-be-less.rs:12:5

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: Some error occurred
--> $DIR/const-errs-dont-conflict-103369.rs:5:25
|
LL | impl ConstGenericTrait<{my_fn(1)}> for () {}
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` failed inside this call
|
note: inside `my_fn`
--> $DIR/const-errs-dont-conflict-103369.rs:10:5
@@ -14,7 +14,7 @@ error[E0080]: evaluation panicked: Some error occurred
--> $DIR/const-errs-dont-conflict-103369.rs:7:25
|
LL | impl ConstGenericTrait<{my_fn(2)}> for () {}
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `<() as ConstGenericTrait<{my_fn(2)}>>::{constant#0}` failed inside this call
|
note: inside `my_fn`
--> $DIR/const-errs-dont-conflict-103369.rs:10:5

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `u8::MAX + 1_u8`, which would overflow
--> $DIR/default-param-wf-concrete.rs:4:28
|
LL | struct Foo<const N: u8 = { 255 + 1 }>;
| ^^^^^^^ evaluation of constant value failed here
| ^^^^^^^ evaluation of `Foo::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `u8::MAX + 1_u8`, which would overflow
--> $DIR/default-param-wf-concrete.rs:4:28
|
LL | struct Foo<const N: u8 = { 255 + 1 }>;
| ^^^^^^^ evaluation of constant value failed here
| ^^^^^^^ evaluation of `Foo::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `u8::MAX + 1_u8`, which would overflow
--> $DIR/wfness.rs:1:33
|
LL | struct Ooopsies<const N: u8 = { u8::MAX + 1 }>;
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `Ooopsies::{constant#0}` failed here
error[E0277]: the trait bound `(): Trait<2>` is not satisfied
--> $DIR/wfness.rs:8:9

View File

@@ -2,7 +2,7 @@ error[E0080]: writing to ALLOC0 which is read-only
--> $DIR/issue-100313.rs:18:5
|
LL | x.set_false();
| ^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^ evaluation of `_` failed inside this call
|
note: inside `T::<&true>::set_false`
--> $DIR/issue-100313.rs:11:13

View File

@@ -2,7 +2,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/invalid-patterns.rs:40:32
|
LL | get_flag::<false, { unsafe { char_raw.character } }>();
| ^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#7}` failed here
error[E0080]: constructing invalid value: encountered 0x42, but expected a boolean
--> $DIR/invalid-patterns.rs:42:14
@@ -30,7 +30,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/invalid-patterns.rs:44:58
|
LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
| ^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#11}` failed here
error[E0308]: mismatched types
--> $DIR/invalid-patterns.rs:31:21

View File

@@ -2,7 +2,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/invalid-patterns.rs:40:32
|
LL | get_flag::<false, { unsafe { char_raw.character } }>();
| ^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#7}` failed here
error[E0080]: constructing invalid value: encountered 0x42, but expected a boolean
--> $DIR/invalid-patterns.rs:42:14
@@ -30,7 +30,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/invalid-patterns.rs:44:58
|
LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
| ^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#11}` failed here
error[E0308]: mismatched types
--> $DIR/invalid-patterns.rs:31:21

View File

@@ -103,13 +103,13 @@ error[E0080]: evaluation panicked: assertion failed: 0 < pointee_size && pointee
--> $DIR/forbidden_slices.rs:50:33
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `R1` failed here
error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got ALLOC10 which is only 4 bytes from the end of the allocation
--> $DIR/forbidden_slices.rs:54:25
|
LL | from_ptr_range(ptr..ptr.add(2)) // errors inside libcore
| ^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^ evaluation of `R2` failed here
error[E0080]: constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
--> $DIR/forbidden_slices.rs:57:1
@@ -161,19 +161,19 @@ error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer
--> $DIR/forbidden_slices.rs:79:25
|
LL | from_ptr_range(ptr..ptr.add(1))
| ^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^ evaluation of `R8` failed here
error[E0080]: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation
--> $DIR/forbidden_slices.rs:85:34
|
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `R9` failed here
error[E0080]: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation
--> $DIR/forbidden_slices.rs:87:35
|
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `R10` failed here
error: aborting due to 18 previous errors

View File

@@ -2,19 +2,19 @@ error[E0080]: memory access failed: attempting to access 4 bytes, but got ALLOC0
--> $DIR/out_of_bounds_read.rs:8:33
|
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_READ` failed here
error[E0080]: memory access failed: attempting to access 4 bytes, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes
--> $DIR/out_of_bounds_read.rs:10:39
|
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
| ^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^ evaluation of `main::_CONST_READ` failed here
error[E0080]: memory access failed: attempting to access 4 bytes, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes
--> $DIR/out_of_bounds_read.rs:12:37
|
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_MUT_READ` failed here
error: aborting due to 3 previous errors

View File

@@ -2,19 +2,19 @@ error[E0080]: evaluation panicked: aborted execution: attempted to instantiate u
--> $DIR/assert-type-intrinsics.rs:11:9
|
LL | MaybeUninit::<!>::uninit().assume_init();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD1` failed here
error[E0080]: evaluation panicked: aborted execution: attempted to leave type `&i32` uninitialized, which is invalid
--> $DIR/assert-type-intrinsics.rs:15:9
|
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD2` failed here
error[E0080]: evaluation panicked: aborted execution: attempted to zero-initialize type `&i32`, which is invalid
--> $DIR/assert-type-intrinsics.rs:19:9
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_BAD3` failed here
error: aborting due to 3 previous errors

View File

@@ -2,13 +2,13 @@ error[E0080]: index out of bounds: the length is 3 but the index is 4
--> $DIR/const-array-oob.rs:5:19
|
LL | const BLUB: [u32; FOO[4]] = [5, 6];
| ^^^^^^ evaluation of constant value failed here
| ^^^^^^ evaluation of `BLUB::{constant#0}` failed here
error[E0080]: index out of bounds: the length is 3 but the index is 5
--> $DIR/const-array-oob.rs:2:20
|
LL | const BAR: usize = FOO[5];
| ^^^^^^ evaluation of constant value failed here
| ^^^^^^ evaluation of `BAR` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: `assume` called with `false`
--> $DIR/const-assert-unchecked-ub.rs:3:5
|
LL | std::hint::assert_unchecked(n < 32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error: aborting due to 1 previous error

View File

@@ -2,49 +2,49 @@ error[E0080]: memory access failed: attempting to access 1 byte, but got null po
--> $DIR/const-compare-bytes-ub.rs:9:9
|
LL | compare_bytes(0 as *const u8, 2 as *const u8, 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::LHS_NULL` failed here
error[E0080]: memory access failed: attempting to access 1 byte, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
--> $DIR/const-compare-bytes-ub.rs:13:9
|
LL | compare_bytes(1 as *const u8, 0 as *const u8, 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::RHS_NULL` failed here
error[E0080]: memory access failed: attempting to access 1 byte, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
--> $DIR/const-compare-bytes-ub.rs:17:9
|
LL | compare_bytes(1 as *const u8, 2 as *const u8, 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::DANGLING_PTR_NON_ZERO_LENGTH` failed here
error[E0080]: memory access failed: attempting to access 4 bytes, but got ALLOC0 which is only 3 bytes from the end of the allocation
--> $DIR/const-compare-bytes-ub.rs:21:9
|
LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::LHS_OUT_OF_BOUNDS` failed here
error[E0080]: memory access failed: attempting to access 4 bytes, but got ALLOC1 which is only 3 bytes from the end of the allocation
--> $DIR/const-compare-bytes-ub.rs:25:9
|
LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::RHS_OUT_OF_BOUNDS` failed here
error[E0080]: reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
--> $DIR/const-compare-bytes-ub.rs:29:9
|
LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::LHS_UNINIT` failed here
error[E0080]: reading memory at ALLOC3[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
--> $DIR/const-compare-bytes-ub.rs:33:9
|
LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::RHS_UNINIT` failed here
error[E0080]: unable to turn pointer into integer
--> $DIR/const-compare-bytes-ub.rs:37:9
|
LL | compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::WITH_PROVENANCE` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported

View File

@@ -2,7 +2,7 @@ error[E0080]: memory access failed: attempting to access 8 bytes, but got 0xdead
--> $DIR/const-deref-ptr.rs:4:30
|
LL | static C: u64 = unsafe { *(0xdeadbeef as *const u64) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::C` failed here
error: aborting due to 1 previous error

View File

@@ -2,31 +2,31 @@ error[E0080]: attempt to negate `i8::MIN`, which would overflow
--> $DIR/const-err-early.rs:1:19
|
LL | pub const A: i8 = -i8::MIN;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `A` failed here
error[E0080]: attempt to compute `200_u8 + 200_u8`, which would overflow
--> $DIR/const-err-early.rs:2:19
|
LL | pub const B: u8 = 200u8 + 200u8;
| ^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^ evaluation of `B` failed here
error[E0080]: attempt to compute `200_u8 * 4_u8`, which would overflow
--> $DIR/const-err-early.rs:3:19
|
LL | pub const C: u8 = 200u8 * 4;
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `C` failed here
error[E0080]: attempt to compute `42_u8 - 43_u8`, which would overflow
--> $DIR/const-err-early.rs:4:19
|
LL | pub const D: u8 = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^ evaluation of `D` failed here
error[E0080]: index out of bounds: the length is 1 but the index is 1
--> $DIR/const-err-early.rs:5:19
|
LL | pub const E: u8 = [5u8][1];
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `E` failed here
error: aborting due to 5 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/const-err-enum-discriminant.rs:8:21
|
LL | Boo = [unsafe { Foo { b: () }.a }; 4][3],
| ^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^ evaluation of `Bar::Boo::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -1,12 +1,12 @@
pub const A: i8 = -i8::MIN;
//~^ NOTE constant
//~^ NOTE failed here
//~| ERROR attempt to negate `i8::MIN`, which would overflow
pub const B: i8 = A;
//~^ NOTE constant
//~^ NOTE erroneous constant
pub const C: u8 = A as u8;
//~^ NOTE constant
//~^ NOTE erroneous constant
pub const D: i8 = 50 - A;
//~^ NOTE constant
//~^ NOTE erroneous constant
fn main() {
let _ = (A, B, C, D);

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to negate `i8::MIN`, which would overflow
--> $DIR/const-err-multi.rs:1:19
|
LL | pub const A: i8 = -i8::MIN;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `A` failed here
note: erroneous constant encountered
--> $DIR/const-err-multi.rs:4:19

View File

@@ -2,7 +2,7 @@ error[E0080]: values of the type `[u8; usize::MAX]` are too big for the target a
--> $DIR/const-eval-fail-too-big.rs:4:28
|
LL | let x = [0u8; !0usize];
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `B::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: modifying a static's initial value from another static's initializ
--> $DIR/assign-to-static-within-other-static.rs:8:5
|
LL | FOO = 5;
| ^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^ evaluation of `BOO` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `5_u32 - 6_u32`, which would overflow
--> $DIR/conditional_array_execution.rs:3:19
|
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `FOO` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to negate `i8::MIN`, which would overflow
--> $DIR/const-eval-overflow-2.rs:11:25
|
LL | const NEG_NEG_128: i8 = -NEG_128;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `NEG_NEG_128` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `i8::MAX + 1_i8`, which would overflow
--> $DIR/const-eval-overflow-3.rs:18:11
|
LL | = [0; (i8::MAX + 1) as usize];
| ^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^ evaluation of `A_I8_I::{constant#1}` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `i8::MAX + 1_i8`, which would overflow
--> $DIR/const-eval-overflow-4.rs:11:13
|
LL | : [u32; (i8::MAX as i8 + 1i8) as usize]
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `A_I8_T::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,49 +2,49 @@ error[E0080]: attempt to compute `i8::MIN - 1_i8`, which would overflow
--> $DIR/const-eval-overflow2.rs:12:6
|
LL | i8::MIN - 1,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_I8` failed here
error[E0080]: attempt to compute `i16::MIN - 1_i16`, which would overflow
--> $DIR/const-eval-overflow2.rs:18:6
|
LL | i16::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I16` failed here
error[E0080]: attempt to compute `i32::MIN - 1_i32`, which would overflow
--> $DIR/const-eval-overflow2.rs:24:6
|
LL | i32::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I32` failed here
error[E0080]: attempt to compute `i64::MIN - 1_i64`, which would overflow
--> $DIR/const-eval-overflow2.rs:30:6
|
LL | i64::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I64` failed here
error[E0080]: attempt to compute `0_u8 - 1_u8`, which would overflow
--> $DIR/const-eval-overflow2.rs:36:6
|
LL | u8::MIN - 1,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_U8` failed here
error[E0080]: attempt to compute `0_u16 - 1_u16`, which would overflow
--> $DIR/const-eval-overflow2.rs:41:6
|
LL | u16::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U16` failed here
error[E0080]: attempt to compute `0_u32 - 1_u32`, which would overflow
--> $DIR/const-eval-overflow2.rs:46:6
|
LL | u32::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U32` failed here
error[E0080]: attempt to compute `0_u64 - 1_u64`, which would overflow
--> $DIR/const-eval-overflow2.rs:52:6
|
LL | u64::MIN - 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U64` failed here
error: aborting due to 8 previous errors

View File

@@ -2,49 +2,49 @@ error[E0080]: attempt to compute `i8::MAX + 1_i8`, which would overflow
--> $DIR/const-eval-overflow2b.rs:12:6
|
LL | i8::MAX + 1,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_I8` failed here
error[E0080]: attempt to compute `i16::MAX + 1_i16`, which would overflow
--> $DIR/const-eval-overflow2b.rs:18:6
|
LL | i16::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I16` failed here
error[E0080]: attempt to compute `i32::MAX + 1_i32`, which would overflow
--> $DIR/const-eval-overflow2b.rs:24:6
|
LL | i32::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I32` failed here
error[E0080]: attempt to compute `i64::MAX + 1_i64`, which would overflow
--> $DIR/const-eval-overflow2b.rs:30:6
|
LL | i64::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I64` failed here
error[E0080]: attempt to compute `u8::MAX + 1_u8`, which would overflow
--> $DIR/const-eval-overflow2b.rs:36:6
|
LL | u8::MAX + 1,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_U8` failed here
error[E0080]: attempt to compute `u16::MAX + 1_u16`, which would overflow
--> $DIR/const-eval-overflow2b.rs:41:6
|
LL | u16::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U16` failed here
error[E0080]: attempt to compute `u32::MAX + 1_u32`, which would overflow
--> $DIR/const-eval-overflow2b.rs:46:6
|
LL | u32::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U32` failed here
error[E0080]: attempt to compute `u64::MAX + 1_u64`, which would overflow
--> $DIR/const-eval-overflow2b.rs:52:6
|
LL | u64::MAX + 1,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U64` failed here
error: aborting due to 8 previous errors

View File

@@ -2,49 +2,49 @@ error[E0080]: attempt to compute `i8::MIN * 2_i8`, which would overflow
--> $DIR/const-eval-overflow2c.rs:12:6
|
LL | i8::MIN * 2,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_I8` failed here
error[E0080]: attempt to compute `i16::MIN * 2_i16`, which would overflow
--> $DIR/const-eval-overflow2c.rs:18:6
|
LL | i16::MIN * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I16` failed here
error[E0080]: attempt to compute `i32::MIN * 2_i32`, which would overflow
--> $DIR/const-eval-overflow2c.rs:24:6
|
LL | i32::MIN * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I32` failed here
error[E0080]: attempt to compute `i64::MIN * 2_i64`, which would overflow
--> $DIR/const-eval-overflow2c.rs:30:6
|
LL | i64::MIN * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_I64` failed here
error[E0080]: attempt to compute `u8::MAX * 2_u8`, which would overflow
--> $DIR/const-eval-overflow2c.rs:36:6
|
LL | u8::MAX * 2,
| ^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^ evaluation of `VALS_U8` failed here
error[E0080]: attempt to compute `u16::MAX * 2_u16`, which would overflow
--> $DIR/const-eval-overflow2c.rs:41:6
|
LL | u16::MAX * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U16` failed here
error[E0080]: attempt to compute `u32::MAX * 2_u32`, which would overflow
--> $DIR/const-eval-overflow2c.rs:46:6
|
LL | u32::MAX * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U32` failed here
error[E0080]: attempt to compute `u64::MAX * 2_u64`, which would overflow
--> $DIR/const-eval-overflow2c.rs:52:6
|
LL | u64::MAX * 2,
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `VALS_U64` failed here
error: aborting due to 8 previous errors

View File

@@ -2,7 +2,7 @@ error: internal compiler error[E0080]: attempt to divide `1_i32` by zero
--> $DIR/const-eval-query-stack.rs:16:16
|
LL | const X: i32 = 1 / 0;
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `X` failed here
note: please make sure that you have updated to the latest nightly

View File

@@ -2,7 +2,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:27:49
|
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_USIZE_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -11,7 +11,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:30:43
|
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_U8_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -20,7 +20,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:33:45
|
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_U16_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -29,7 +29,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:36:45
|
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_U32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -38,7 +38,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:39:45
|
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_U64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -47,13 +47,13 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/const-pointer-values-in-various-types.rs:42:47
|
LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_U128_UNION` failed here
error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:45:43
|
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_I8_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -62,7 +62,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:48:45
|
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_I16_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -71,7 +71,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:51:45
|
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_I32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -80,7 +80,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:54:45
|
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_I64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -89,13 +89,13 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/const-pointer-values-in-various-types.rs:57:47
|
LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_I128_UNION` failed here
error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:60:45
|
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_F32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -104,7 +104,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:63:45
|
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_F64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -113,7 +113,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:66:47
|
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_BOOL_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -122,7 +122,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:69:47
|
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::I32_REF_CHAR_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -131,7 +131,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:72:39
|
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_U8_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -140,7 +140,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:75:41
|
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_U16_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -149,7 +149,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:78:41
|
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_U32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -158,7 +158,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:81:41
|
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_U64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -167,7 +167,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:84:43
|
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_U128_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -176,7 +176,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:87:39
|
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_I8_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -185,7 +185,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:90:41
|
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_I16_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -194,7 +194,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:93:41
|
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_I32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -203,7 +203,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:96:41
|
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_I64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -212,7 +212,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:99:43
|
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_I128_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -221,7 +221,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:102:41
|
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_F32_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -230,7 +230,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:105:41
|
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_F64_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -239,7 +239,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:108:43
|
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_BOOL_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -248,7 +248,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/const-pointer-values-in-various-types.rs:111:43
|
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::STR_CHAR_UNION` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported

View File

@@ -14,10 +14,10 @@ const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
}
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
//~^ NOTE evaluation of constant value failed
//~^ NOTE failed inside this call
//~| ERROR calling non-const function `double`
const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
//~^ NOTE evaluation of constant value failed
//~^ NOTE failed inside this call
//~| ERROR calling non-const function `double`
fn main() {

View File

@@ -2,7 +2,7 @@ error[E0080]: calling non-const function `double`
--> $DIR/const_fn_ptr_fail2.rs:16:18
|
LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `Y` failed inside this call
|
note: inside `bar`
--> $DIR/const_fn_ptr_fail2.rs:9:5
@@ -14,7 +14,7 @@ error[E0080]: calling non-const function `double`
--> $DIR/const_fn_ptr_fail2.rs:19:18
|
LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `Z` failed inside this call
|
note: inside `bar`
--> $DIR/const_fn_ptr_fail2.rs:9:5

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked:
--> $DIR/const_panic-normalize-tabs-115498.rs:3:17
|
LL | struct Bug([u8; panic!{"\t"}]);
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `Bug::0::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,25 +2,25 @@ error[E0080]: evaluation panicked: cheese
--> $DIR/const_panic.rs:6:15
|
LL | const Z: () = std::panic!("cheese");
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `Z` failed here
error[E0080]: evaluation panicked: explicit panic
--> $DIR/const_panic.rs:9:16
|
LL | const Z2: () = std::panic!();
| ^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^ evaluation of `Z2` failed here
error[E0080]: evaluation panicked: internal error: entered unreachable code
--> $DIR/const_panic.rs:12:15
|
LL | const Y: () = std::unreachable!();
| ^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^ evaluation of `Y` failed here
error[E0080]: evaluation panicked: not implemented
--> $DIR/const_panic.rs:15:15
|
LL | const X: () = std::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `X` failed here
|
= note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -28,37 +28,37 @@ error[E0080]: evaluation panicked: hello
--> $DIR/const_panic.rs:18:15
|
LL | const W: () = std::panic!(MSG);
| ^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^ evaluation of `W` failed here
error[E0080]: evaluation panicked: hello
--> $DIR/const_panic.rs:21:16
|
LL | const W2: () = std::panic!("{}", MSG);
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `W2` failed here
error[E0080]: evaluation panicked: cheese
--> $DIR/const_panic.rs:24:20
|
LL | const Z_CORE: () = core::panic!("cheese");
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `Z_CORE` failed here
error[E0080]: evaluation panicked: explicit panic
--> $DIR/const_panic.rs:27:21
|
LL | const Z2_CORE: () = core::panic!();
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `Z2_CORE` failed here
error[E0080]: evaluation panicked: internal error: entered unreachable code
--> $DIR/const_panic.rs:30:20
|
LL | const Y_CORE: () = core::unreachable!();
| ^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^ evaluation of `Y_CORE` failed here
error[E0080]: evaluation panicked: not implemented
--> $DIR/const_panic.rs:33:20
|
LL | const X_CORE: () = core::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `X_CORE` failed here
|
= note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -66,13 +66,13 @@ error[E0080]: evaluation panicked: hello
--> $DIR/const_panic.rs:36:20
|
LL | const W_CORE: () = core::panic!(MSG);
| ^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^ evaluation of `W_CORE` failed here
error[E0080]: evaluation panicked: hello
--> $DIR/const_panic.rs:39:21
|
LL | const W2_CORE: () = core::panic!("{}", MSG);
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `W2_CORE` failed here
error: aborting due to 12 previous errors

View File

@@ -2,25 +2,25 @@ error[E0080]: evaluation panicked: blåhaj
--> $DIR/const_panic_2021.rs:6:15
|
LL | const A: () = std::panic!("blåhaj");
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `A` failed here
error[E0080]: evaluation panicked: explicit panic
--> $DIR/const_panic_2021.rs:9:15
|
LL | const B: () = std::panic!();
| ^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^ evaluation of `B` failed here
error[E0080]: evaluation panicked: internal error: entered unreachable code
--> $DIR/const_panic_2021.rs:12:15
|
LL | const C: () = std::unreachable!();
| ^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^ evaluation of `C` failed here
error[E0080]: evaluation panicked: not implemented
--> $DIR/const_panic_2021.rs:15:15
|
LL | const D: () = std::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `D` failed here
|
= note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -28,31 +28,31 @@ error[E0080]: evaluation panicked: hello
--> $DIR/const_panic_2021.rs:18:15
|
LL | const E: () = std::panic!("{}", MSG);
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `E` failed here
error[E0080]: evaluation panicked: shark
--> $DIR/const_panic_2021.rs:21:20
|
LL | const A_CORE: () = core::panic!("shark");
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^ evaluation of `A_CORE` failed here
error[E0080]: evaluation panicked: explicit panic
--> $DIR/const_panic_2021.rs:24:20
|
LL | const B_CORE: () = core::panic!();
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `B_CORE` failed here
error[E0080]: evaluation panicked: internal error: entered unreachable code
--> $DIR/const_panic_2021.rs:27:20
|
LL | const C_CORE: () = core::unreachable!();
| ^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^ evaluation of `C_CORE` failed here
error[E0080]: evaluation panicked: not implemented
--> $DIR/const_panic_2021.rs:30:20
|
LL | const D_CORE: () = core::unimplemented!();
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `D_CORE` failed here
|
= note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -60,7 +60,7 @@ error[E0080]: evaluation panicked: hello
--> $DIR/const_panic_2021.rs:33:20
|
LL | const E_CORE: () = core::panic!("{}", MSG);
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `E_CORE` failed here
error: aborting due to 10 previous errors

View File

@@ -2,19 +2,19 @@ error[E0080]: evaluation panicked: cheese
--> $DIR/const_panic_libcore_bin.rs:8:15
|
LL | const Z: () = panic!("cheese");
| ^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^ evaluation of `Z` failed here
error[E0080]: evaluation panicked: internal error: entered unreachable code
--> $DIR/const_panic_libcore_bin.rs:11:15
|
LL | const Y: () = unreachable!();
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `Y` failed here
error[E0080]: evaluation panicked: not implemented
--> $DIR/const_panic_libcore_bin.rs:14:15
|
LL | const X: () = unimplemented!();
| ^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^ evaluation of `X` failed here
|
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -17,5 +17,5 @@ const fn c() -> u32 {
}
const X: u32 = c();
//~^ NOTE evaluation of constant value failed
//~^ NOTE failed inside this call
//~| ERROR hey

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: hey
--> $DIR/const_panic_track_caller.rs:19:16
|
LL | const X: u32 = c();
| ^^^ evaluation of constant value failed here
| ^^^ evaluation of `X` failed inside this call
|
note: inside `c`
--> $DIR/const_panic_track_caller.rs:15:5

View File

@@ -2,13 +2,13 @@ error[E0080]: memory access failed: attempting to access 4 bytes, but got 0x2a[n
--> $DIR/const_raw_ptr_ops2.rs:7:26
|
LL | const Z2: i32 = unsafe { *(42 as *const i32) };
| ^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^ evaluation of `Z2` failed here
error[E0080]: memory access failed: attempting to access 4 bytes, but got 0x2c[noalloc] which is a dangling pointer (it has no provenance)
--> $DIR/const_raw_ptr_ops2.rs:8:26
|
LL | const Z3: i32 = unsafe { *(44 as *const i32) };
| ^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^ evaluation of `Z3` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: invalid align passed to `const_allocate`: 3 is not a power of 2
--> $DIR/alloc_intrinsic_errors.rs:7:18
|
LL | const FOO: i32 = foo();
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `FOO` failed inside this call
|
note: inside `foo`
--> $DIR/alloc_intrinsic_errors.rs:10:17

View File

@@ -13,7 +13,7 @@ error[E0080]: memory access failed: ALLOC1 has been freed, so this pointer is da
--> $DIR/dealloc_intrinsic_dangling.rs:22:5
|
LL | *reference
| ^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^ evaluation of `_Y` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: memory access failed: ALLOC0 has been freed, so this pointer is da
--> $DIR/dealloc_intrinsic_duplicate.rs:9:5
|
LL | intrinsics::const_deallocate(ptr, 4, 4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_X` failed here
error: aborting due to 1 previous error

View File

@@ -2,25 +2,25 @@ error[E0080]: incorrect layout on deallocation: ALLOC0 has size 4 and alignment
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:8:5
|
LL | intrinsics::const_deallocate(ptr, 4, 2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_X` failed here
error[E0080]: incorrect layout on deallocation: ALLOC1 has size 4 and alignment 4, but gave size 2 and alignment 4
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:13:5
|
LL | intrinsics::const_deallocate(ptr, 2, 4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_Y` failed here
error[E0080]: incorrect layout on deallocation: ALLOC2 has size 4 and alignment 4, but gave size 3 and alignment 4
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:19:5
|
LL | intrinsics::const_deallocate(ptr, 3, 4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_Z` failed here
error[E0080]: invalid align passed to `const_deallocate`: 3 is not a power of 2
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:25:5
|
LL | intrinsics::const_deallocate(ptr, 4, 3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_W` failed here
error: aborting due to 4 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 0 but the index is 0
--> $DIR/index_out_of_bounds.rs:1:19
|
LL | static FOO: i32 = [][0];
| ^^^^^ evaluation of static initializer failed here
| ^^^^^ evaluation of `FOO` failed here
error: aborting due to 1 previous error

View File

@@ -2,13 +2,13 @@ error[E0080]: attempt to compute `0_u32 - 1_u32`, which would overflow
--> $DIR/issue-43197.rs:6:20
|
LL | const X: u32 = 0 - 1;
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `main::X` failed here
error[E0080]: attempt to compute `0_u32 - 1_u32`, which would overflow
--> $DIR/issue-43197.rs:8:24
|
LL | const Y: u32 = foo(0 - 1);
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `main::Y` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: memory access failed: ALLOC0 has been freed, so this pointer is da
--> $DIR/issue-49296.rs:9:16
|
LL | const X: u64 = *wat(42);
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `X` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: `extern type` field does not have a known offset
--> $DIR/issue-91827-extern-types-field-offset.rs:38:17
|
LL | let field = &x.a;
| ^^^^ evaluation of constant value failed here
| ^^^^ evaluation of `OFFSET` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: modifying a static's initial value from another static's initializ
--> $DIR/mod-static-with-const-fn.rs:14:5
|
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^ evaluation of static initializer failed here
| ^^^^^^^^^^^^^^^^ evaluation of `BAR` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: memory access failed: attempting to access 1 byte, but got 0x1[noa
--> $DIR/nonnull_as_ref_ub.rs:4:29
|
LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/panic-assoc-never-type.rs:10:21
|
LL | const VOID: ! = panic!();
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `PrintName::VOID` failed here
note: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:15:13

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/panic-never-type.rs:4:17
|
LL | const VOID: ! = panic!();
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `VOID` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: from_ascii_radix: radix must lie in the range
--> $DIR/parse_ints.rs:5:24
|
LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_LOW` failed inside this call
|
note: inside `core::num::<impl u64>::from_str_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
@@ -14,7 +14,7 @@ error[E0080]: evaluation panicked: from_ascii_radix: radix must lie in the range
--> $DIR/parse_ints.rs:6:25
|
LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_HIGH` failed inside this call
|
note: inside `core::num::<impl u64>::from_str_radix`
--> $SRC_DIR/core/src/num/mod.rs:LL:COL

View File

@@ -2,7 +2,7 @@ error[E0080]: unable to overwrite parts of a pointer in memory at ALLOC0
--> $DIR/partial_ptr_overwrite.rs:7:9
|
LL | *(ptr as *mut u8) = 123;
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `PARTIAL_OVERWRITE` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported

View File

@@ -1,14 +1,14 @@
const MISALIGNED_LOAD: () = unsafe {
let mem = [0u32; 8];
let ptr = mem.as_ptr().byte_add(1);
let _val = *ptr; //~NOTE: evaluation of constant value failed
let _val = *ptr; //~NOTE: failed here
//~^ERROR: based on pointer with alignment 1, but alignment 4 is required
};
const MISALIGNED_STORE: () = unsafe {
let mut mem = [0u32; 8];
let ptr = mem.as_mut_ptr().byte_add(1);
*ptr = 0; //~NOTE: evaluation of constant value failed
*ptr = 0; //~NOTE: failed here
//~^ERROR: based on pointer with alignment 1, but alignment 4 is required
};
@@ -17,7 +17,7 @@ const MISALIGNED_COPY: () = unsafe {
let y = x.as_ptr().cast::<u32>();
let mut z = 123;
y.copy_to_nonoverlapping(&mut z, 1);
//~^ NOTE evaluation of constant value failed
//~^ NOTE failed inside this call
//~| NOTE inside `std::ptr::copy_nonoverlapping::<u32>`
//~| ERROR accessing memory with alignment 1, but alignment 4 is required
// The actual error points into the implementation of `copy_to_nonoverlapping`.
@@ -30,14 +30,14 @@ const MISALIGNED_FIELD: () = unsafe {
let mem = [0f32; 8];
let ptr = mem.as_ptr().cast::<Aligned>();
// Accessing an f32 field but we still require the alignment of the pointer type.
let _val = (*ptr).0; //~NOTE: evaluation of constant value failed
let _val = (*ptr).0; //~NOTE: failed here
//~^ERROR: based on pointer with alignment 4, but alignment 16 is required
};
const OOB: () = unsafe {
let mem = [0u32; 1];
let ptr = mem.as_ptr().cast::<u64>();
let _val = *ptr; //~NOTE: evaluation of constant value failed
let _val = *ptr; //~NOTE: failed here
//~^ERROR: is only 4 bytes from the end of the allocation
};

View File

@@ -2,19 +2,19 @@ error[E0080]: accessing memory based on pointer with alignment 1, but alignment
--> $DIR/raw-pointer-ub.rs:4:16
|
LL | let _val = *ptr;
| ^^^^ evaluation of constant value failed here
| ^^^^ evaluation of `MISALIGNED_LOAD` failed here
error[E0080]: accessing memory based on pointer with alignment 1, but alignment 4 is required
--> $DIR/raw-pointer-ub.rs:11:5
|
LL | *ptr = 0;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `MISALIGNED_STORE` failed here
error[E0080]: accessing memory with alignment 1, but alignment 4 is required
--> $DIR/raw-pointer-ub.rs:19:5
|
LL | y.copy_to_nonoverlapping(&mut z, 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `MISALIGNED_COPY` failed inside this call
|
note: inside `std::ptr::copy_nonoverlapping::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -23,13 +23,13 @@ error[E0080]: accessing memory based on pointer with alignment 4, but alignment
--> $DIR/raw-pointer-ub.rs:33:16
|
LL | let _val = (*ptr).0;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `MISALIGNED_FIELD` failed here
error[E0080]: memory access failed: attempting to access 8 bytes, but got ALLOC0 which is only 4 bytes from the end of the allocation
--> $DIR/raw-pointer-ub.rs:40:16
|
LL | let _val = *ptr;
| ^^^^ evaluation of constant value failed here
| ^^^^ evaluation of `OOB` failed here
error: aborting due to 5 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^ evaluation of `BAR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported

View File

@@ -2,7 +2,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^ evaluation of `BAR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to shift left by `4294967296_u64`, which would overflow
--> $DIR/shift_overflow.rs:3:9
|
LL | X = 1 << ((u32::MAX as u64) + 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `Foo::X::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -19,10 +19,10 @@ const unsafe fn mir_transmute<T, U>(x: T) -> U {
}
}
const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; //~ NOTE evaluation of constant value failed
const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) }; //~ NOTE failed inside this call
//~^ ERROR transmuting from 4-byte type to 2-byte type: `i32` -> `u16`
const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; //~ NOTE evaluation of constant value failed
const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) }; //~ NOTE failed inside this call
//~^ ERROR transmuting from 2-byte type to 4-byte type: `i16` -> `u32`
fn main() {}

View File

@@ -2,7 +2,7 @@ error[E0080]: transmuting from 4-byte type to 2-byte type: `i32` -> `u16`
--> $DIR/transmute-size-mismatch.rs:22:35
|
LL | const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) };
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `FROM_BIGGER` failed inside this call
|
note: inside `mir_transmute::<i32, u16>`
--> $DIR/transmute-size-mismatch.rs:12:13
@@ -14,7 +14,7 @@ error[E0080]: transmuting from 2-byte type to 4-byte type: `i16` -> `u32`
--> $DIR/transmute-size-mismatch.rs:25:36
|
LL | const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) };
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `FROM_SMALLER` failed inside this call
|
note: inside `mir_transmute::<i16, u32>`
--> $DIR/transmute-size-mismatch.rs:12:13

View File

@@ -2,7 +2,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-enum-overwrite.rs:11:14
|
LL | unsafe { *p }
| ^^ evaluation of constant value failed here
| ^^ evaluation of `_` failed here
error: aborting due to 1 previous error

View File

@@ -13,7 +13,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-enum.rs:32:1
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -22,7 +22,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-enum.rs:35:1
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM_WRAPPED` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -42,7 +42,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-enum.rs:49:1
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -51,7 +51,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-enum.rs:52:1
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_WRAPPED` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -60,13 +60,13 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-enum.rs:61:41
|
LL | const BAD_ENUM2_UNDEF: Enum2 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_UNDEF` failed here
error[E0080]: unable to turn pointer into integer
--> $DIR/ub-enum.rs:65:1
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_ENUM2_OPTION_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -108,19 +108,19 @@ error[E0080]: constructing invalid value at .<enum-tag>: encountered an uninhabi
--> $DIR/ub-enum.rs:97:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_UNINHABITED_WITH_DATA1` failed here
error[E0080]: constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
--> $DIR/ub-enum.rs:99:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_UNINHABITED_WITH_DATA2` failed here
error[E0080]: read discriminant of an uninhabited enum variant
--> $DIR/ub-enum.rs:105:9
|
LL | std::mem::discriminant(&*(&() as *const () as *const Never));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TEST_ICE_89765` failed inside this call
|
note: inside `discriminant::<Never>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL

View File

@@ -5,7 +5,7 @@ const fn bool_cast(ptr: *const bool) { unsafe {
const _: () = {
let v = 3_u8;
bool_cast(&v as *const u8 as *const bool); //~ NOTE: evaluation of constant value failed
bool_cast(&v as *const u8 as *const bool); //~ NOTE: failed inside this call
//~^ ERROR interpreting an invalid 8-bit value as a bool
};

View File

@@ -2,7 +2,7 @@ error[E0080]: interpreting an invalid 8-bit value as a bool: 0x03
--> $DIR/ub-invalid-values.rs:8:5
|
LL | bool_cast(&v as *const u8 as *const bool);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed inside this call
|
note: inside `bool_cast`
--> $DIR/ub-invalid-values.rs:2:16

View File

@@ -13,7 +13,7 @@ error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer
--> $DIR/ub-nonnull.rs:22:29
|
LL | let out_of_bounds_ptr = &ptr[255];
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `OUT_OF_BOUNDS_PTR` failed here
error[E0080]: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1
--> $DIR/ub-nonnull.rs:26:1
@@ -41,7 +41,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-nonnull.rs:36:38
|
LL | const UNINIT: NonZero<u8> = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT` failed here
error[E0080]: constructing invalid value: encountered 42, but expected something in the range 10..=30
--> $DIR/ub-nonnull.rs:44:1

View File

@@ -46,7 +46,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-ref-ptr.rs:33:1
|
LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `REF_AS_USIZE` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -55,7 +55,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-ref-ptr.rs:36:39
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `REF_AS_USIZE_SLICE` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -70,7 +70,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-ref-ptr.rs:39:86
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
| ^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^ evaluation of `REF_AS_USIZE_BOX_SLICE` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -107,7 +107,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-ref-ptr.rs:48:41
|
LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT_PTR` failed here
error[E0080]: constructing invalid value: encountered null pointer, but expected a function pointer
--> $DIR/ub-ref-ptr.rs:51:1
@@ -124,7 +124,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-ref-ptr.rs:53:38
|
LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT_FN_PTR` failed here
error[E0080]: constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
--> $DIR/ub-ref-ptr.rs:55:1
@@ -152,7 +152,7 @@ error[E0080]: accessing memory based on pointer with alignment 1, but alignment
--> $DIR/ub-ref-ptr.rs:64:5
|
LL | ptr.read();
| ^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^ evaluation of `UNALIGNED_READ` failed here
error: aborting due to 15 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: constructing invalid value: encountered a value of uninhabited typ
--> $DIR/ub-uninhabit.rs:20:35
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_BAD` failed here
error[E0080]: constructing invalid value: encountered a reference pointing to uninhabited type Bar
--> $DIR/ub-uninhabit.rs:23:1
@@ -19,13 +19,13 @@ error[E0080]: constructing invalid value at [0]: encountered a value of uninhabi
--> $DIR/ub-uninhabit.rs:26:42
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_ARRAY` failed here
error[E0080]: constructing invalid value: encountered a value of the never type `!`
--> $DIR/ub-uninhabit.rs:32:16
|
LL | let _val = intrinsics::read_via_copy(ptr);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `READ_NEVER` failed here
error: aborting due to 4 previous errors

View File

@@ -24,7 +24,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-wide-ptr.rs:44:1
|
LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `STR_LENGTH_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -33,7 +33,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-wide-ptr.rs:47:1
|
LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `MY_STR_LENGTH_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -75,7 +75,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-wide-ptr.rs:63:1
|
LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SLICE_LENGTH_UNINIT` failed here
error[E0080]: constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
--> $DIR/ub-wide-ptr.rs:69:1
@@ -103,7 +103,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-wide-ptr.rs:75:1
|
LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SLICE_LENGTH_PTR` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -123,7 +123,7 @@ error[E0080]: unable to turn pointer into integer
--> $DIR/ub-wide-ptr.rs:81:1
|
LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SLICE_LENGTH_PTR_BOX` failed here
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
@@ -183,7 +183,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/ub-wide-ptr.rs:101:1
|
LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `RAW_SLICE_LENGTH_UNINIT` failed here
error[E0080]: constructing invalid value at .0: encountered ALLOC12<imm>, but expected a vtable pointer
--> $DIR/ub-wide-ptr.rs:109:1

View File

@@ -2,13 +2,13 @@ error[E0080]: writing through a pointer that was derived from a shared (immutabl
--> $DIR/ub-write-through-immutable.rs:10:5
|
LL | *ptr = 0;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `WRITE_AFTER_CAST` failed here
error[E0080]: writing through a pointer that was derived from a shared (immutable) reference
--> $DIR/ub-write-through-immutable.rs:16:5
|
LL | *ptr = 0;
| ^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^ evaluation of `WRITE_AFTER_TRANSMUTE` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/union-const-eval-field.rs:28:37
|
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `read_field3::FIELD3` failed here
note: erroneous constant encountered
--> $DIR/union-const-eval-field.rs:30:5

View File

@@ -2,19 +2,19 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/union-ice.rs:14:33
|
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `FIELD3` failed here
error[E0080]: using uninitialized data, but this operation requires initialized memory
--> $DIR/union-ice.rs:19:17
|
LL | b: unsafe { UNION.field3 },
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `FIELD_PATH` failed here
error[E0080]: using uninitialized data, but this operation requires initialized memory
--> $DIR/union-ice.rs:31:18
|
LL | unsafe { UNION.field3 },
| ^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^ evaluation of `FIELD_PATH2` failed here
error: aborting due to 3 previous errors

View File

@@ -13,7 +13,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/union-ub.rs:35:36
|
LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT_BOOL` failed here
error: aborting due to 2 previous errors

View File

@@ -13,7 +13,7 @@ error[E0080]: using uninitialized data, but this operation requires initialized
--> $DIR/union-ub.rs:35:36
|
LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT_BOOL` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 0 but the index is 0
--> $DIR/unused-broken-const.rs:5:18
|
LL | const FOO: i32 = [][0];
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `FOO` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: explicit panic
--> $DIR/unwind-abort.rs:7:15
|
LL | const _: () = foo();
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `_` failed inside this call
|
note: inside `foo`
--> $DIR/unwind-abort.rs:4:5

View File

@@ -2,7 +2,7 @@ error[E0080]: constructing invalid value: encountered a value of the never type
--> $DIR/validate_uninhabited_zsts.rs:17:33
|
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
| ^^^^^ evaluation of constant value failed here
| ^^^^^ evaluation of `FOO` failed inside this call
|
note: inside `foo`
--> $DIR/validate_uninhabited_zsts.rs:4:14
@@ -14,7 +14,7 @@ error[E0080]: constructing invalid value at .0: encountered a value of uninhabit
--> $DIR/validate_uninhabited_zsts.rs:20:42
|
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAR` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: `extern type` field does not have a known offset
--> $DIR/validation-ice-extern-type-field.rs:12:1
|
LL | const C1: &ThinDst = unsafe { std::mem::transmute(b"d".as_ptr()) };
| ^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^ evaluation of `C1` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 1 but the index is 1
--> $DIR/const-external-macro-const-err.rs:12:5
|
LL | static_assert!(2 + 2 == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `main::_` failed here
|
= note: this error originates in the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -2,295 +2,295 @@ error[E0080]: overflowing shift by 8 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:14:29
|
LL | const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_U8` failed here
error[E0080]: overflowing shift by 16 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:16:31
|
LL | const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_U16` failed here
error[E0080]: overflowing shift by 32 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:18:31
|
LL | const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_U32` failed here
error[E0080]: overflowing shift by 64 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:20:31
|
LL | const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_U64` failed here
error[E0080]: overflowing shift by 128 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:22:33
|
LL | const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_U128` failed here
error[E0080]: overflowing shift by 8 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:27:29
|
LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I8` failed here
error[E0080]: overflowing shift by 16 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:29:31
|
LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_i16, 16) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I16` failed here
error[E0080]: overflowing shift by 32 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:31:31
|
LL | const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I32` failed here
error[E0080]: overflowing shift by 64 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:33:31
|
LL | const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I64` failed here
error[E0080]: overflowing shift by 128 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:35:33
|
LL | const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I128` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:40:33
|
LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I8_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:42:35
|
LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I16_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:44:35
|
LL | const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I32_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:46:35
|
LL | const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I64_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:48:37
|
LL | const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I128_NEG` failed here
error[E0080]: overflowing shift by -6 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:54:40
|
LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I8_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -13 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:56:42
|
LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -13) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I16_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -25 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:58:42
|
LL | const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I32_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -30 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:60:42
|
LL | const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I64_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -93 in `unchecked_shl`
--> $DIR/const-int-unchecked.rs:62:44
|
LL | const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHL_I128_NEG_RANDOM` failed here
error[E0080]: overflowing shift by 8 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:69:29
|
LL | const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_U8` failed here
error[E0080]: overflowing shift by 16 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:71:31
|
LL | const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_U16` failed here
error[E0080]: overflowing shift by 32 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:73:31
|
LL | const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_U32` failed here
error[E0080]: overflowing shift by 64 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:75:31
|
LL | const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_U64` failed here
error[E0080]: overflowing shift by 128 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:77:33
|
LL | const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_U128` failed here
error[E0080]: overflowing shift by 8 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:82:29
|
LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I8` failed here
error[E0080]: overflowing shift by 16 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:84:31
|
LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_i16, 16) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I16` failed here
error[E0080]: overflowing shift by 32 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:86:31
|
LL | const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I32` failed here
error[E0080]: overflowing shift by 64 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:88:31
|
LL | const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I64` failed here
error[E0080]: overflowing shift by 128 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:90:33
|
LL | const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I128` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:95:33
|
LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I8_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:97:35
|
LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I16_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:99:35
|
LL | const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I32_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:101:35
|
LL | const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I64_NEG` failed here
error[E0080]: overflowing shift by -1 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:103:37
|
LL | const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I128_NEG` failed here
error[E0080]: overflowing shift by -6 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:109:40
|
LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I8_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -13 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:111:42
|
LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -13) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I16_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -25 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:113:42
|
LL | const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I32_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -30 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:115:42
|
LL | const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I64_NEG_RANDOM` failed here
error[E0080]: overflowing shift by -93 in `unchecked_shr`
--> $DIR/const-int-unchecked.rs:117:44
|
LL | const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `SHR_I128_NEG_RANDOM` failed here
error[E0080]: arithmetic overflow in `unchecked_add`
--> $DIR/const-int-unchecked.rs:122:25
|
LL | const _: u16 = unsafe { std::intrinsics::unchecked_add(40000u16, 30000) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: arithmetic overflow in `unchecked_sub`
--> $DIR/const-int-unchecked.rs:125:25
|
LL | const _: u32 = unsafe { std::intrinsics::unchecked_sub(14u32, 22) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: arithmetic overflow in `unchecked_mul`
--> $DIR/const-int-unchecked.rs:128:25
|
LL | const _: u16 = unsafe { std::intrinsics::unchecked_mul(300u16, 250u16) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: dividing by zero
--> $DIR/const-int-unchecked.rs:131:25
|
LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(1, 0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: overflow in signed division (dividing MIN by -1)
--> $DIR/const-int-unchecked.rs:133:25
|
LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(i32::MIN, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: calculating the remainder with a divisor of zero
--> $DIR/const-int-unchecked.rs:136:25
|
LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(1, 0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: overflow in signed remainder (dividing MIN by -1)
--> $DIR/const-int-unchecked.rs:138:25
|
LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(i32::MIN, -1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: `ctlz_nonzero` called on 0
--> $DIR/const-int-unchecked.rs:143:25
|
LL | const _: u32 = unsafe { std::intrinsics::ctlz_nonzero(0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error[E0080]: `cttz_nonzero` called on 0
--> $DIR/const-int-unchecked.rs:145:25
|
LL | const _: u32 = unsafe { std::intrinsics::cttz_nonzero(0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_` failed here
error: aborting due to 49 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `1_usize - 2_usize`, which would overflow
--> $DIR/const-len-underflow-separate-spans.rs:10:20
|
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `LEN` failed here
note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:15:17

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `1_usize - 2_usize`, which would overflow
--> $DIR/const-len-underflow-separate-spans.rs:10:20
|
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `LEN` failed here
note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:15:17

View File

@@ -8,7 +8,7 @@
const ONE: usize = 1;
const TWO: usize = 2;
const LEN: usize = ONE - TWO;
//~^ NOTE constant
//~^ NOTE failed here
//~| ERROR attempt to compute `1_usize - 2_usize`, which would overflow
fn main() {

View File

@@ -2,7 +2,7 @@ error[E0080]: attempt to compute `1_usize - 2_usize`, which would overflow
--> $DIR/const-len-underflow-subspans.rs:8:17
|
LL | let a: [i8; ONE - TWO] = unimplemented!();
| ^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^ evaluation of `main::{constant#0}` failed here
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: null-ness of this pointer cannot be determine
--> $DIR/const-ptr-is-null.rs:22:14
|
LL | assert!(!ptr.wrapping_sub(512).is_null());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `MAYBE_NULL` failed inside this call
|
note: inside `std::ptr::const_ptr::<impl *const i32>::is_null`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL

View File

@@ -2,13 +2,13 @@ error[E0080]: `extern type` does not have known layout
--> $DIR/const-size_of_val-align_of_val-extern-type.rs:10:31
|
LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_SIZE` failed here
error[E0080]: `extern type` does not have known layout
--> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:32
|
LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_ALIGN` failed here
error: aborting due to 2 previous errors

View File

@@ -2,7 +2,7 @@ error[E0080]: index out of bounds: the length is 3 but the index is 5
--> $DIR/const-slice-oob.rs:2:18
|
LL | const BAR: u32 = FOO[5];
| ^^^^^^ evaluation of constant value failed here
| ^^^^^^ evaluation of `BAR` failed here
error: aborting due to 1 previous error

View File

@@ -2,13 +2,13 @@ error[E0080]: evaluation panicked: called `Option::unwrap()` on a `None` value
--> $DIR/const-unwrap.rs:6:18
|
LL | const BAR: i32 = Option::<i32>::None.unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAR` failed here
error[E0080]: evaluation panicked: absolutely not!
--> $DIR/const-unwrap.rs:9:18
|
LL | const BAZ: i32 = Option::<i32>::None.expect("absolutely not!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAZ` failed here
error: aborting due to 2 previous errors

View File

@@ -19,7 +19,7 @@ error[E0080]: constant accesses mutable global memory
--> $DIR/const_refs_to_static_fail.rs:18:13
|
LL | assert!(*C2 == 0);
| ^^^ evaluation of constant value failed here
| ^^^ evaluation of `C2_READ` failed here
error: aborting due to 2 previous errors

View File

@@ -8,7 +8,7 @@ const unsafe fn foo(x: bool) -> bool {
}
const BAR: bool = unsafe { foo(false) };
//~^ NOTE evaluation of constant value failed
//~^ NOTE failed inside this call
//~| ERROR entering unreachable code
fn main() {

View File

@@ -2,7 +2,7 @@ error[E0080]: entering unreachable code
--> $DIR/const_unsafe_unreachable_ub.rs:10:28
|
LL | const BAR: bool = unsafe { foo(false) };
| ^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^ evaluation of `BAR` failed inside this call
|
note: inside `foo`
--> $DIR/const_unsafe_unreachable_ub.rs:4:18

View File

@@ -2,7 +2,7 @@ error[E0080]: evaluation panicked: assertion failed: false
--> $DIR/assert.rs:5:15
|
LL | const _: () = assert!(false);
| ^^^^^^^^^^^^^^ evaluation of constant value failed here
| ^^^^^^^^^^^^^^ evaluation of `_` failed here
error: aborting due to 1 previous error

Some files were not shown because too many files have changed in this diff Show More