]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/offset_ub.stderr
Rollup merge of #83634 - JohnTitor:proc-macro-ice, r=varkor
[rust.git] / src / test / ui / consts / offset_ub.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    |                  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    |                  inside `BEFORE_START` at $DIR/offset_ub.rs:6:46
10    | 
11   ::: $DIR/offset_ub.rs:6:1
12    |
13 LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
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   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
22    |
23 LL |         unsafe { intrinsics::offset(self, count) }
24    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25    |                  |
26    |                  inbounds test failed: pointer must be in-bounds at offset 2, but is outside bounds of allocN which has size 1
27    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
28    |                  inside `AFTER_END` at $DIR/offset_ub.rs:7:43
29    | 
30   ::: $DIR/offset_ub.rs:7:1
31    |
32 LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
33    | --------------------------------------------------------------------------
34    |
35    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
36    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
37
38 error: any use of this value will cause an error
39   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
40    |
41 LL |         unsafe { intrinsics::offset(self, count) }
42    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43    |                  |
44    |                  inbounds test failed: pointer must be in-bounds at offset 101, but is outside bounds of allocN which has size 100
45    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
46    |                  inside `AFTER_ARRAY` at $DIR/offset_ub.rs:8:45
47    | 
48   ::: $DIR/offset_ub.rs:8:1
49    |
50 LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
51    | ------------------------------------------------------------------------------
52    |
53    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
54    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
55
56 error: any use of this value will cause an error
57   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
58    |
59 LL |         unsafe { intrinsics::offset(self, count) }
60    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61    |                  |
62    |                  overflowing in-bounds pointer arithmetic
63    |                  inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
64    |                  inside `OVERFLOW` at $DIR/offset_ub.rs:10:43
65    | 
66   ::: $DIR/offset_ub.rs:10:1
67    |
68 LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
69    | ----------------------------------------------------------------------------------
70    |
71    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
72    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
73
74 error: any use of this value will cause an error
75   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
76    |
77 LL |         unsafe { intrinsics::offset(self, count) }
78    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
79    |                  |
80    |                  overflowing in-bounds pointer arithmetic
81    |                  inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
82    |                  inside `UNDERFLOW` at $DIR/offset_ub.rs:11:44
83    | 
84   ::: $DIR/offset_ub.rs:11:1
85    |
86 LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
87    | -----------------------------------------------------------------------------------
88    |
89    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
90    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
91
92 error: any use of this value will cause an error
93   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
94    |
95 LL |         unsafe { intrinsics::offset(self, count) }
96    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97    |                  |
98    |                  overflowing in-bounds pointer arithmetic
99    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
100    |                  inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:12:56
101    | 
102   ::: $DIR/offset_ub.rs:12:1
103    |
104 LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
105    | ---------------------------------------------------------------------------------------------
106    |
107    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
108    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
109
110 error: any use of this value will cause an error
111   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
112    |
113 LL |         unsafe { intrinsics::offset(self, count) }
114    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115    |                  |
116    |                  overflowing in-bounds pointer arithmetic
117    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
118    |                  inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:57
119    | 
120   ::: $DIR/offset_ub.rs:13:1
121    |
122 LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
123    | --------------------------------------------------------------------------------------
124    |
125    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
126    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
127
128 error: any use of this value will cause an error
129   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
130    |
131 LL |         unsafe { intrinsics::offset(self, count) }
132    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133    |                  |
134    |                  inbounds test failed: pointer must be in-bounds at offset 1, but is outside bounds of allocN which has size 0
135    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
136    |                  inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:15:50
137    | 
138   ::: $DIR/offset_ub.rs:15:1
139    |
140 LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
141    | -------------------------------------------------------------------------------
142    |
143    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
144    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
145
146 error: any use of this value will cause an error
147   --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
148    |
149 LL |         unsafe { intrinsics::offset(self, count) as *mut T }
150    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151    |                  |
152    |                  unable to turn bytes into a pointer
153    |                  inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
154    |                  inside `DANGLING` at $DIR/offset_ub.rs:16:42
155    | 
156   ::: $DIR/offset_ub.rs:16:1
157    |
158 LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
159    | ---------------------------------------------------------------------------------------------
160    |
161    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
162    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
163
164 error: any use of this value will cause an error
165   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
166    |
167 LL |         unsafe { intrinsics::offset(self, count) }
168    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169    |                  |
170    |                  inbounds test failed: 0x0 is not a valid pointer
171    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
172    |                  inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:19:50
173    | 
174   ::: $DIR/offset_ub.rs:19:1
175    |
176 LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
177    | -------------------------------------------------------------------------------
178    |
179    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
180    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
181
182 error: any use of this value will cause an error
183   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
184    |
185 LL |         unsafe { intrinsics::offset(self, count) }
186    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
187    |                  |
188    |                  unable to turn bytes into a pointer
189    |                  inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
190    |                  inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:22:47
191    | 
192   ::: $DIR/offset_ub.rs:22:1
193    |
194 LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
195    | ---------------------------------------------------------------------------------------------
196    |
197    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
198    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
199
200 error: aborting due to 11 previous errors
201