Repository navigation
Tracking Issue for const_ptr_read #80377
Description
Activity
- addedC-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-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]
on Dec 26, 2020 - changed the title
[-]Tracking Issue for XXX[/-][+]Tracking Issue for const_ptr_read[/+]on Dec 26, 2020 - added a commit that references this issue
on Dec 26, 2020 Should this be mentioned in #57563?
- addedI-libs-radarLibs issues that are tracked on the team's radar.Libs issues that are tracked on the team's radar.
on Jan 6, 2021 Are
writevariants also on the track for "constification"?- Implementation: Make copy[_nonoverlapping] const #79684
I guess it can be checked now
Are write variants also on the track for "constification"?
Let's say they are on the wish list. ;) With #80290, making them
constshould actually be pretty easy now.Reacted by CaioDo we need to wait for #80418 (for allowing borrowing) to hit beta before
writecan be implemented without multiple implementations behind#[cfg(bootstrap)]or is there any other (not too ugly) way? :)Also
intrinsics::forgetseems to be not const whilemem::forgetis const but internally callsManuallyDrop::new. So how would one best solve that without undoing the "inlining" in #80290?Do we need to wait for #80418 (for allowing borrowing) to hit beta before write can be implemented without multiple implementations behind #[cfg(bootstrap)] or is there any other (not too ugly) way? :)
Well... you could use
&mut. 😆
Probably it's better to wait, though.mem::forget is const but internally calls ManuallyDrop::new
This is supposed to be changed in #79989.
Reacted by Albin Hedmanslightlyoutofphase commented
on Mar 13, 2021 ContributorMore actionsJust popping in to say that I just found out that this and
const_ptr_writeexist and it's like Christmas TBH. The next version I release of my cratestaticvecis going to be absolutely nuts thanks to these, with constpush, constpop, constinsert, and various other things.One thing I'd ask though is if there are plans to make
some_ptr.copy_to(),some_ptr.copy_from()and so on also const-compatible? It seems like there's nothing blocking it, as all of those functions just directly call these intrinsic ones IIRC, and it would be a nice addition on top of this from an ergonomics standpoint.Reacted by Ralf Jung and Albin HedmanOne thing I'd ask though is if there are plans to make some_ptr.copy_to(), some_ptr.copy_from() and so on also const-compatible?
Yeah, those could all easily be made
const fnas well, I think.Reacted by SlightlyOutOfPhase11 remaining items
- addedproposed-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.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.final-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.and 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 Apr 5, 2023 🔔 This is now entering its final comment period, as per the review above. 🔔
- 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 Apr 15, 2023 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.
- removedto-announceAnnounce this issue on triage meetingAnnounce this issue on triage meeting
on Apr 20, 2023 Is there anything left here? #97320 should have closed this issue, no?
Reacted by beef- addedA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)
on Dec 1, 2024
Feature gate:
#![feature(const_ptr_read)]This is a tracking issue for making the functions
ptr::readandptr::read_unaligned, and the same methods on*const Tand*mut T,const fn. This unlocks things like moving values out of arrays in const context.Public API
Steps / History
Related
Unresolved Questions
Inorder to make
intrinsics::copyandintrinsics::copy_nonoverlappingcompile asconst fn, some checks were removed.See comment for some more info
(#79684 did the
Comment out the debug assertions for now.-thing).So the question is, how do we bring them back?