Hacker News new | past | comments | ask | show | jobs | submit login

I would hope that it could statically link libc and exclude the unreachable portions.



Rust can't do this very well because it doesn't build std as part of the project, that's still an unstable option. It's linking object code.


C doesn't either, but statically linking still pulls only the object files which are actually needed into the executable.


I think that's the main reason why every stdlib function lives in its own source file in MUSL:

https://git.musl-libc.org/cgit/musl/tree/src/stdio

Not sure if this can easily be replicated in Rust though and LTO must be used instead for dead code removal.


A Rust crate is a single translation unit. It's the precise equivalent of a C source or object file.


Link-time optimization should have been beneficial for this case... unless you absolutely needed quite a bit of `std` to print backtraces.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: