Repository navigation
Tracking issue for const slice::from_raw_parts_mut (const_slice_from_raw_parts_mut) #67456
Description
Activity
- addedT-langRelevant to the language teamRelevant to the language teamT-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]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 RFCA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)
on Dec 21, 2019 - changed the title
[-]feature request: const slice::from_raw_parts[/-][+]Tracking issue for const slice::from_raw_parts[/+]on Jan 21, 2020 Is there particular reason why it remains gated by feature flag instead of just being const fn as it is?
Is there particular reason why it remains gated by feature flag instead of just being const fn as it is?
The constant versions of function's and methods in libcore/libstd need a period of time under a feature flag before they can be stabilized as a const function/method. Const functions are 'relatively' new, and the ability of what one can do inside isn't fully determined yet I think.
One of those abilities is how to handle raw pointers, whichslice::from_raw_parts[mut]needs.@DutchGhost would it make sense for the
slice::{from_raw_parts[_mut], from_ref, from_mut}to be constified behind this feature as well? The only thing that seems blocking that is this debug_assert which callsis_aligned_and_not_null.Checking the alignment will need support from the MIR interpreter, see #62420
Reacted by kennytm- addedA-sliceArea: `[T]`Area: `[T]`B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.Libs-SmallLibs issues that are considered "small" or self-containedLibs issues that are considered "small" or self-containedI-libs-radarLibs issues that are tracked on the team's radar.Libs issues that are tracked on the team's radar.
on Jul 29, 2020 32 remaining items
- removedproposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
on Sep 24, 2024 🔔 This is now entering its final comment period, as per the review above. 🔔
Weird. My box was ticked, but FCP didn't get triggered. I unticked and re-ticked my box.
- changed the title
[-]Tracking issue for const slice::from_raw_parts[/-][+]Tracking issue for const slice::from_raw_parts_mut (const_slice_from_raw_parts_mut)[/+]on Sep 24, 2024 - addedfinished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.to-announceAnnounce this issue on triage meetingAnnounce this issue on triage meetingand removedfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
on Oct 4, 2024 The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
This will be merged soon.
- added a commit that references this issue
on Oct 5, 2024 - removedto-announceAnnounce this issue on triage meetingAnnounce this issue on triage meeting
on Oct 17, 2024
Make
slice::from_raw_partsandslice::from_raw_parts_muta const fn available under a feature flag.This would require a change in the
ptrmodule as well, as slice module just forwards to it.slice::from_raw_parts[mut]is used in alot of places (e.gslice::from_ref[mut], which would get one step closer into constification ifslice::from_raw_parts[mut]is a const fn.Here is a little playground to show it's possible:
https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=dd5c506a3e082c619f557d972e9956ff
In order to get this working, the following functions and functionalities need to be constified:
ptr::slice_from_raw_parts(Make ptr::slice_from_raw_parts a const fn available under a feature flag #67462)Implementation PR for
ptr::slice_from_raw_parts: #67462Partially stabilized in #97522; remaining unstable functions: