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