Radar · Rust · Archive · Week 29 · Jul 14 – 20, 2025
hint‑mostly‑unused compiler hint
Worth knowingcompiler
- What changed
- The Rust team is testing the hint-mostly-unused feature to speed up compilation.
- Production impact
- The source does not say.
- Try it
- Add the feature flag
--cfg hint-mostly-unusedto a build and measure compilation time. - Source
- blog.rust-lang.org/inside-rust/2025/07/15/call-for-testing-hint-mostly-unused/
Understand it, then run it
Run it now
// This program demonstrates the hint-mostly-unused feature.
// It does not compile on stable Rust; it requires nightly with
// the -Zprofile-hint-mostly-unused flag and a crate that
// declares hints.mostly-unused = true in its Cargo.toml.
fn main() {
// The body is irrelevant; the point is that the compiler
// will skip generating code for unused items in dependencies
// that are marked as mostly unused.
println!("If you build with -Zprofile-hint-mostly-unused, \
compile time may be reduced for large crates.");
}
What it printed when we ran it on Rust 1.98.1 (edition 2024)
If you build with -Zprofile-hint-mostly-unused, compile time may be reduced for large crates.
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed