Skip to content

mem::transmute should be a const fn. #49450

Closed
@gnzlbg

Description

@gnzlbg

A common request in stdsimd is being able to initialize static variables with architecture-specific vector types.

There are many ways to hack this out, but AFAICt all of them basically reduce to using an union to implement a mem::transmute clone whose only different from mem::transmute is that it is a const fn.

Since this is already possible today, we should IMO just go ahead and make mem::transmute a const fn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-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