News for hackers. Stuff that matters.
Re:Linux kernel in-tree Rust support by loeg on Saturday July 11, 2020 @11:06AM (#23802701)
The slowness of building crates makes an immense impact on ordinary rust project build times, but as the Linux kernel would just be using rustc directly, and Kbuild already parallelizes CC invocations, the relevant gains here would be single-TU compilation speed.
Re:Linux kernel in-tree Rust support by benesch on Saturday July 11, 2020 @11:39AM (#23802965)
But the translation unit in Rust is the crate. Running `rustc` directly won't change that fact. Unlike in C, where you can compile TUs in any order since you've got interfaces in headers, in Rust you can't compile a crate until you've compiled all its dependencies--and if it's not Cargo that's going to sort that out for you, Kbuild will have to.
Re:Linux kernel in-tree Rust support by cesarb on Saturday July 11, 2020 @02:57PM (#23804729)
> in Rust you can't compile a crate until you've compiled all its dependencies

Since Rust 1.38 (https://blog.rust-lang.org/2019/09/26/Rust-1.38.0.html#pipel...) that's no longer the case: "To compile a crate, the compiler doesn't need the dependencies to be fully built. Instead, it just needs their "metadata" (i.e. the list of types, dependencies, exports...). This metadata is produced early in the compilation process. Starting with Rust 1.38.0, Cargo will take advantage of this by automatically starting to build dependent crates as soon as metadata is ready."

Re:Linux kernel in-tree Rust support by pjmlp on Saturday July 11, 2020 @05:13PM (#23806055)
Every time a new Rust version comes out I compile my toy Gtk-rs application ported from a C/C++ User Journal article about Gtkmm.

The C++ version still wins by several minutes on a Asus 1215B.

Re:Linux kernel in-tree Rust support by swsieber on Saturday July 11, 2020 @06:34PM (#23806727)
Has the gap at least narrowed over time?
Re:Linux kernel in-tree Rust support by pjmlp on Sunday July 12, 2020 @01:25AM (#23809070)
Definitely, the improvements on rustc are visible, so eventually it will reach there.

And I test it on that hardware on purpose, because I should not have to buy a top class desktop to achieve usable compile times similar to other AOT compiled languages.

However, I also admit that what is missing is having a backend that favours debug workflows, which do exist just aren't yet there.

Re:Linux kernel in-tree Rust support by AlphaSite on Sunday July 12, 2020 @01:53PM (#23813223)
Is this a fresh compile each time?
Re:Linux kernel in-tree Rust support by pjmlp on Sunday July 12, 2020 @04:46PM (#23814610)
Yes, make clean all, cargo clean build.
Re:Linux kernel in-tree Rust support by fluffything on Monday July 13, 2020 @03:27AM (#23818021)
If it does compile, could you try reporting results for multiple Rust compiles (e.g. the current one, and the ones from 6,12,18,24 months ago) ? (If you can, maybe do the same for C, but I don't know how easy that is).
Re:Linux kernel in-tree Rust support by roca on Saturday July 11, 2020 @04:54PM (#23805869)
This is good but it doesn't work well enough in my experience. I still spend a lot of time waiting for dependencies to build before the crates that depend on them.
Re:Linux kernel in-tree Rust support by nitrogen on Saturday July 11, 2020 @12:42PM (#23803445)
Given the modular nature of the kernel, how big will each "crate" be? Will they mostly end up interfacing with the rest of the kernel using the C ABI and not need to be compiled as a single unit?