Skip to content

Rust stable compatibility: eliminate all nightly-only features #90

@yudongusa

Description

@yudongusa

Background

The project currently requires Rust nightly because `src/llvm-bench` uses the `#![feature(test)]` attribute for the built-in micro-benchmark harness. This means any project that depends on LLVM-in-Rust is forced onto nightly, which breaks every 6 weeks and is unacceptable for production use.

Audit of nightly usage

src/llvm-bench/benches/pipeline.rs:1  #![feature(test)]
src/llvm-bench/benches/pipeline.rs:2  extern crate test;

This is the only nightly feature in the entire workspace (confirmed by grep -r '#!\[feature' src/).

Plan

Option A (recommended): migrate to Criterion

Replace the #![feature(test)] bencher with Criterion.rs, which runs on stable Rust and provides better statistical output:

# src/llvm-bench/Cargo.toml
[dev-dependencies]
criterion = "0.5"

[[bench]]
name = "pipeline"
harness = false

Each #[bench] fn bench_foo(b: &mut Bencher) becomes:

fn bench_foo(c: &mut Criterion) {
    c.bench_function("foo", |b| b.iter(|| ...));
}

Option B: move benches behind a feature flag

Gate the nightly bench harness behind #[cfg(feature = "nightly-bench")] so the crate compiles on stable by default.

Acceptance criteria

  • rustup run stable cargo build --all-targets succeeds with zero errors
  • rustup run stable cargo test passes all 213 tests
  • Benchmark results are preserved (same wall-clock measurements, now via Criterion)
  • CI matrix updated to test on both stable and nightly
  • README.md updated: remove nightly requirement from prerequisites

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions