linux/Documentation
Linus Torvalds 26ff969926 Rust changes for v7.1
Toolchain and infrastructure:
 
  - Bump the minimum Rust version to 1.85.0 (and 'bindgen' to 0.71.1).
 
    As proposed in LPC 2025 and the Maintainers Summit [1], we are going
    to follow Debian Stable's Rust versions as our minimum versions.
 
    Debian Trixie was released on 2025-08-09 with a Rust 1.85.0 and
    'bindgen' 0.71.1 toolchain, which is a fair amount of time for e.g.
    kernel developers to upgrade.
 
    Other major distributions support a Rust version that is high enough
    as well, including:
 
      + Arch Linux.
      + Fedora Linux.
      + Gentoo Linux.
      + Nix.
      + openSUSE Slowroll and openSUSE Tumbleweed.
      + Ubuntu 25.10 and 26.04 LTS. In addition, 24.04 LTS using
        their versioned packages.
 
    The merged patch series comes with the associated cleanups and
    simplifications treewide that can be performed thanks to both bumps,
    as well as documentation updates.
 
    In addition, start using 'bindgen''s '--with-attribute-custom-enum'
    feature to set the 'cfi_encoding' attribute for the 'lru_status' enum
    used in Binder.
 
    Link: https://lwn.net/Articles/1050174/ [1]
 
  - Add experimental Kconfig option ('CONFIG_RUST_INLINE_HELPERS') that
    inlines C helpers into Rust.
 
    Essentially, it performs a step similar to LTO, but just for the
    helpers, i.e. very local and fast.
 
    It relies on 'llvm-link' and its '--internalize' flag, and requires
    a compatible LLVM between Clang and 'rustc' (i.e. same major version,
    'CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE'). It is only enabled for two
    architectures for now.
 
    The result is a measurable speedup in different workloads that
    different users have tested. For instance, for the null block driver,
    it amounts to a 2%.
 
  - Support global per-version flags.
 
    While we already have per-version flags in many places, we didn't
    have a place to set global ones that depend on the compiler version,
    i.e. in 'rust_common_flags', which sometimes is needed to e.g. tweak
    the lints set per version.
 
    Use that to allow the 'clippy::precedence' lint for Rust < 1.86.0,
    since it had a change in behavior.
 
  - Support overriding the crate name and apply it to Rust Binder, which
    wanted the module to be called 'rust_binder'.
 
  - Add the remaining '__rust_helper' annotations (started in the
    previous cycle).
 
 'kernel' crate:
 
  - Introduce the 'const_assert!' macro: a more powerful version of
    'static_assert!' that can refer to generics inside functions or
    implementation bodies, e.g.:
 
        fn f<const N: usize>() {
            const_assert!(N > 1);
        }
 
        fn g<T>() {
            const_assert!(size_of::<T>() > 0, "T cannot be ZST");
        }
 
    In addition, reorganize our set of build-time assertion macros
    ('{build,const,static_assert}!') to live in the 'build_assert'
    module.
 
    Finally, improve the docs as well to clarify how these are different
    from one another and how to pick the right one to use, and their
    equivalence (if any) to the existing C ones for extra clarity.
 
  - 'sizes' module: add 'SizeConstants' trait.
 
    This gives us typed 'SZ_*' constants (avoiding casts) for use in
    device address spaces where the address width depends on the hardware
    (e.g. 32-bit MMIO windows, 64-bit GPU framebuffers, etc.), e.g.:
 
        let gpu_heap = 14 * u64::SZ_1M;
        let mmio_window = u32::SZ_16M;
 
  - 'clk' module: implement 'Send' and 'Sync' for 'Clk' and thus simplify
    the users in Tyr and PWM.
 
  - 'ptr' module: add 'const_align_up'.
 
  - 'str' module: improve the documentation of the 'c_str!' macro to
    explain that one should only use it for non-literal cases (for the
    other case we instead use C string literals, e.g. 'c"abc"').
 
  - Disallow the use of 'CStr::{as_ptr,from_ptr}' and clean one such use
    in the 'task' module.
 
  - 'sync' module: finish the move of 'ARef' and 'AlwaysRefCounted'
    outside of the 'types' module, i.e. update the last remaining
    instances and finally remove the re-exports.
 
  - 'error' module: clarify that 'from_err_ptr' can return 'Ok(NULL)',
    including runtime-tested examples.
 
    The intention is to hopefully prevent UB that assumes the result of
    the function is not 'NULL' if successful. This originated from a case
    of UB I noticed in 'regulator' that created a 'NonNull' on it.
 
 Timekeeping:
 
  - Expand the example section in the 'HrTimer' documentation.
 
  - Mark the 'ClockSource' trait as unsafe to ensure valid values for
    'ktime_get()'.
 
  - Add 'Delta::from_nanos()'.
 
 'pin-init' crate:
 
  - Replace the 'Zeroable' impls for 'Option<NonZero*>' with impls of
    'ZeroableOption' for 'NonZero*'.
 
  - Improve feature gate handling for unstable features.
 
  - Declutter the documentation of implementations of 'Zeroable' for
    tuples.
 
  - Replace uses of 'addr_of[_mut]!' with '&raw [mut]'.
 
 rust-analyzer:
 
  - Add type annotations to 'generate_rust_analyzer.py'.
 
  - Add support for scripts written in Rust ('generate_rust_target.rs',
    'rustdoc_test_builder.rs', 'rustdoc_test_gen.rs').
 
  - Refactor 'generate_rust_analyzer.py' to explicitly identify host and
    target crates, improve readability, and reduce duplication.
 
 And some other fixes, cleanups and improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmnZVNQACgkQGXyLc2ht
 IW09aA/9GIbluNhc5xNvfkMvv9Ki70TK+e/W78pQWoRlSmZU1MO6R5K2rMN+iYlu
 98S53EO38P5wBWOjIVFHm9mD1b59T945gcyGk9DxxFdl6I5mFKGZvE0Z8onTE/9b
 GUnO5dlWjmEwTfwD0csr4moLC8eoCGVmGpe4TEfvscAISeZJZwQ90UCoNSFy6TQS
 rJyzmIOBraZPrf1qptt3Sk6KY3b9HaxLv3kh1TAPYH0Dmrhhp+ckHvn5lT8uB8ZW
 xr1ThoP44Zwm+nq6JahiK1NWFXTs12vpoCQLbckJsN8r3GTmt9CfHll/0UcW5W7i
 bCUeCJDNwfbpVALNmQxHjtkvmDAuhqypxCTFSMMrWS66LOUaKxZ+u0ioi/1Ljfp4
 tCR1Uzpr3QD6c8rK0hJ28vW/5DjoqkMMwUDeUm6c36msST37xrDZPa/vN+VLxxhK
 H8sQ3SyvE0JdK8wBvd/pHGHv+RvIdi7cbV5H/WqBpwzCcupExuXiKBdFHeVIfXkQ
 zn7lsZtnBuL+hLpG1pz6BoCTW1KbR38YomaKupElkYCUYytu0H+0Af/lkK3HhviM
 9uynUVsn0+JaS9QvogArW/d+I0w49yjRHkWxfXIJZd0+mkT9V3JrGY7/iXwewl5R
 fRRP0hMx0vhY4f/Uss1qEu3RPfsafxnU1NBiVRZZtc37azSOKjE=
 =xRA/
 -----END PGP SIGNATURE-----

Merge tag 'rust-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux

Pull Rust updates from Miguel Ojeda:
 "Toolchain and infrastructure:

   - Bump the minimum Rust version to 1.85.0 (and 'bindgen' to 0.71.1).

     As proposed in LPC 2025 and the Maintainers Summit [1], we are
     going to follow Debian Stable's Rust versions as our minimum
     versions.

     Debian Trixie was released on 2025-08-09 with a Rust 1.85.0 and
     'bindgen' 0.71.1 toolchain, which is a fair amount of time for e.g.
     kernel developers to upgrade.

     Other major distributions support a Rust version that is high
     enough as well, including:

       + Arch Linux.
       + Fedora Linux.
       + Gentoo Linux.
       + Nix.
       + openSUSE Slowroll and openSUSE Tumbleweed.
       + Ubuntu 25.10 and 26.04 LTS. In addition, 24.04 LTS using
         their versioned packages.

     The merged patch series comes with the associated cleanups and
     simplifications treewide that can be performed thanks to both
     bumps, as well as documentation updates.

     In addition, start using 'bindgen''s '--with-attribute-custom-enum'
     feature to set the 'cfi_encoding' attribute for the 'lru_status'
     enum used in Binder.

     Link: https://lwn.net/Articles/1050174/ [1]

   - Add experimental Kconfig option ('CONFIG_RUST_INLINE_HELPERS') that
     inlines C helpers into Rust.

     Essentially, it performs a step similar to LTO, but just for the
     helpers, i.e. very local and fast.

     It relies on 'llvm-link' and its '--internalize' flag, and requires
     a compatible LLVM between Clang and 'rustc' (i.e. same major
     version, 'CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE'). It is only enabled
     for two architectures for now.

     The result is a measurable speedup in different workloads that
     different users have tested. For instance, for the null block
     driver, it amounts to a 2%.

   - Support global per-version flags.

     While we already have per-version flags in many places, we didn't
     have a place to set global ones that depend on the compiler
     version, i.e. in 'rust_common_flags', which sometimes is needed to
     e.g. tweak the lints set per version.

     Use that to allow the 'clippy::precedence' lint for Rust < 1.86.0,
     since it had a change in behavior.

   - Support overriding the crate name and apply it to Rust Binder,
     which wanted the module to be called 'rust_binder'.

   - Add the remaining '__rust_helper' annotations (started in the
     previous cycle).

  'kernel' crate:

   - Introduce the 'const_assert!' macro: a more powerful version of
     'static_assert!' that can refer to generics inside functions or
     implementation bodies, e.g.:

         fn f<const N: usize>() {
             const_assert!(N > 1);
         }

         fn g<T>() {
             const_assert!(size_of::<T>() > 0, "T cannot be ZST");
         }

     In addition, reorganize our set of build-time assertion macros
     ('{build,const,static_assert}!') to live in the 'build_assert'
     module.

     Finally, improve the docs as well to clarify how these are
     different from one another and how to pick the right one to use,
     and their equivalence (if any) to the existing C ones for extra
     clarity.

   - 'sizes' module: add 'SizeConstants' trait.

     This gives us typed 'SZ_*' constants (avoiding casts) for use in
     device address spaces where the address width depends on the
     hardware (e.g. 32-bit MMIO windows, 64-bit GPU framebuffers, etc.),
     e.g.:

         let gpu_heap = 14 * u64::SZ_1M;
         let mmio_window = u32::SZ_16M;

   - 'clk' module: implement 'Send' and 'Sync' for 'Clk' and thus
     simplify the users in Tyr and PWM.

   - 'ptr' module: add 'const_align_up'.

   - 'str' module: improve the documentation of the 'c_str!' macro to
     explain that one should only use it for non-literal cases (for the
     other case we instead use C string literals, e.g. 'c"abc"').

   - Disallow the use of 'CStr::{as_ptr,from_ptr}' and clean one such
     use in the 'task' module.

   - 'sync' module: finish the move of 'ARef' and 'AlwaysRefCounted'
     outside of the 'types' module, i.e. update the last remaining
     instances and finally remove the re-exports.

   - 'error' module: clarify that 'from_err_ptr' can return 'Ok(NULL)',
     including runtime-tested examples.

     The intention is to hopefully prevent UB that assumes the result of
     the function is not 'NULL' if successful. This originated from a
     case of UB I noticed in 'regulator' that created a 'NonNull' on it.

  Timekeeping:

   - Expand the example section in the 'HrTimer' documentation.

   - Mark the 'ClockSource' trait as unsafe to ensure valid values for
     'ktime_get()'.

   - Add 'Delta::from_nanos()'.

  'pin-init' crate:

   - Replace the 'Zeroable' impls for 'Option<NonZero*>' with impls of
     'ZeroableOption' for 'NonZero*'.

   - Improve feature gate handling for unstable features.

   - Declutter the documentation of implementations of 'Zeroable' for
     tuples.

   - Replace uses of 'addr_of[_mut]!' with '&raw [mut]'.

  rust-analyzer:

   - Add type annotations to 'generate_rust_analyzer.py'.

   - Add support for scripts written in Rust ('generate_rust_target.rs',
     'rustdoc_test_builder.rs', 'rustdoc_test_gen.rs').

   - Refactor 'generate_rust_analyzer.py' to explicitly identify host
     and target crates, improve readability, and reduce duplication.

  And some other fixes, cleanups and improvements"

* tag 'rust-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (79 commits)
  rust: sizes: add SizeConstants trait for device address space constants
  rust: kernel: update `file_with_nul` comment
  rust: kbuild: allow `clippy::precedence` for Rust < 1.86.0
  rust: kbuild: support global per-version flags
  rust: declare cfi_encoding for lru_status
  docs: rust: general-information: use real example
  docs: rust: general-information: simplify Kconfig example
  docs: rust: quick-start: remove GDB/Binutils mention
  docs: rust: quick-start: remove Nix "unstable channel" note
  docs: rust: quick-start: remove Gentoo "testing" note
  docs: rust: quick-start: add Ubuntu 26.04 LTS and remove subsection title
  docs: rust: quick-start: update minimum Ubuntu version
  docs: rust: quick-start: update Ubuntu versioned packages
  docs: rust: quick-start: openSUSE provides `rust-src` package nowadays
  rust: kbuild: remove "dummy parameter" workaround for `bindgen` < 0.71.1
  rust: kbuild: update `bindgen --rust-target` version and replace comment
  rust: rust_is_available: remove warning for `bindgen` < 0.69.5 && libclang >= 19.1
  rust: rust_is_available: remove warning for `bindgen` 0.66.[01]
  rust: bump `bindgen` minimum supported version to 0.71.1 (Debian Trixie)
  rust: block: update `const_refs_to_static` MSRV TODO comment
  ...
2026-04-13 09:54:20 -07:00
..
ABI 15 hotfixes. 6 are cc:stable. 14 are for MM. 2026-03-10 12:47:56 -07:00
accel
accounting delayacct: add timestamp of delay max 2026-01-31 16:16:06 -08:00
admin-guide USB fixes for 7.0-rc4 2026-03-14 09:43:12 -07:00
arch prctl: cfi: change the branch landing pad prctl()s to be more descriptive 2026-04-04 18:40:58 -06:00
block
bpf bpf-next-7.0 2026-02-10 11:26:21 -08:00
cdrom
core-api dma-mapping: Introduce DMA require coherency attribute 2026-03-20 12:05:36 +01:00
cpu-freq
crypto
dev-tools kunit: Add documentation of --list_suites 2026-03-09 10:46:02 -06:00
devicetree sound fixes for 7.0 2026-04-09 11:17:16 -07:00
doc-guide
driver-api docs: driver-model: document driver_override 2026-03-17 20:30:57 +01:00
edac
fault-injection
fb
features s390: Document s390 stackprotector support 2026-02-03 12:48:27 +01:00
filesystems ovl: make fsync after metadata copy-up opt-in mount option 2026-03-27 12:48:10 +01:00
firmware_class
firmware-guide docs: fix 're-use' -> 'reuse' in documentation 2026-02-02 09:54:15 -07:00
fpga
gpu drm for 7.0-rc1 2026-02-11 12:55:44 -08:00
hid
hwmon hwmon: (adm1177) fix sysfs ABI violation and current unit conversion 2026-03-25 06:50:13 -07:00
i2c
iio
images
infiniband
input docs: fix 're-use' -> 'reuse' in documentation 2026-02-02 09:54:15 -07:00
isdn
kbuild Kbuild/Kconfig updates for 7.0 2026-02-11 13:40:35 -08:00
kernel-hacking
leds docs: leds: Document TI LP5812 LED driver 2026-02-04 09:23:37 +00:00
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices TTY / Serial driver updates for 7.0-rc1 2026-02-17 09:30:52 -08:00
mm A handful of small, late-arriving documentation fixes. 2026-02-15 10:47:59 -08:00
netlabel
netlink net: shaper: protect from late creation of hierarchy 2026-03-19 13:47:15 +01:00
networking ipv6: icmp: remove obsolete code in icmpv6_xrlim_allow() 2026-02-18 16:46:36 -08:00
nvdimm
nvme
PCI Documentation: PCI: Document PCIe TLP Header decoder for AER messages 2026-03-23 15:58:02 -05:00
pcmcia
peci
power power supply and reset changes for the 7.0 series 2026-02-12 18:24:37 -08:00
process Rust changes for v7.1 2026-04-13 09:54:20 -07:00
RCU rcu-tasks: Document that RCU Tasks Trace grace periods now imply RCU grace periods 2026-03-30 15:48:14 -04:00
rust docs: rust: general-information: use real example 2026-04-07 10:00:25 +02:00
scheduler sched_ext: Documentation: Update sched-ext.rst 2026-03-06 12:40:27 -10:00
scsi SCSI misc on 20260212 2026-02-12 15:43:02 -08:00
security docs: trusted-encryped: add PKWM as a new trust source 2026-01-30 09:27:27 +05:30
sound ALSA: doc: usb-audio: Add doc for QUIRK_FLAG_SKIP_IFACE_SETUP 2026-03-03 07:35:24 +01:00
sphinx docs: automarkup.py: Skip common English words as C identifiers 2026-01-27 10:35:57 -07:00
sphinx-includes
sphinx-static
spi spi: Updates for v7.0 2026-02-11 09:43:43 -08:00
staging
sunrpc/xdr Add RPC language definition of NFSv4 POSIX ACL extension 2026-01-29 09:48:33 -05:00
target
tee
timers
tools RTLA patches for v7.0 2026-02-12 14:31:02 -08:00
trace Char/Misc/IIO driver changes for 7.0-rc1 2026-02-17 09:11:04 -08:00
translations mm.git review status for linus..mm-stable 2026-02-12 11:32:37 -08:00
usb USB / Thunderbolt changes for 7.0-rc1 2026-02-17 09:36:43 -08:00
userspace-api landlock: Expand restrict flags example for ABI version 8 2026-03-24 20:55:55 +01:00
virt Documentation: kvm: fix formatting of the quirks table 2026-03-11 19:16:52 +01:00
w1
watchdog linux-watchdog 6.20-rc1 tag 2026-02-16 12:21:22 -08:00
wmi platform-drivers-x86 for v7.0-1 2026-02-13 15:39:15 -08:00
.gitignore
.renames.txt net: ethernet: neterion: s2io: remove unused driver 2026-01-28 20:08:07 -08:00
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py
docutils.conf
index.rst
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst