Live data from Hacker News

The Linux Kernel Prepares for Rust 1.77 Upgrade

phoronix.com

1–10 of 107 posts

Re: The Linux Kernel Prepares for Rust 1.77 Upgrade

#2
Do I understand it correctly that upgrading to a new rust version is mostly implementing new best practices and new features, instead of needing to "fix" your code, as rust is backwards compatible?

I've only used rust nightly for my own projects and didn't give too much thought about rust versions

Re: The Linux Kernel Prepares for Rust 1.77 Upgrade

#3

Do I understand it correctly that upgrading to a new rust version is mostly implementing new best practices and new features, instead of needing to "fix" your code, as rust is backwards compatible? I've only used rust nightly for my own projects and didn't give too much thought about rust versions

For normal projects yes.

And you can use clippy to tell you about changes you should make.

For example, in my projects I run this in the CI pipeline:

  cargo clippy --all-targets --all-features
and

  cargo fmt --all --check
In addition to the regular test and build steps.

This both means that I follow clippy recommendations and cargo fmt in the first place, and also that my CI tells me about any clippy changes if I didn’t notice them myself as well as any formatting I’m not following. In my main IDE I auto format the code of course. But sometimes I make small changes in vim and don’t run the format step myself so it’s nice to have for that reason as well.

For the integration of Rust into the Linux kernel I imagine it’s a bit more convoluted.

Re: The Linux Kernel Prepares for Rust 1.77 Upgrade

#7

The LKM post mentions binary size improvements. One issues I have had with Rust applications is the huge binary size (yes, I know this has improved a bit lately). Is there a good comparison between kernel C and kernel Rust code in this regard?

From (1) I guess most of the binsize comes from stdlib that the kernel does not use, so I guess that's two different problems.

(1) https://github.com/johnthagen/min-sized-rust

Re: The Linux Kernel Prepares for Rust 1.77 Upgrade

#8

The LKM post mentions binary size improvements. One issues I have had with Rust applications is the huge binary size (yes, I know this has improved a bit lately). Is there a good comparison between kernel C and kernel Rust code in this regard?

Most size issues come from not using release builds, using too many dependencies, or overuse of generics. The rust std lib being linked in statically also contributes.The kernel shouldn't suffer from any of these problems. Plenty of embedded use is able to use rust in highly constrained environments without size issues compared to C.

Re: The Linux Kernel Prepares for Rust 1.77 Upgrade

#10

The LKM post mentions binary size improvements. One issues I have had with Rust applications is the huge binary size (yes, I know this has improved a bit lately). Is there a good comparison between kernel C and kernel Rust code in this regard?

Most size issues come from not using release builds, using too many dependencies, or overuse of generics. The rust std lib being linked in statically also contributes.The kernel shouldn't suffer from any of these problems. Plenty of embedded use is able to use rust in highly constrained environments without size issues compared to C.

Saying part of the problem is “using too many dependencies” is not an overly helpful thing if the ecosystem keeps on trying to download 3Gb of build dependencies because you tried to use some simple little library. The problem is obvious, it’s the solution that is much more difficult.
Post reply on HN