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. 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-nominatedNominated for discussion during a lang team meeting.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions