Skip to content
Latchkey

Rust "error[E0658]: ... is unstable" - Nightly Feature on Stable in CI

The code uses a feature that is only available on nightly Rust, but CI is building on stable. Stable refuses unstable features outright - there’s no flag to opt in on stable.

What this error means

cargo build fails on stable with error[E0658]: use of unstable library feature X` (or a #![feature(...)]` attribute rejected), naming a tracking issue. It builds for someone on nightly but fails on the stable CI toolchain.

cargo output
error[E0658]: use of unstable library feature 'int_roundings'
  --> src/lib.rs:3:18
   |
3  |     let q = n.div_ceil(4);
   |                  ^^^^^^^^
   = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581>
   = help: add `#![feature(int_roundings)]` to the crate attributes to enable

Common causes

A nightly-only feature used on stable

The API or language feature is gated behind #![feature(...)], which only nightly accepts. On stable it’s a hard E0658 error.

CI toolchain differs from the author’s

Code written and tested on a nightly toolchain reaches CI, which runs stable, so the unstable feature that compiled locally now fails.

How to fix it

Use a stable alternative

Most unstable features have a stable workaround. Replace the call with stable code rather than switching the whole project to nightly.

Rust
// instead of unstable div_ceil on older stable:
let q = (n + 3) / 4;   // ceil division for u32, stable everywhere

Or build on nightly deliberately

If the feature is essential and unstable, pin nightly in CI and accept the instability.

.github/workflows/ci.yml
- uses: dtolnay/rust-toolchain@nightly
- run: cargo build

How to prevent it

  • Develop and test on the same channel CI uses (usually stable).
  • Prefer stable APIs; reach for nightly features only when truly required.
  • Track when features stabilize so you can drop nightly and pin stable.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →