Commit 2c31c96
authored
Rollup merge of #90099 - SkiFire13:fix-vec-swap-remove, r=dtolnay
Fix MIRI UB in `Vec::swap_remove`
Fixes #90055
I find it weird that `Vec::swap_remove` read the last element to the stack just to immediately put it back in the `Vec` in place of the one at index `index`. It seems much more natural to me to just read the element at position `index` and then move the last element in its place. I guess this might also slightly improve codegen.1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1305 | 1305 | | |
1306 | 1306 | | |
1307 | 1307 | | |
1308 | | - | |
1309 | | - | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1310 | 1311 | | |
1311 | | - | |
| 1312 | + | |
1312 | 1313 | | |
1313 | 1314 | | |
1314 | 1315 | | |
| |||
0 commit comments