bincode icon indicating copy to clipboard operation
bincode copied to clipboard

[WIP] Deny OOM, embrace `try_reserve`

Open VictorKoenders opened this issue 3 years ago • 3 comments

With Rust 1.57, several try_reserve methods have been stabilized. This PR makes bincode take advantage of this.

A nightly flag can be set to disable all fallible allocations. This is currently blocked on the following features:

And uses the following features, although this could be implemented manually:

Other useful issues:

  • [ ] Vec::push_within_capacity to reduce the amount of unsafe code to replace Vec::push tracking issue

VictorKoenders avatar Dec 11 '21 09:12 VictorKoenders

Codecov Report

Attention: Patch coverage is 51.36986% with 71 lines in your changes are missing coverage. Please review.

Project coverage is 57.05%. Comparing base (e7dff9d) to head (c4e11a1). Report is 2 commits behind head on trunk.

Files Patch % Lines
src/features/impl_alloc.rs 53.43% 61 Missing :warning:
src/error.rs 0.00% 5 Missing :warning:
src/features/impl_std.rs 50.00% 2 Missing :warning:
src/features/serde/mod.rs 0.00% 2 Missing :warning:
src/features/serde/de_borrowed.rs 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk     #448      +/-   ##
==========================================
- Coverage   57.21%   57.05%   -0.16%     
==========================================
  Files          51       51              
  Lines        4410     4427      +17     
==========================================
+ Hits         2523     2526       +3     
- Misses       1887     1901      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Dec 11 '21 09:12 codecov-commenter

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 02 '22 17:04 stale[bot]

image Forgot a closing paren there in the PR description?

gimbling-away avatar Oct 10 '22 14:10 gimbling-away