Merge tag 'rust-6.11' of https://github.com/Rust-for-Linux/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 27 Jul 2024 20:44:54 +0000 (13:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 27 Jul 2024 20:44:54 +0000 (13:44 -0700)
Pull Rust updates from Miguel Ojeda:
 "The highlight is the establishment of a minimum version for the Rust
  toolchain, including 'rustc' (and bundled tools) and 'bindgen'.

  The initial minimum will be the pinned version we currently have, i.e.
  we are just widening the allowed versions. That covers three stable
  Rust releases: 1.78.0, 1.79.0, 1.80.0 (getting released tomorrow),
  plus beta, plus nightly.

  This should already be enough for kernel developers in distributions
  that provide recent Rust compiler versions routinely, such as Arch
  Linux, Debian Unstable (outside the freeze period), Fedora Linux,
  Gentoo Linux (especially the testing channel), Nix (unstable) and
  openSUSE Slowroll and Tumbleweed.

  In addition, the kernel is now being built-tested by Rust's pre-merge
  CI. That is, every change that is attempting to land into the Rust
  compiler is tested against the kernel, and it is merged only if it
  passes. Similarly, the bindgen tool has agreed to build the kernel in
  their CI too.

  Thus, with the pre-merge CI in place, both projects hope to avoid
  unintentional changes to Rust that break the kernel. This means that,
  in general, apart from intentional changes on their side (that we will
  need to workaround conditionally on our side), the upcoming Rust
  compiler versions should generally work.

  In addition, the Rust project has proposed getting the kernel into
  stable Rust (at least solving the main blockers) as one of its three
  flagship goals for 2024H2 [1].

  I would like to thank Niko, Sid, Emilio et al. for their help
  promoting the collaboration between Rust and the kernel.

  Toolchain and infrastructure:

   - Support several Rust toolchain versions.

   - Support several bindgen versions.

   - Remove 'cargo' requirement and simplify 'rusttest', thanks to
     'alloc' having been dropped last cycle.

   - Provide proper error reporting for the 'rust-analyzer' target.

  'kernel' crate:

   - Add 'uaccess' module with a safe userspace pointers abstraction.

   - Add 'page' module with a 'struct page' abstraction.

   - Support more complex generics in workqueue's 'impl_has_work!'
     macro.

  'macros' crate:

   - Add 'firmware' field support to the 'module!' macro.

   - Improve 'module!' macro documentation.

  Documentation:

   - Provide instructions on what packages should be installed to build
     the kernel in some popular Linux distributions.

   - Introduce the new kernel.org LLVM+Rust toolchains.

   - Explain '#[no_std]'.

  And a few other small bits"

Link: https://rust-lang.github.io/rust-project-goals/2024h2/index.html#flagship-goals
* tag 'rust-6.11' of https://github.com/Rust-for-Linux/linux: (26 commits)
  docs: rust: quick-start: add section on Linux distributions
  rust: warn about `bindgen` versions 0.66.0 and 0.66.1
  rust: start supporting several `bindgen` versions
  rust: work around `bindgen` 0.69.0 issue
  rust: avoid assuming a particular `bindgen` build
  rust: start supporting several compiler versions
  rust: simplify Clippy warning flags set
  rust: relax most deny-level lints to warnings
  rust: allow `dead_code` for never constructed bindings
  rust: init: simplify from `map_err` to `inspect_err`
  rust: macros: indent list item in `paste!`'s docs
  rust: add abstraction for `struct page`
  rust: uaccess: add typed accessors for userspace pointers
  uaccess: always export _copy_[from|to]_user with CONFIG_RUST
  rust: uaccess: add userspace pointers
  kbuild: rust-analyzer: improve comment documentation
  kbuild: rust-analyzer: better error handling
  docs: rust: no_std is used
  rust: alloc: add __GFP_HIGHMEM flag
  rust: alloc: fix typo in docs for GFP_NOWAIT
  ...

1  2 
Documentation/process/changes.rst
Makefile
init/Kconfig
rust/Makefile
rust/bindings/bindings_helper.h
rust/helpers.c
rust/kernel/lib.rs

Simple merge
diff --cc Makefile
index 11e74386d909dbce5acf5dc5553cb6cfbbe05b0e,9044fdb9adb1f5a8c0d7ff5f1ffdd05fe21f852b..2c02dafb48cef1ab44f2c39d7c70dc76ace5c64e
+++ b/Makefile
@@@ -445,23 -461,21 +445,23 @@@ KBUILD_USERLDFLAGS := $(USERLDFLAGS
  # host programs.
  export rust_common_flags := --edition=2021 \
                            -Zbinary_dep_depinfo=y \
-                           -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
-                           -Dunreachable_pub -Dnon_ascii_idents \
+                           -Dunsafe_op_in_unsafe_fn \
+                           -Dnon_ascii_idents \
+                           -Wrust_2018_idioms \
+                           -Wunreachable_pub \
                            -Wmissing_docs \
-                           -Drustdoc::missing_crate_level_docs \
-                           -Dclippy::correctness -Dclippy::style \
-                           -Dclippy::suspicious -Dclippy::complexity \
-                           -Dclippy::perf \
-                           -Dclippy::let_unit_value -Dclippy::mut_mut \
-                           -Dclippy::needless_bitwise_bool \
-                           -Dclippy::needless_continue \
-                           -Dclippy::no_mangle_with_rust_abi \
+                           -Wrustdoc::missing_crate_level_docs \
+                           -Wclippy::all \
+                           -Wclippy::mut_mut \
+                           -Wclippy::needless_bitwise_bool \
+                           -Wclippy::needless_continue \
+                           -Wclippy::no_mangle_with_rust_abi \
                            -Wclippy::dbg_macro
  
 -KBUILD_HOSTCFLAGS   := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
 -KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
 +KBUILD_HOSTCFLAGS   := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) \
 +                     $(HOSTCFLAGS) -I $(srctree)/scripts/include
 +KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \
 +                     -I $(srctree)/scripts/include
  KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
                        -Zallow-features= $(HOSTRUSTFLAGS)
  KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
diff --cc init/Kconfig
Simple merge
diff --cc rust/Makefile
Simple merge
index 53c996e4bedfe11af0ae0a09b19bbaa6d9bc5a8c,f2bafb10f181859cb1a4bfe4d864fe10edbdfd78..b940a5777330454815092567b2973715b1157ab2
@@@ -30,4 -26,4 +30,5 @@@ const gfp_t RUST_CONST_HELPER_GFP_KERNE
  const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
  const gfp_t RUST_CONST_HELPER_GFP_NOWAIT = GFP_NOWAIT;
  const gfp_t RUST_CONST_HELPER___GFP_ZERO = __GFP_ZERO;
+ const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM = ___GFP_HIGHMEM;
 +const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
diff --cc rust/helpers.c
index 87ed0a5b60990e55f19c4c23a86ccdf9ffe61efd,305f0577fae966a14697731ad32b5f581d262ace..92d3c03ae1bd533870148e897fdea7956d74d27f
  #include <kunit/test-bug.h>
  #include <linux/bug.h>
  #include <linux/build_bug.h>
 +#include <linux/device.h>
  #include <linux/err.h>
  #include <linux/errname.h>
+ #include <linux/gfp.h>
+ #include <linux/highmem.h>
  #include <linux/mutex.h>
  #include <linux/refcount.h>
  #include <linux/sched/signal.h>
Simple merge