Commit cf863b5
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 1bb71c8 commit cf863b5
1 file changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
266 | 292 | | |
267 | 293 | | |
268 | 294 | | |
| |||
0 commit comments