Re: [PATCH 3/3] rust: upgrade to Rust 1.78.0

From: Miguel Ojeda
Date: Mon Apr 01 2024 - 17:52:56 EST


On Mon, Apr 1, 2024 at 11:23 PM Miguel Ojeda <ojeda@xxxxxxxxxx> wrote:
>
> It also means that, ignoring non-language/library features, we are
> currently left with just the few language features needed to implement the
> kernel `Arc`, the `new_uninit` library feature, the `compiler_builtins`
> marker and the few `no_*` `cfg`s we pass when compiling `core`/`alloc`.

To be clear, by "currently" I meant in mainline, i.e. it does not mean
that we will not need/add a few more language/library features in the
future.

> Rust 1.78.0 introduced support for mutable pointers to Rust statics,
> including a test case for the Linux kernel's `VTABLE` use case [13].

I should have mentioned constants so that it makes sense. I will link
to `const_refs_to_static`, i.e.
https://github.com/rust-lang/rust/issues/119618.

> Rust 1.78.0 with debug assertions enabled (i.e. `-Cdebug-assertions=y`,
> kernel's `CONFIG_RUST_DEBUG_ASSERTIONS=y`) now always checks all unsafe
> preconditions, without a way to opt-out for particular cases [14].

It would be ideal to have a way to selectively disable certain checks
per-call site for this one (i.e. not just per check but for particular
instances of a check), even if the vast majority of the checks remain
in place. I discuss the details a bit more at
https://github.com/Rust-for-Linux/linux/issues/354.

> Please note that Rust 1.78.0 will be released in a month (2024-05-02).

By the way, I tested these with arm64, loongarch64 and x86_64.

Cheers,
Miguel