However, there are three points which annoy me. First, the Rust compiler is huge (LLVM based). Second, it requires a native Rust compiler for bootstrap. Third, it doesn't compile to C which makes porting to other platforms difficult. Nim doesn't have these problems. It is small, self-hosting, and easily portable.
Not compiling to C is a feature. It insulates us from the undefined behavior of C (signed overflow never results in UB in Rust, for example) and allows us to actually get proper debug info.
(I agree that it's a tradeoff generally, I'm just not sure this example is particularly motivating.)
No, because the interface is
int stat(const char *path, struct stat *buf);?
(Which is how stuff like https://docs.rs/libc/0.2.16/libc/fn.stat.html is built)
I still think that, given Cargo, the one-time cost makes it worth it, but after seeing my error, think that the point makes more sense. Thank you for being patient. :)
Furthermore, if your frontend doesn't know about structure layout then you forgo some important systems language features. For example, you can't implement sizeof as a compile time constant.
Sure and you only need to call libclang for each different platform. Or is it on every platform? ;-)