Commit 5639d97
authored
Rollup merge of rust-lang#78476 - RalfJung:btree-alias, r=Mark-Simulacrum
fix some incorrect aliasing in the BTree
This line is wrong:
```
ptr::copy(slice.as_ptr().add(idx), slice.as_mut_ptr().add(idx + 1), slice.len() - idx);
```
When `slice.as_mut_ptr()` is called, that creates a mutable reference to the entire slice, which invalidates the raw pointer previously returned by `slice.as_ptr()`. (Miri currently misses this because raw pointers are not tracked properly.)
Cc ````````@ssomers````````1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1608 | 1608 | | |
1609 | 1609 | | |
1610 | 1610 | | |
1611 | | - | |
1612 | | - | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
1613 | 1615 | | |
1614 | 1616 | | |
1615 | 1617 | | |
1616 | 1618 | | |
1617 | 1619 | | |
1618 | | - | |
1619 | | - | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1620 | 1624 | | |
1621 | 1625 | | |
1622 | 1626 | | |
| |||
0 commit comments