Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Legal values for a Box<T> where T is zero-sized #3

Closed
@nikomatsakis

Description

@nikomatsakis

On IRC, @mystor asked me whether, given some zero-sized type ZST, it would be legal to represent Box<ZST> using some arbitrary non-null value, or must it be a particular value (e.g., 1)?

For example, if there is a pointer p to some stack variable, can one write unsafe { Box::from_raw(p as *mut ZST) } and have that be a legal box?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions