-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for mem::conjure_zst (feature(mem_conjure_zst)) #95383
Copy link
Copy link
Open
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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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.
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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature gate:
#![feature(mem_conjure_zst)]This is a tracking issue for the
mem::conjure_zst::<T>()function.There are a variety of possible ways one can do this without this function, but it provides two advantages:
It makes it clearer to the reader what's happening and keeps the code author from needing to decide between
zeroed()oruninitialized()orMaybeUninit::new_uninit().assume_init()in situations likerust/library/alloc/src/vec/into_iter.rs
Lines 149 to 150 in ab0c2e1
It provides a convenient place to talk about why it's not just safe to do this in all cases.
Public API
Steps / History
unsafe fnfor creating a ZST libs-team#292 (comment)mem::conjure_zstfor creating ZSTs out of nothing #95385Unresolved Questions
*ptr::null::<()>()(see Make deref_nullptr deny by default instead of warn #148122 (comment)), should be changed to call this instead (once it's stablized)?