Hacker News new | ask | show | jobs
by pornel 657 days ago
Rust emits unreasonable amount of debug information. It's so freakishly large, I expect it's just a bug.

Anything you compile will dump gigabytes into the target folder, but that's not representative of the final product (after stripping the debug info, or at least using a toned-down verbosity setting).

3 comments

> Rust emits unreasonable amount of debug information. It's so freakishly large, I expect it's just a bug.

Rust relies on the linker (via -ffunction-sections and -gc-sections) to delete functions that aren't ever used but the linker isn't capable of removing the corresponding debug info.

https://github.com/rust-lang/rust/issues/56068

Most of your target folder isn't debug info, but stale build artifacts because Cargo doesn't do any garbage collection.
Does it need a more compact representation of its debug info?