You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Unstable-features.md
+2-26Lines changed: 2 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -10,34 +10,10 @@ On top of that, the kernel uses some Rust unstable features. These features can
10
10
11
11
When unstable features are deemed mature enough, they may get promoted into stable Rust. In other cases, they may get dropped altogether. Some features are internal to the compiler or perma-unstable.
12
12
13
-
There are ongoing discussions around stability within the Rust project, such as potentially defining [extra phases](https://smallcultfollowing.com/babysteps/blog/2023/09/18/stability-without-stressing-the-out/). These finer-grained levels could be useful for the kernel.
14
-
15
13
## Usage in the kernel
16
14
17
15
The unstable features used in the kernel are tracked at [issue #2](https://github.com/Rust-for-Linux/linux/issues/2).
18
16
19
-
Removing the need for these is a priority in order to be able to eventually declare a [minimum Rust version for the kernel](Rust-version-policy.md).
20
-
21
-
Therefore, the set of unstable features used in the kernel needs to be carefully considered. Typically, for each of them, we need to consider:
22
-
23
-
- Whether there is no other way around the issue they help with, or whether the alternative is considered to have bigger downsides than using the unstable feature.
24
-
25
-
- Whether they would be required to build the kernel.
26
-
27
-
- Whether stabilization is likely, whether they are internal to the compiler and whether they are used in the standard library.
28
-
29
-
- Whether other features that are on the critical path will likely take longer to get stabilized anyway.
30
-
31
-
Moreover, most of the features are only allowed within the `kernel` crate, i.e. for abstractions. Elsewhere (e.g. drivers), only a minimal set is allowed (see the `rust_allowed_features` variable in [`scripts/Makefile.build`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Makefile.build)).
32
-
33
-
If you would like to use a new Rust unstable feature in the kernel, then please [contact us](Contact.md).
34
-
35
-
## Rust for Linux in the Rust pre-merge CI
36
-
37
-
In order to catch any unexpected changes that would break the kernel's usage of unstable features, the kernel is build-tested in the pre-merge CI of the Rust project. Please see the [Rust version policy](Rust-version-policy.md) page for details.
38
-
39
-
## `alloc` (older releases)
40
-
41
-
[`alloc`](https://doc.rust-lang.org/alloc/) is part of the Rust standard library and its implementation uses many unstable features. Normally, this library (as well as [`core`](https://doc.rust-lang.org/core/) and others) is provided by the compiler, and thus those unstable features do not break users' code.
17
+
Most of the features are only allowed within the `kernel` crate, i.e. for abstractions. Elsewhere (e.g. drivers), only a minimal set is allowed (see the `rust_allowed_features` variable in [`scripts/Makefile.build`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Makefile.build)).
42
18
43
-
In older releases, the kernel contained a fork of `alloc` (matched to the supported Rust version by the kernel) with some additions on top. This complicated compiling the kernel with a different compiler version due to those unstable features, but this fork was meant to be temporary, and eventually it got dropped in v6.10. The original plan for `alloc` discussed with upstream Rust (and others) was documented in-tree in the [`rust/alloc/README.md`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/rust/alloc/README.md?h=v6.6) file.
19
+
Removing the need for unstable features is a priority in order to ensure the kernel can be built with future Rust compiler versions without major changes on the kernel side. To that end, we are working with upstream Rust to get the Linux kernel into stable Rust. On top of that, the kernel is build-tested in the pre-merge CI of the Rust and `bindgen` projects. Please see the [Rust version policy](Rust-version-policy.md) page for more details.
0 commit comments