Skip to content

Replace try_reserve_exact with try_with_capacity in std::fs::read#141211

Merged
bors merged 1 commit intorust-lang:masterfrom
fluiderson:dev
May 20, 2025
Merged

Replace try_reserve_exact with try_with_capacity in std::fs::read#141211
bors merged 1 commit intorust-lang:masterfrom
fluiderson:dev

Conversation

@fluiderson
Copy link
Contributor

This change restores the previous behavior prior to #117925. That PR was made to handle OOM errors that turn into a panic with Vec::with_capacity. try_reserve_exact was used for that since there was no try_with_capacity method at the time. It was added later in #120504. I think it'd a better fit here.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants