-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(pointer_is_aligned)]
Feature gate: #![feature(pointer_is_aligned_to)]
This is a tracking issue for ptr.is_aligned()
andptr.is_aligned_to(alignment)
.
Public API
impl *const T {
// feature gate `pointer_is_aligned` was stabilized
// pub fn is_aligned(self) -> bool where T: Sized;
// feature gate `pointer_is_aligned_to`
pub fn is_aligned_to(self, align: usize) -> bool;
}
// ... and the same for` *mut T`
impl <T: ?Sized> NonNull<T> {
pub const fn is_aligned_to(self, align: usize) -> bool;
}
Steps / History
pointer_is_aligned
:
- Implementation: Add convenience byte offset/check align functions to pointers #95643
- Final comment period (FCP): stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate #121948 (comment)
- Stabilization PR: stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate #121948
pointer_is_aligned_to
:
- Implementation: Add convenience byte offset/check align functions to pointers #95643 and stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate #121948
- Move the
NonNull
method to this gate Stabilizenon_null_convenience
#124498 - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- Should is_aligned_to require a power of two or should it be more flexible? (currently panics)
mcobzarenco, jablonskim, MaxVerevkin, orzogc, joseluis and 1 more
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.