about summary refs log tree commit diff
path: root/library/alloc/src/vec/in_place_drop.rs
AgeCommit message (Collapse)AuthorLines
2025-02-23rename sub_ptr 😅bendn-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-04-12Avoid more NonNull-raw-NonNull roundtrips in VecBen Kimock-3/+4
2024-01-19fix: Drop guard was deallocating with the incorrect sizeThe 8472-8/+18
InPlaceDstBufDrop holds onto the allocation before the shrinking happens which means it must deallocate the destination elements but the source allocation.
2022-09-10Fix leaking in inplace collection when destructor panicsGiacomo Stevanato-0/+15
2022-05-11Rename `unsigned_offset_from` to `sub_ptr`Scott McMurray-1/+1
2022-05-11Add `unsigned_offset_from` on pointersScott McMurray-1/+1
Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`. Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`. As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives. That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change. This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE. It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
2020-12-29style: applying Rust styleC-3/+3
2020-12-29refactor: moved InPlaceDrop into in_place_drop.rsC-0/+24