Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error at Simd::splat: usage of intrinsics::const_eval_select #445

Closed
AquaEBM opened this issue Nov 23, 2024 · 1 comment · Fixed by #446
Closed

Compiler error at Simd::splat: usage of intrinsics::const_eval_select #445

AquaEBM opened this issue Nov 23, 2024 · 1 comment · Fixed by #446

Comments

@AquaEBM
Copy link
Contributor

AquaEBM commented Nov 23, 2024

The latest nightly compiler gives the following error when compiling the core_simd crate from this repository (not core::simd):

error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_eval_select)]`
   --> portable-simd/crates/core_simd/src/vector.rs:171:9
    |
171 |         core::intrinsics::const_eval_select((value,), splat_const, splat_rt)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
    |
147 +     #[rustc_const_unstable(feature = "...", issue = "...")]
148 |     pub const fn splat(value: T) -> Self {
    |
help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval)
    |
147 +     #[rustc_allow_const_fn_unstable(const_eval_select)]
148 |     pub const fn splat(value: T) -> Self {
    |

A quick blame suggests that this is caused by #417

Possible fixes (some already suggested by the compiler):

  • Using #[rustc_const_unstable(feature = "...", issue = "...")] (Which feature and tracking issue would be appropriate here?)
  • Using #[rustc_allow_const_fn_unstable(const_eval_select)]
  • Reverting Make splat const fn #417 completely
@calebzulawski
Copy link
Member

I think it might be reasonable to use the unstable attribute with this feature and tracking issue: https://github.com/rust-lang/rust/blob/826b673412d2f579e7865b6f26bc9771c6d3b097/library/core/src/lib.rs#L437

Using the unstable attribute gives us the reminder to reevaluate this in the future when we are ready to stabilize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants