-
-
Notifications
You must be signed in to change notification settings - Fork 17.2k
mem::transmute should be a const fn. #49450
Copy link
Copy link
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]
Description
Activity
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]
A common request in
stdsimdis 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::transmuteclone whose only different frommem::transmuteis that it is aconst fn.Since this is already possible today, we should IMO just go ahead and make
mem::transmuteaconst fn.