]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/ptr_comparisons.stderr
Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser
[rust.git] / tests / ui / consts / ptr_comparisons.stderr
1 error[E0080]: evaluation of constant value failed
2   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3    |
4    = note: out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds
5    |
6 note: inside `ptr::const_ptr::<impl *const usize>::offset`
7   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
8 note: inside `_`
9   --> $DIR/ptr_comparisons.rs:50:34
10    |
11 LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
12    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14 error[E0080]: evaluation of constant value failed
15   --> $DIR/ptr_comparisons.rs:53:33
16    |
17 LL |     unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
18    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: alloc3 has size $WORD, so pointer to 1000 bytes starting at offset 0 is out-of-bounds
19
20 error[E0080]: evaluation of constant value failed
21   --> $DIR/ptr_comparisons.rs:57:27
22    |
23 LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
24    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
25    |
26    = help: this code performed an operation that depends on the underlying bytes representing a pointer
27    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
28
29 error[E0080]: evaluation of constant value failed
30   --> $DIR/ptr_comparisons.rs:61:27
31    |
32 LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
33    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
34    |
35    = help: this code performed an operation that depends on the underlying bytes representing a pointer
36    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
37
38 error: aborting due to 4 previous errors
39
40 For more information about this error, try `rustc --explain E0080`.