]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/offset_ub.stderr
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / offset_ub.stderr
1 error[E0080]: evaluation of constant value failed
2   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3    |
4 LL |         unsafe { intrinsics::offset(self, count) }
5    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |                  |
7    |                  overflowing in-bounds pointer arithmetic
8    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9    |
10   ::: $DIR/offset_ub.rs:8:46
11    |
12 LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
13    |                                              ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:8:46
14
15 error[E0080]: evaluation of constant value failed
16   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
17    |
18 LL |         unsafe { intrinsics::offset(self, count) }
19    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20    |                  |
21    |                  pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
22    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
23    |
24   ::: $DIR/offset_ub.rs:9:43
25    |
26 LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
27    |                                           ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:9:43
28
29 error[E0080]: evaluation of constant value failed
30   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
31    |
32 LL |         unsafe { intrinsics::offset(self, count) }
33    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34    |                  |
35    |                  pointer arithmetic failed: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
36    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
37    |
38   ::: $DIR/offset_ub.rs:10:45
39    |
40 LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
41    |                                             ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:10:45
42
43 error[E0080]: evaluation of constant value failed
44   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
45    |
46 LL |         unsafe { intrinsics::offset(self, count) }
47    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48    |                  |
49    |                  overflowing in-bounds pointer arithmetic
50    |                  inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
51    |
52   ::: $DIR/offset_ub.rs:12:43
53    |
54 LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
55    |                                           ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:12:43
56
57 error[E0080]: evaluation of constant value failed
58   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
59    |
60 LL |         unsafe { intrinsics::offset(self, count) }
61    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62    |                  |
63    |                  overflowing in-bounds pointer arithmetic
64    |                  inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
65    |
66   ::: $DIR/offset_ub.rs:13:44
67    |
68 LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
69    |                                            ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:13:44
70
71 error[E0080]: evaluation of constant value failed
72   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
73    |
74 LL |         unsafe { intrinsics::offset(self, count) }
75    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76    |                  |
77    |                  overflowing in-bounds pointer arithmetic
78    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
79    |
80   ::: $DIR/offset_ub.rs:14:56
81    |
82 LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
83    |                                                        ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:56
84
85 error[E0080]: evaluation of constant value failed
86   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
87    |
88 LL |         unsafe { intrinsics::offset(self, count) }
89    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90    |                  |
91    |                  overflowing in-bounds pointer arithmetic
92    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
93    |
94   ::: $DIR/offset_ub.rs:15:57
95    |
96 LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
97    |                                                         --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:15:57
98
99 error[E0080]: evaluation of constant value failed
100   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
101    |
102 LL |         unsafe { intrinsics::offset(self, count) }
103    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104    |                  |
105    |                  pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
106    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
107    |
108   ::: $DIR/offset_ub.rs:16:49
109    |
110 LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
111    |                                                 ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:16:49
112
113 error[E0080]: evaluation of constant value failed
114   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
115    |
116 LL |         unsafe { intrinsics::offset(self, count) }
117    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118    |                  |
119    |                  pointer arithmetic failed: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
120    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
121    |
122   ::: $DIR/offset_ub.rs:18:50
123    |
124 LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
125    |                                                  --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:18:50
126
127 error[E0080]: evaluation of constant value failed
128   --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
129    |
130 LL |         unsafe { intrinsics::offset(self, count) as *mut T }
131    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132    |                  |
133    |                  0x1 is not a valid pointer
134    |                  inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
135    |
136   ::: $DIR/offset_ub.rs:19:42
137    |
138 LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
139    |                                          ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:19:42
140
141 error[E0080]: evaluation of constant value failed
142   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
143    |
144 LL |         unsafe { intrinsics::offset(self, count) }
145    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146    |                  |
147    |                  pointer arithmetic failed: 0x0 is not a valid pointer
148    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
149    |
150   ::: $DIR/offset_ub.rs:22:50
151    |
152 LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
153    |                                                  --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:22:50
154
155 error[E0080]: evaluation of constant value failed
156   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
157    |
158 LL |         unsafe { intrinsics::offset(self, count) }
159    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
160    |                  |
161    |                  0x7f..f is not a valid pointer
162    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
163    |
164   ::: $DIR/offset_ub.rs:25:47
165    |
166 LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
167    |                                               -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:25:47
168
169 error: aborting due to 12 previous errors
170
171 For more information about this error, try `rustc --explain E0080`.