Rust for 6.10
Miguel Ojeda
maintainerHi Linus,
This is the next round of the Rust support.
All the commits have been in linux-next for a week or more, except for the fix on top, which has been in 3 linux-next tags.
A simple conflict with the Kbuild pull expected. It is resolved in linux-next. No changes to the C side.
You will likely get initial Rust support for 64-bit RISC-V, as well as an abstraction for ktime_t (together with a small cleanup) and updates to the Chinese docs translation through their respective trees.
Please pull for v6.10 -- thanks!
Cheers,
Miguel
The following changes since commit 4cece764965020c22cff7665b18a012006359095:
Linux 6.9-rc1 (2024-03-24 14:10:05 -0700)
are available in the Git repository at:
https://github.com/Rust-for-Linux/linux.git tags/rust-6.10
for you to fetch changes up to 97ab3e8eec0ce79d9e265e6c9e4c480492180409:
rust: alloc: fix dangling pointer in VecExt<T>::reserve() (2024-05-08 00:43:30 +0200)
----------------------------------------------------------------
Rust changes for v6.10
The most notable change is the drop of the 'alloc' in-tree fork. This is nicely reflected in the diffstat as a ~10k lines drop. In turn, this makes the version upgrades way simpler and smaller in the future, e.g. the latest one in commit 56f64b370612 ("rust: upgrade to Rust 1.78.0").
More importantly, this increases the chances that a newer compiler version just works, which in turn means supporting several compiler versions is easier now. Thus we will look into finally setting a minimum version in the near future.
Toolchain and infrastructure:
- Upgrade to Rust 1.78.0.
This time around, due to how the kernel and Rust schedules have aligned, there are two upgrades in fact. These allow us to remove one more unstable feature ('offset_of') from the list, among other improvements.
- Drop 'alloc' in-tree fork of the standard library crate, which means all the unstable features used by 'alloc' (~30 language ones, ~60 library ones) are not a concern anymore.
- Support DWARFv5 via the '-Zdwarf-version' flag.
- Support zlib and zstd debuginfo compression via the '-Zdebuginfo-compression' flag.
'kernel' crate:
- Support allocation flags ('GFP_*'), particularly in 'Box' (via 'BoxExt'), 'Vec' (via 'VecExt'), 'Arc' and 'UniqueArc', as well as in the 'init' module APIs.
- Remove usage of the 'allocator_api' unstable feature.
- Remove 'try_' prefix in allocation APIs' names.
- Add 'VecExt' (an extension trait) to be able to drop the 'alloc' fork.
- Add the '{make,to}_{upper,lower}case()' methods to 'CStr'/'CString'.
- Add the 'as_ptr' method to 'ThisModule'.
- Add the 'from_raw' method to 'ArcBorrow'.
- Add the 'into_unique_or_drop' method to 'Arc'.
- Display column number in the 'dbg!' macro output by applying the equivalent change done to the standard library one.
- Migrate 'Work' to '#[pin_data]' thanks to the changes in the 'macros' crate, which allows to remove an unsafe call in its 'new' associated function.
- Prevent namespacing issues when using the '[try_][pin_]init!' macros by changing the generated name of guard variables.
- Make the 'get' method in 'Opaque' const.
- Implement the 'Default' trait for 'LockClassKey'.
- Remove unneeded 'kernel::prelude' imports from doctests.
- Remove redundant imports.
'macros' crate:
- Add 'decl_generics' to 'parse_generics()' to support default values, and use that to allow them in '#[pin_data]'.
Helpers:
- Trivial English grammar fix.
Documentation:
- Add section on Rust Kselftests to the "Testing" document.
- Expand the "Abstractions vs. bindings" section of the "General Information" document.
----------------------------------------------------------------
Alice Ryhl (3):
rust: add Module::as_ptr
rust: sync: add ArcBorrow::from_raw
rust: sync: add Arc::into_unique_or_drop
Benno Lossin (4):
rust: macros: add decl_generics to parse_generics()
rust: macros: allow generic parameter default values in #[pin_data]
rust: workqueue: add #[pin_data] to Work
rust: init: change the generated name of guard variables
Boqun Feng (1):
rust: types: Make Opaque::get const
Danilo Krummrich (2):
rust: str: add {make,to}_{upper,lower}case() to CString
rust: alloc: fix dangling pointer in VecExt<T>::reserve()
Dirk Behme (1):
docs: rust: extend abstraction and binding documentation
Laura Nao (1):
docs: rust: Add instructions for the Rust kselftest
Miguel Ojeda (6):
rust: upgrade to Rust 1.77.1
kbuild: rust: use -Zdwarf-version to support DWARFv5
kbuild: rust: use -Zdebuginfo-compression
rust: sync: implement Default for LockClassKey
rust: kernel: remove redundant imports
rust: upgrade to Rust 1.78.0
Nell Shamrell-Harrington (1):
rust: remove unneeded kernel::prelude imports from doctests
Raghav Narang (1):
rust: update dbg!() to format column number
Thorsten Blum (1):
rust: helpers: Fix grammar in comment
Wedson Almeida Filho (10):
rust: kernel: move allocator module under alloc
rust: alloc: introduce the VecExt trait
kbuild: use the upstream alloc crate
rust: alloc: remove our fork of the alloc crate
rust: alloc: introduce allocation flags
rust: alloc: introduce the BoxExt trait
rust: alloc: update VecExt to take allocation flags
rust: sync: update Arc and UniqueArc to take allocation flags
rust: init: update init module to take allocation flags
rust: kernel: remove usage of allocator_api unstable feature
Documentation/process/changes.rst | 2 +-
Documentation/rust/general-information.rst | 57 +
Documentation/rust/testing.rst | 25 +-
rust/Makefile | 16 +-
rust/alloc/README.md | 36 -
rust/alloc/alloc.rs | 452 ----
rust/alloc/boxed.rs | 2463 -------------------
rust/alloc/collections/mod.rs | 160 --
rust/alloc/lib.rs | 288 ---
rust/alloc/raw_vec.rs | 611 -----
rust/alloc/slice.rs | 890 -------
rust/alloc/vec/drain.rs | 255 --
rust/alloc/vec/extract_if.rs | 115 -
rust/alloc/vec/into_iter.rs | 454 ----
rust/alloc/vec/is_zero.rs | 204 --
rust/alloc/vec/mod.rs | 3683 ----------------------------
rust/alloc/vec/partial_eq.rs | 49 -
rust/alloc/vec/set_len_on_drop.rs | 35 -
rust/alloc/vec/spec_extend.rs | 119 -
rust/bindings/bindings_helper.h | 3 +
rust/helpers.c | 2 +-
rust/kernel/alloc.rs | 73 +
rust/kernel/{ => alloc}/allocator.rs | 19 +-
rust/kernel/alloc/box_ext.rs | 56 +
rust/kernel/alloc/vec_ext.rs | 182 ++
rust/kernel/error.rs | 14 +-
rust/kernel/init.rs | 63 +-
rust/kernel/init/macros.rs | 47 +-
rust/kernel/lib.rs | 13 +-
rust/kernel/net/phy.rs | 2 +-
rust/kernel/prelude.rs | 2 +
rust/kernel/print.rs | 5 -
rust/kernel/std_vendor.rs | 7 +-
rust/kernel/str.rs | 98 +-
rust/kernel/sync.rs | 6 +
rust/kernel/sync/arc.rs | 189 +-
rust/kernel/sync/condvar.rs | 3 +-
rust/kernel/sync/lock.rs | 2 +-
rust/kernel/sync/lock/mutex.rs | 4 +-
rust/kernel/sync/lock/spinlock.rs | 4 +-
rust/kernel/task.rs | 2 +-
rust/kernel/types.rs | 6 +-
rust/kernel/workqueue.rs | 54 +-
rust/macros/helpers.rs | 122 +-
rust/macros/pin_data.rs | 2 +
rust/macros/zeroable.rs | 1 +
samples/rust/rust_minimal.rs | 6 +-
samples/rust/rust_print.rs | 4 +-
scripts/Makefile.build | 2 +-
scripts/Makefile.debug | 8 +
scripts/generate_rust_analyzer.py | 2 +-
scripts/generate_rust_target.rs | 2 +-
scripts/min-tool-version.sh | 2 +-
53 files changed, 878 insertions(+), 10043 deletions(-)
delete mode 100644 rust/alloc/README.md
delete mode 100644 rust/alloc/alloc.rs
delete mode 100644 rust/alloc/boxed.rs
delete mode 100644 rust/alloc/collections/mod.rs
delete mode 100644 rust/alloc/lib.rs
delete mode 100644 rust/alloc/raw_vec.rs
delete mode 100644 rust/alloc/slice.rs
delete mode 100644 rust/alloc/vec/drain.rs
delete mode 100644 rust/alloc/vec/extract_if.rs
delete mode 100644 rust/alloc/vec/into_iter.rs
delete mode 100644 rust/alloc/vec/is_zero.rs
delete mode 100644 rust/alloc/vec/mod.rs
delete mode 100644 rust/alloc/vec/partial_eq.rs
delete mode 100644 rust/alloc/vec/set_len_on_drop.rs
delete mode 100644 rust/alloc/vec/spec_extend.rs
create mode 100644 rust/kernel/alloc.rs
rename rust/kernel/{ => alloc}/allocator.rs (85%)
create mode 100644 rust/kernel/alloc/box_ext.rs
create mode 100644 rust/kernel/alloc/vec_ext.rsThe pull request you sent on Sun, 12 May 2024 22:22:15 +0200:
The pull request you sent on Sun, 12 May 2024 22:22:15 +0200:
Quoted 1 line
https://github.com/Rust-for-Linux/linux.git tags/rust-6.10
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/8f5b5f78113e881cb8570c961b0dc42b218a1b9e
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html