-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Tracking issue for shrink_to
feature
#56431
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Someone needs to update |
I was just doing it 😄 |
Update issue number of `shrink_to` methods to point the tracking issue Tracking issue: rust-lang#56431
Update issue number of `shrink_to` methods to point the tracking issue Tracking issue: rust-lang#56431
Currently the I can see |
I would agree with @Amanieu here -- I've just recently found a case where |
67: Change shrink_to to not panic if min_capacity < capacity r=Amanieu a=Amanieu cc rust-lang/rust#56431 Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
I have changed the behavior in hashbrown to no-op if the current capacity is smaller than the minimum (https://github.com/Amanieu/hashbrown/pull/67). There is currently still an assert in the libstd wrapper around hashbrown that panics though. |
IMHO I would prefer shrink_to not to panic. I think it is better to return
With this change if I need code to panic, I will just |
…k-Simulacrum Trying to shrink_to greater than capacity should be no-op Per the discussion in rust-lang#56431, `shrink_to` shouldn't panic if you try to make a vector shrink to a capacity greater than its current capacity.
I think #81335 fixed the last remaining concern. |
@marmeladema I'd love for this API to be stabilized. Is there anything I can do to help out? |
@kwf Feel free to file a stabilize PR. See: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr |
Uh oh!
There was an error while loading. Please reload this page.
Steps
shrink_to
method on collections #49400)shrink_to
feature #56431 (comment)Questions
cc @Diggsey
The text was updated successfully, but these errors were encountered: