Commit 32e4186
committed
Add example of reversed pointer bytes being rejected
Let's add an example demonstrating that reversing the order of pointer
bytes causes compilation to fail, even though all bytes are present.
The compiler tracks the position of each byte within its original
pointer and only accepts pointers when reassembled in the correct
order.
This example copies a pointer byte-by-byte in reverse order into the
padding of a struct, which fails because the fragment indices don't
match up to form a valid pointer.
Context:
- rust-lang/rust#1440811 parent 3404252 commit 32e4186
1 file changed
+22
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
267 | 289 | | |
268 | 290 | | |
269 | 291 | | |
| |||
0 commit comments