-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Feature gates:
#![feature(pointer_byte_offsets)]
#![feature(const_pointer_byte_offsets)]
This is a tracking issue for the pointer_byte_offsets raw pointer conveniences like ptr.byte_add(offset)
Public API
impl<T: ?Sized> *const T {
// feature gates `pointer_byte_offsets` and `const_pointer_byte_offsets`
pub const unsafe fn byte_offset(self, count: isize) -> Self;
pub const unsafe fn byte_add(self, count: usize) -> Self;
pub const unsafe fn byte_sub(self, count: usize) -> Self;
pub const fn wrapping_byte_offset(self, count: isize) -> Self;
pub const fn wrapping_byte_add(self, count: usize) -> Self;
pub const fn wrapping_byte_sub(self, count: usize) -> Self;
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize;
}
// ... and the same for` *mut T`
Steps / History
- Implementation: Add convenience byte offset/check align functions to pointers #95643
- Making
byte_offset_from
more generic: Makepointer::byte_offset_from
more generic #103489 - Final comment period (FCP): Tracking Issue for pointer_bytes_offsets #96283 (comment)
- Stabilization PR: Stabilize
[const_]pointer_byte_offsets
#116205
Unresolved Questions
- Should these operations actually accomodate DSTs? This seems deeply semantically dubious/broken but idk, you can plausibly use them right if you are extremely careful and understand the implications of stacked borrows for slices/projections.
ajwerner, xSetech, goffrie and marc0246KolskyDCNick3
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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.