-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for making ptr offset methods "const fn" #71499
Copy link
Copy link
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)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.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The feature gate for this is
#![feature(const_ptr_offset)]. Miri has been able to handle this for some time. This feature allows code like:The following intrinsic functions will be made
const fn:intrinsics::offsetintrinsics::arith_offsetThe allows the following
*const/*mutmethods to beconst fn:offsetwrapping_offsetadd/subwrapping_add/wrapping_subThe following methods are not part of this issue:
align_offset: See align_offset guarantees #62420offset_from: Tracked as part of Tracking issue for ptr::offset_from (feature: ptr_offset_from) #41079 and Tracking Issue for const offset_from (const_ptr_offset_from) #92980wrapping_offset_from: Not possible across different allocationsSteps (based on #69821)
core/alloc/stdfunctions should be made const along with this.offsetandarith_offsetUnresolved Questions
offset == 0be handled?CC: @RalfJung @oli-obk @rust-lang/wg-const-eval