How to use build-analysis feature?

⚓ Rust    📅 2026-04-16    👤 surdeus    👁️ 6      

surdeus

Hi,

apparently, there's a new-ish nightly feature that allows you to get a report on why crates are rebuilt. I could not get it to work and I assume I'm doing some really basic thing wrong.

Why am I not getting a report? Where should I have put the -Z build-analysis flag instead?


~/fooo on  master [?] is 📦 v0.1.0 via 🦀 v1.97.0-nightly 
> cargo -Z build-analysis build
   Compiling fooo v0.1.0 (/home/me/fooo)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s

~/fooo on  master [?] is 📦 v0.1.0 via 🦀 v1.97.0-nightly 
> cargo -Z build-analysis report rebuilds --verbose
error: no sessions found for workspace at `/home/me/fooo`
  |
  = note: run command with `-Z build-analysis` to generate log files

~/fooo on  master [?] is 📦 v0.1.0 via 🦀 v1.97.0-nightly 
> rustc --version
rustc 1.97.0-nightly (e8e4541ff 2026-04-15)

~/fooo on  master [?] is 📦 v0.1.0 via 🦀 v1.97.0-nightly 
> cargo --version
cargo 1.97.0-nightly (eb94155a9 2026-04-09)

~/fooo on  master [?] is 📦 v0.1.0 via 🦀 v1.97.0-nightly 
> 

This is for a blank project generated by cargo new fooo, but I get the same for my more complex workspace with several different crates in it.

Thanks :slight_smile:

1 post - 1 participant

Read full topic

🏷️ Rust_feed