Messages in this thread |  | | From | Arnd Bergmann <> | Date | Thu, 16 Jul 2020 15:06:01 +0200 | Subject | Re: Linux kernel in-tree Rust support |
| |
On Sun, Jul 12, 2020 at 9:39 PM Josh Triplett <josh@joshtriplett.org> wrote: > On Sun, Jul 12, 2020 at 03:31:51PM +0300, Adrian Bunk wrote: > > > > As an example: > > Ubuntu LTS releases upgrade to a new Rust version every 1-2 months. > > Ubuntu 16.04 started with Rust 1.7.0 and is now at Rust 1.41.0. > > > > It would not sound good to me if security updates of distribution > > kernels might additionally end up using a different version of the > > Rust compiler - the toolchain for the kernel should be stable. > > > > Would Rust usage in the kernel require distributions to ship > > a "Rust for Firefox" and a "Rust for the kernel"? > > Rust has hard stability guarantees when upgrading from one stable > version to the next. If code compiles with a given stable version of > Rust, it'll compile with a newer stable version of Rust. Given that, a > stable distribution will just need a single sufficiently up-to-date Rust > that meets the minimum version requirements of both Firefox and Linux. > > (That would not apply if the kernel used nightly Rust, since > nightly-only features are allowed to change before becoming stable; > that's one reason why we should use stable Rust, and try to get Firefox > to stick to stable Rust.)
I would expect we'd want a fairly tight coupling between kernel releases and minimum rust releases at first. Whatever is the latest stable rust version during the kernel's merge window might be assumed to be the minimum version for the life of that kernel, but an LTS release would not suddenly start relying on features from a newer compiler (thought it might warn about known bugs).
This might mean that linux-next requires a beta version of rust, if the release is expected before the merge window and it contains an important change. Staying with fairly recent versions of clang certainly helped in getting clang and the kernel to co-evolve and get to the point we are now in using it as an alternative to gcc.
While Linux used to build with 12 year old compilers (4.1 until 2018), we now require a 6 year old gcc (4.9) or 1 year old clang/llvm. I don't know whether these will fully converge over time but it seems sensible that the minimum rust frontend version we require for a new kernel release would eventually also fall in that range, requiring a compiler that is no more than a few years old, but not requiring the latest stable release.
Arnd
|  |