Re: [TECH TOPIC] Rust for Linux

Miguel Ojeda
2021-07-07T16:34:56Z

On Wed, Jul 7, 2021 at 5:50 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> How does that work with -stable? Are you saying that rust patches
> which are backported to an earlier kernel also need to be backported
> to an earlier rustc?

Yes, but changes are only needed if they rely on an unstable feature
and only if that feature changed. If that happens, we should know
about it when we migrate to a newer version if something breaks.

Thus this mainly applies to code in `rust/kernel` and `rust/alloc`,
because we statically enforce that modules only use a fixed set of
unstable features that we really need. Thus modules will not be able
to introduce new unstable features themselves.

Please note that we use unstable features either out of necessity or
because they lead to substantially better code, and only if we expect
them to be stabilized. In other words, we are conscious about it and
trying to strike the right balance here.

Moreover, this problem will go away progressively as features get
stabilized. That, of course, may take a long time. This is why we are
also trying to get support from companies to help fund people to
develop `rustc` if Rust gets into the kernel. Meanwhile, there is
already several people involved with `rustc` that know what we need
and will try to help us as much as possible (and have done so
already!).

Finally, please note that we explicitly say Rust support is
experimental, thus until we mark it as "stable enough", we could
simply avoid promising backports if -stable prefers that. One of the
reasons we say it is experimental is precisely because we need
unstable features from the compiler.

Cheers,
Miguel