Skip to content
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

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Jul 1, 2024

Makes progress on #29

@joshlf joshlf mentioned this pull request Jul 1, 2024
74 tasks
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from a61e5f0 to 35043ae Compare September 7, 2024 22:25
@joshlf joshlf marked this pull request as ready for review September 7, 2024 22:48
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from 35043ae to ed98c2b Compare September 7, 2024 22:49
@joshlf joshlf requested a review from jswrenn September 7, 2024 22:49
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from ed98c2b to 7afe1a0 Compare September 7, 2024 22:53
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from 7afe1a0 to 5484197 Compare September 7, 2024 22:58
@@ -570,6 +570,10 @@ impl<Src, Dst: ?Sized + TryFromBytes> TryReadError<Src, Dst> {
}
}

/// The error type of a failed allocation.
Copy link
Collaborator

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.

Copy link
Member Author

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)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let layout = Layout::from_size_align(size, align).map_err(|_| AllocError)?;
let layout = Layout::from_size_align(size, align).unwrap_or(AllocError)?;

Copy link
Member Author

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.

@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from 5484197 to d16421a Compare September 7, 2024 23:17
@joshlf joshlf added this pull request to the merge queue Sep 7, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 86.27451% with 7 lines in your changes missing coverage. Please review.

Project coverage is 87.76%. Comparing base (02dc876) to head (d16421a).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/lib.rs 86.00% 7 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 7, 2024
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from d16421a to 72f7c44 Compare September 8, 2024 00:03
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch 2 times, most recently from 066f9a0 to 9fa6f18 Compare September 8, 2024 00:16
Change methods that allocate to return a new error, `AllocError`, on
allocation failure rather than panicking or aborting.

Makes progress on #29
@joshlf joshlf force-pushed the from-zeros-known-layout-apis branch from 9fa6f18 to b2aab26 Compare September 8, 2024 00:22
@joshlf joshlf added this pull request to the merge queue Sep 8, 2024
Merged via the queue into main with commit 623a5ee Sep 8, 2024
74 checks passed
@joshlf joshlf deleted the from-zeros-known-layout-apis branch September 8, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants