-
Notifications
You must be signed in to change notification settings - Fork 104
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
FromZeros boxed slice method supports slice DSTs #1478
Conversation
a61e5f0
to
35043ae
Compare
35043ae
to
ed98c2b
Compare
ed98c2b
to
7afe1a0
Compare
7afe1a0
to
5484197
Compare
@@ -570,6 +570,10 @@ impl<Src, Dst: ?Sized + TryFromBytes> TryReadError<Src, Dst> { | |||
} | |||
} | |||
|
|||
/// The error type of a failed allocation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to document that this will, in the future, be aliased with core::alloc::AllocError
. Otherwise, replacing this type with an alias will be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/lib.rs
Outdated
// TODO(https://github.com/rust-lang/rust/issues/55724): Use | ||
// `Layout::repeat` once it's stabilized. | ||
let layout = | ||
Layout::from_size_align(size, align).expect("total allocation size overflows `isize`"); | ||
let layout = Layout::from_size_align(size, align).map_err(|_| AllocError)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let layout = Layout::from_size_align(size, align).map_err(|_| AllocError)?; | |
let layout = Layout::from_size_align(size, align).unwrap_or(AllocError)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but used .or
instead.
5484197
to
d16421a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1478 +/- ##
==========================================
- Coverage 87.83% 87.76% -0.08%
==========================================
Files 15 15
Lines 5623 5638 +15
==========================================
+ Hits 4939 4948 +9
- Misses 684 690 +6 ☔ View full report in Codecov by Sentry. |
d16421a
to
72f7c44
Compare
066f9a0
to
9fa6f18
Compare
Change methods that allocate to return a new error, `AllocError`, on allocation failure rather than panicking or aborting. Makes progress on #29
9fa6f18
to
b2aab26
Compare
Makes progress on #29