Files
rust/library/alloc
Stuart Cook 51b54598a2 Rollup merge of #152366 - BitSyndicate1:vec-fallible-shrink, r=Mark-Simulacrum
Add try_shrink_to and try_shrink_to_fit to Vec

Adds the functions `try_shrink_to` and `try_shrink_to_fit` to Vec to allow shrinking
in environments without global OOM handling.

The implementation differs from the tracking issue as the fallible methods return
a `TryReserveError` instead of an `AllocError` as `AllocError` is unstable and does
not contain layout information.

Tracking:

- rust-lang/rust#152350
2026-02-23 13:32:00 +11:00
..