Commit cbd9361
authored
Rollup merge of #155326 - nnethercote:disallow-ZST-TypedArena, r=Nadrieril
Disallow ZST allocations with `TypedArena`.
`DroplessArena::alloc` already disallows ZST allocation. `TypedArena::alloc` allows it but:
- (a) it's never used, and
- (b) writing to `NonNull::dangling()` seems dubious, even if the write is zero-sized.
This commit just changes it to panic on a ZST. This eliminates an untested code path, and we shouldn't be allocating ZSTs anyway. It also eliminates an unused ZST code path in `clear_last_chunk`.
r? @Nadrieril2 files changed
Lines changed: 15 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
| |||
302 | 296 | | |
303 | 297 | | |
304 | 298 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
315 | 303 | | |
316 | 304 | | |
317 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 119 | | |
133 | 120 | | |
134 | 121 | | |
| |||
207 | 194 | | |
208 | 195 | | |
209 | 196 | | |
210 | | - | |
| 197 | + | |
| 198 | + | |
211 | 199 | | |
212 | 200 | | |
213 | 201 | | |
| |||
222 | 210 | | |
223 | 211 | | |
224 | 212 | | |
225 | | - | |
| 213 | + | |
226 | 214 | | |
227 | 215 | | |
228 | 216 | | |
| |||
0 commit comments