Skip to content

Policy on the use of rustc_legacy_const_generics in stdarch #149654

@Amanieu

Description

@Amanieu

stdarch has been using rustc_legacy_const_generics since 2021 (#83167) to allow some functions to accept const generics in argument position. However there have been concerns that the implementation of this feature is a hack, which has recently caused problems (#130443), and it's unclear whether we want to keep this feature in the long run (#146613).

However, many stdarch intrinsics for x86 and ARM targets are stable and depend on this feature. Addtionally, we are in the process of stabilizing more intrinsics in these architectures which rely on rustc_legacy_const_generics (#127213).

Specifically, these stable intrinsics use rustc_legacy_const_generics:

  • x86/x86_64 SIMD intrinsics (SSE, AVX, AVX512, etc)
  • AArch64 SIMD intrinsics
  • WASM memory_size and memory_grow intrinsics.

I am proposing that, until the long-term future of rustc_legacy_const_generics is decided, we only allow stabilizing new intrinsics using rustc_legacy_const_generics on targets which already use them on stable today (except WASM, which has minimal use today). The rationale is that if we decide to retire rustc_legacy_const_generics in the future, the additional impact of migrating the new intrinsics will be limited since the existing intrinsics will have to be migrated anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions