]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/ptr_comparisons.stderr
Auto merge of #83572 - pkubaj:patch-1, r=nagisa
[rust.git] / src / test / ui / consts / ptr_comparisons.stderr
1 error: any use of this value will cause an error
2   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3    |
4 LL |         unsafe { intrinsics::offset(self, count) }
5    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |                  |
7    |                  pointer arithmetic failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD
8    |                  inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9    |                  inside `_` at $DIR/ptr_comparisons.rs:61:34
10    | 
11   ::: $DIR/ptr_comparisons.rs:61:1
12    |
13 LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
14    | -------------------------------------------------------------------
15    |
16    = note: `#[deny(const_err)]` on by default
17    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
18    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
19
20 error: any use of this value will cause an error
21   --> $DIR/ptr_comparisons.rs:64:33
22    |
23 LL | / const _: *const u8 =
24 LL | |     unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
25    | |_________________________________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^___-
26    |                                   |
27    |                                   memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD
28    |
29    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
30    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
31
32 error: any use of this value will cause an error
33   --> $DIR/ptr_comparisons.rs:68:27
34    |
35 LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
36    | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
37    |                           |
38    |                           cannot cast pointer to integer because it was not created by cast from integer
39    |
40    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
41    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
42
43 error: any use of this value will cause an error
44   --> $DIR/ptr_comparisons.rs:73:27
45    |
46 LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
47    | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
48    |                           |
49    |                           cannot cast pointer to integer because it was not created by cast from integer
50    |
51    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
52    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
53
54 error: aborting due to 4 previous errors
55