Shrinking Rust's Target Directory: A New Compiler Flag
2025-06-02
Large target directories are a common frustration for Rust developers. This post introduces a new method to significantly reduce their size. A new compiler flag, `-Zembed-metadata=no`, combined with a new Cargo flag, `-Zno-embed-metadata`, prevents redundant metadata storage in `.rlib` and `.rmeta` files. Tests show a reduction of up to 36.3% in release mode. This feature is currently unstable (nightly), with plans to make it the default, but backward compatibility concerns need careful consideration.
Development