fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.9 KiB54 linesraw
1error[E0080]: evaluation of constant value failed
2  --> $DIR/const-compare-bytes-ub.rs:10:9
3   |
4LL |         compare_bytes(0 as *const u8, 2 as *const u8, 0)
5   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
6
7error[E0080]: evaluation of constant value failed
8  --> $DIR/const-compare-bytes-ub.rs:14:9
9   |
10LL |         compare_bytes(1 as *const u8, 0 as *const u8, 0)
11   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
12
13error[E0080]: evaluation of constant value failed
14  --> $DIR/const-compare-bytes-ub.rs:18:9
15   |
16LL |         compare_bytes(1 as *const u8, 2 as *const u8, 1)
17   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
18
19error[E0080]: evaluation of constant value failed
20  --> $DIR/const-compare-bytes-ub.rs:22:9
21   |
22LL |         compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
23   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc6 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
24
25error[E0080]: evaluation of constant value failed
26  --> $DIR/const-compare-bytes-ub.rs:26:9
27   |
28LL |         compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
29   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc13 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
30
31error[E0080]: evaluation of constant value failed
32  --> $DIR/const-compare-bytes-ub.rs:30:9
33   |
34LL |         compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
35   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc17[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
36
37error[E0080]: evaluation of constant value failed
38  --> $DIR/const-compare-bytes-ub.rs:34:9
39   |
40LL |         compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
41   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc25[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
42
43error[E0080]: evaluation of constant value failed
44  --> $DIR/const-compare-bytes-ub.rs:38:9
45   |
46LL |         compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>())
47   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
48   |
49   = help: this code performed an operation that depends on the underlying bytes representing a pointer
50   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
51
52error: aborting due to 8 previous errors
53
54For more information about this error, try `rustc --explain E0080`.