Skip to content

Tracking Issue for mem::conjure_zst (feature(mem_conjure_zst)) #95383

Open
@scottmcm

Description

@scottmcm

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:

  1. It makes it clearer to the reader what's happening and keeps the code author from needing to decide between zeroed() or uninitialized() or MaybeUninit::new_uninit().assume_init() in situations like

    // Make up a value of this ZST.
    Some(unsafe { mem::zeroed() })

  2. It provides a convenient place to talk about why it's not just safe to do this in all cases.

Public API

// core::mem

pub const unsafe fn conjure_zst<T>() -> T;

Steps / History

Unresolved Questions

  • None yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions