Skip to content

Constants as arguments don't really work #1011

Closed
@raphaelcohn

Description

@raphaelcohn

I'm adding some wrappers around some of the AVX512 intrinsics to make them a bit more useful. In doing so, I found that there's no real way to propagate that an intrinsic with an argument marked as constant by the [rustc_args_required_const] attribute is constant in any wrapper.

This seems to also have been an issue in implementing the Altivec intrinsics, eg rust-lang/rust#61180. It's also a pain when adding one's own implementation of an intrinsic that needs to take a constant argument, eg _kshiftli_mask8(). One can decorate the function, but it then needs nightly to work (but it needs it anyway to use additional target features like avx512bw to get access to the __mmask8 type).

Is there any possibility this working group could push a way of passing arguments as constants as part of const generics into wider Rust? At the moment, I can workaround this problem with the world's worst looking match statement...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions