Tracking issue for ptr::offset_from (feature: ptr_offset_from) #41079
Closed
Description
opened on Apr 5, 2017
PR: #40943
Adds an offset_to
method to calculate the distance between two raw pointers.
List o' stuff:
- Rename to
offset_from
and make unsafe (withwrapping_offset_from
for the safe one) Tracking issue for ptr::offset_from (feature: ptr_offset_from) #41079 (comment) -- done in Introduce unsafe offset_from on pointers #49297- Should
offset_from
abort instead of panic on ZSTs?
- Should
- Given that the difference between arbitrary pointers is meaningless and subject to change at the whims of LLVM anyway, do we even want the safe version? Tracking issue for ptr::offset_from (feature: ptr_offset_from) #41079 (comment) Experience reports from the field appreciated.
- Should there be more methods like this with different restrictions (to allow nuw/nsw, perhaps) or that return
usize
(like how isize-takingoffset
is more conveniently done with usize-takingadd
these days) - Ensure that our safety requirements align with the proposed llvm.psub [LLVM9+] Use llvm.psub in offset_from #57818
Metadata
Assignees
Labels
Area: raw pointers, MaybeUninit, NonNullBlocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are tracked on the team's project board.Relevant to the library API team, which will review and decide on the PR/issue.
Activity