-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Handle OOM when writing to Vec
#148024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle OOM when writing to Vec
#148024
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use |
|
Seems similar to #84612 Cc @kornelski |
|
IMHO this is a good idea. This is an It may be worth making this explicit in the documentation that it applies to Vec too. PR #84612 got postponed in hope that |
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The use of these methods will most likely be in generic context anyway, where errors will be properly handled. |
This comment has been minimized.
This comment has been minimized.
|
Prior PRs that converted things to try_reserve |
|
We discussed this during today's libs-API meeting. The issue with this is that there's a lot of code out there that assumes that So instead we'll consider this a part of a future fallible-Vec API, something that remains unsolved. E.g. if we ever introduced a |
Do we have data to back that claim? Additionally, the return value of write! being a Result, the compiler should already complain in such case since the type is marked as must_use right? |
|
We basically looked at code searches, https://github.com/search?q=lang%3ARust+%22_+%3D+write%21%22&type=code |
|
How much of this actually uses |
I haven't found any discussion on this, but I think that handling those OOM is desirable.