Commit 651db87
authored
Rollup merge of #149169 - RalfJung:replace-zst-null-ptr, r=Mark-Simulacrum
ptr::replace: make calls on ZST null ptr not UB
See #138351 for context.
We made `ptr::read` and `ptr::write` not UB on ZST null pointers. This does the same with `ptr::replace`. Since we're just adding a branch on a constant, this should come at no runtime cost.1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1543 | 1543 | | |
1544 | 1544 | | |
1545 | 1545 | | |
1546 | | - | |
| 1546 | + | |
1547 | 1547 | | |
1548 | 1548 | | |
1549 | 1549 | | |
| |||
1554 | 1554 | | |
1555 | 1555 | | |
1556 | 1556 | | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1557 | 1564 | | |
1558 | 1565 | | |
1559 | 1566 | | |
| |||
0 commit comments