Commit f4c6e2f
authored
Rollup merge of rust-lang#122601 - joboet:ptr_replace, r=workingjubilee
Optimize `ptr::replace`
rust-lang#83022 optimized `mem::replace` to reduce the number of `memcpy`s. `ptr::replace`, which is [documented to behave just like `mem::replace`](https://doc.rust-lang.org/nightly/std/ptr/fn.replace.html), was not optimized however, leading to [worse code](https://godbolt.org/z/T3hdEEdfe) and missed optimizations. This PR simply forwards `ptr::replace` to `mem::replace` to take advantage of the better implementation.1 file changed
+2
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1114 | 1114 | | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | | - | |
| 1117 | + | |
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | | - | |
| 1131 | + | |
1132 | 1132 | | |
1133 | | - | |
1134 | 1133 | | |
1135 | 1134 | | |
1136 | 1135 | | |
| |||
0 commit comments