summary refs log tree commit diff
path: root/src/test/ui/consts/ptr_comparisons.stderr
blob: 493d9be8f71b7077f9ddb4be345d143531fdfe2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
error: any use of this value will cause an error
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
LL |         unsafe { intrinsics::offset(self, count) }
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                  |
   |                  inbounds test failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD
   |                  inside `std::ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |                  inside `_` at $DIR/ptr_comparisons.rs:62:34
   | 
  ::: $DIR/ptr_comparisons.rs:62:1
   |
LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
   | -------------------------------------------------------------------
   |
   = note: `#[deny(const_err)]` on by default

error: any use of this value will cause an error
  --> $DIR/ptr_comparisons.rs:67:14
   |
LL | / const _: *const u8 =
LL | |
LL | |     unsafe { std::ptr::raw_const!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
   | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__-
   |                |
   |                memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: any use of this value will cause an error
  --> $DIR/ptr_comparisons.rs:70:27
   |
LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
   | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
   |                           |
   |                           "pointer-to-integer cast" needs an rfc before being allowed inside constants

error: any use of this value will cause an error
  --> $DIR/ptr_comparisons.rs:75:27
   |
LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
   | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
   |                           |
   |                           "pointer-to-integer cast" needs an rfc before being allowed inside constants

error: aborting due to 4 previous errors