How to enable unstable nightly features used by dependency?

I am compiling a main.rs which compiles this dependency (with rust 1.77 nightly)

─❯ cargo run generate -h
   Compiling curve25519-dalek v4.1.2
error[E0658]: use of unstable library feature 'stdsimd'
  --> /home/nixos/.cargo/registry/src/index.crates.io-6f17d22bba15001f/curve25519-dalek-4.1.2/src/backend/vector/ifma/field.rs:26:5
   |
26 |     _mm256_madd52lo_epu64(z.into(), x.into(), y.into()).into()
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
   = help: add `#![feature(stdsimd)]` to the crate attributes to enable
   = note: this compiler was built on 2024-01-31; consider upgrading it if it is out of dat

where should I add the #![feature(stdsimd)] ? Because in main.rs it doesnt work?

Could you try upgrading your nightly toolchain? stdsimd got removed a few days ago, I assume your dependency has already removed it, making it incompatible with your current nightly version.

2 Likes

Upgrading to 1.78 ?, where can I find the nightly channels or releases?

I have the following toolchain file:

[toolchain]
channel = "nightly"
components = [ "rustfmt", "rust-analyzer", "miri", "rust-docs", "clippy", "rust-src"]
profile = "default"

Nightly is released each night (hence the name). rustup update nightly should install yesterday's nightly release.

1 Like

yeah sorry dump question: but who knows.

[toolchain]
channel = "nightly-2024-02-09"
components = [ "rustfmt", "rust-analyzer", "miri", "rust-docs", "clippy", "rust-src"]
profile = "default"

works now.

But how can the library compile suddenly when the function was removed?

Because the 1.78.0-2024-02-09 compiler doesn't require #![feature(stdsimd)] to be present at the top of the crate root file in order for the crate to be able to call the _mm256_madd52lo_epu64 instruction, whereas your old compiler needed it. In fact, since stdsimd got removed, your new compiler doesn't even know that there was ever a nightly feature called stdsimd. So vice versa, if your new compiler encounters a #![feature(stdsimd)] somewhere (i.e. in a dependency that hasn't been updated yet), it will throw an error too, because it doesn't know stdsimd.