惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
IT之家
IT之家
博客园 - Franky
博客园_首页
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed

The Rust Programming Language Forum - Latest topics

Beginner building a Rust backend framework (AI-assisted) — feedback appreciated C++ to Rust -- Exceptions Re-exporting a trait with a custom derive_macro Gold linker is deprecated Why is using PhantomData valid in this case? Code review for Static Pool Allocator Looking for a pool based allocator Why is this legal? What does it mean for Rustc to run "out of TLS keys"? Using async/await internally with no internal runtime, but exposing a nonblocking poll API — is this a reasonable design? Testing functions that use randomness `cargo-path`: improve coding agents&#39; ability to find Rust documentation Rust task runners Lifetime weird case Windows - USB device not detected A random rustc-ice-[...].txt file appeared Develop rust where the environment is setup in a docker Undefined Behavior: in-bounds pointer arithmetic failed: attempting to offset pointer by 20 bytes, but got alloc238 which is only 1 byte from the end of the allocation Unbug 0.5 - Runtime debug assertions Is there a tiny error in section 6.2 Reference types? Lifetime woes implementing ratatui::Widget for a reference Rusqlite + Chrono: How do I simplify code to obtain chrono datetime value From OOP to Rust – struggling with code organization and data structure design Way to avoid a self-referential struct Rust RF and audio resources/communities Whyhttp - HTTP mocks that fail where the bug actually is Using tokio channel permits in a tower service Arc::increment_strong_count design question (cross-post) `&T`, `&mut T`, `Pin<&mut T>` and `&Cell<T>`: Ways of Borrowing a `T` Ratatui detect arrow key press and release
How to use build-analysis feature?
jobafr · 2026-04-16 · via The Rust Programming Language Forum - Latest topics

April 16, 2026, 12:59pm 1

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 Like

jobafr April 17, 2026, 3:25pm 2

Found it myself, apparently you have to set CARGO_BUILD_ANALYSIS_ENABLED=true as an environment variable in addition to the -Z build-analysis flag for cargo. In the end, that wasn't helpful enough and I also used CARGO_LOG=cargo::core::compiler::fingerprint=trace

final command line:

# compile
CARGO_LOG=cargo::core::compiler::fingerprint=trace CARGO_BUILD_ANALYSIS_ENABLED=true cargo -Z build-analysis build --release

# view report
CARGO_BUILD_ANALYSIS_ENABLED=true cargo -Z build-analysis report rebuilds --verbose -vv

This github comment appears the original documentation for this: