bincode
bincode copied to clipboard
[WIP] Deny OOM, embrace `try_reserve`
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:
- [ ]
allocator_api
tracking issue- [ ] Arc::try_new
- [ ] Rc::try_new
- [ ] Box::try_new_uninit_slice
- [ ] AllocError
- [ ]
new_uninit
tracking issue - [x]
try_reserve
on more collections: tracking issue
And uses the following features, although this could be implemented manually:
- [ ]
maybe_uninit_slice
tracking issue - [x]
vec_spare_capacity
tracking issue (stabilized on jan 18, 2022)
Other useful issues:
- [ ]
Vec::push_within_capacity
to reduce the amount of unsafe code to replaceVec::push
tracking issue
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.
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.
Forgot a closing paren there in the PR description?