mirror-linux/Documentation/process
Linus Torvalds a9aabb3b83 Rust changes for v6.20 / v7.0
Toolchain and infrastructure:
 
  - Add '__rust_helper' annotation to the C helpers.
 
    This is needed to inline these helpers into Rust code.
 
  - Remove imports available via the prelude, treewide.
 
    This was possible thanks to a new lint in Klint that Gary has
    implemented -- more Klint-related changes, including initial upstream
    support, are coming.
 
  - Deduplicate pin-init flags.
 
 'kernel' crate:
 
  - Add support for calling a function exactly once with the new
    'do_once_lite!' macro (and 'OnceLite' type).
 
    Based on this, add 'pr_*_once!' macros to print only once.
 
  - Add 'impl_flags!' macro for defining common bitflags operations:
 
        impl_flags!(
            /// Represents multiple permissions.
            #[derive(Debug, Clone, Default, Copy, PartialEq, Eq)]
            pub struct Permissions(u32);
 
            /// Represents a single permission.
            #[derive(Debug, Clone, Copy, PartialEq, Eq)]
            pub enum Permission {
                /// Read permission.
                Read = 1 << 0,
 
                /// Write permission.
                Write = 1 << 1,
 
                /// Execute permission.
                Execute = 1 << 2,
            }
        );
 
        let mut f: Permissions = Permission::Read | Permission::Write;
        assert!(f.contains(Permission::Read));
        assert!(!f.contains(Permission::Execute));
 
        f |= Permission::Execute;
        assert!(f.contains(Permission::Execute));
 
        let f2: Permissions = Permission::Write | Permission::Execute;
        assert!((f ^ f2).contains(Permission::Read));
        assert!(!(f ^ f2).contains(Permission::Write));
 
  - 'bug' module: support 'CONFIG_DEBUG_BUGVERBOSE_DETAILED' in the
    'warn_on!' macro in order to show the evaluated condition alongside
    the file path:
 
         ------------[ cut here ]------------
         WARNING: [val == 1] linux/samples/rust/rust_minimal.rs:27 at ...
         Modules linked in: rust_minimal(+)
 
  - Add safety module with 'unsafe_precondition_assert!' macro, currently
    a wrapper for 'debug_assert!', intended to mark the validation of
    safety preconditions where possible:
 
        /// # Safety
        ///
        /// The caller must ensure that `index` is less than `N`.
        unsafe fn set_unchecked(&mut self, index: usize, value: T) {
            unsafe_precondition_assert!(
                index < N,
                "set_unchecked() requires index ({index}) < N ({N})"
            );
 
            ...
        }
 
  - Add instructions to 'build_assert!' documentation requesting to
    always inline functions when used with function arguments.
 
  - 'ptr' module: replace 'build_assert!' with a 'const' one.
 
  - 'rbtree' module: reduce unsafe blocks on pointer derefs.
 
  - 'transmute' module: implement 'FromBytes' and 'AsBytes' for
    inhabited ZSTs, and use it in Nova.
 
  - More treewide replacements of 'c_str!' with C string literals.
 
 'macros' crate:
 
  - Rewrite most procedural macros ('module!', 'concat_idents!',
    '#[export]', '#[vtable]', '#[kunit_tests]') to use the 'syn' parsing
    library which we introduced last cycle, with better diagnostics.
 
    This also allows to support '#[cfg]' properly in the '#[vtable]'
    macro, to support arbitrary types in 'module!' macro (not just an
    identifier) and to remove several custom parsing helpers we had.
 
  - Use 'quote!' from the recently vendored 'quote' library and remove
    our custom one.
 
    The vendored one also allows us to avoid quoting '"' and '{}' inside
    the template anymore and editors can now highlight it. In addition,
    it improves robustness as it eliminates the need for string quoting
    and escaping.
 
  - Use 'pin_init::zeroed()' to simplify KUnit code.
 
 'pin-init' crate:
 
  - Rewrite all procedural macros ('[pin_]init!', '#[pin_data]',
    '#[pinned_drop]', 'derive([Maybe]Zeroable)') to use the 'syn' parsing
    library which we introduced last cycle, with better diagnostics.
 
  - Implement 'InPlaceWrite' for '&'static mut MaybeUninit<T>'. This
    enables users to use external allocation mechanisms such as
    'static_cell'.
 
  - Support tuple structs in 'derive([Maybe]Zeroable)'.
 
  - Support attributes on fields in '[pin_]init!' (such as
    '#[cfg(...)]').
 
  - Add a '#[default_error(<type>)]' attribute to '[pin_]init!' to
    override the default error (when no '? Error' is specified).
 
  - Support packed structs in '[pin_]init!' with
    '#[disable_initialized_field_access]'.
 
  - Remove 'try_[pin_]init!' in favor of merging their feature
    with '[pin_]init!'. Update the kernel's own 'try_[pin_]init!'
    macros to use the 'default_error' attribute.
 
  - Correct 'T: Sized' bounds to 'T: ?Sized' in the generated
    'PinnedDrop' check by '#[pin_data]'.
 
 Documentation:
 
  - Conclude the Rust experiment.
 
 MAINTAINERS:
 
  - Add "RUST [RUST-ANALYZER]" entry for the rust-analyzer support. Tamir
    and Jesung will take care of it. They have both been active around it
    for a while. The new tree will flow through the Rust one.
 
  - Add Gary as maintainer for "RUST [PIN-INIT]".
 
  - Update Boqun and Tamir emails to their kernel.org accounts.
 
 And a few other cleanups and improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmmIeIwACgkQGXyLc2ht
 IW13gg//ZW9kgIILHRbyLtLA9luNukD75pYigg0sigeKfZq5SIbDVepOtDGIsXId
 fJwYme297u81nf+TWySGPKEwCPFX9NNwrN6JiIKTxxkpfIYNd+cA57QN141xm2y4
 4+cG0Zw7yj2PitTKl5nzjRr4dfdfG+t63zLa29O4D5XqMtKs+yeawMLmYpNJLcfJ
 /RDRt+p/GX84xgP7fFRPi6zG4sD48ZktmLOe2H7st/mQKxjtqXdMVSqKENhdriGm
 h6IdKPs38fxA953+xHE1jO+XygbevnBmWD/E+/7ns5nNajoHU8KKkKMUUyzGqcQK
 0tgnOW5Pn5zdZ2Tf+CYGEjo04aA1rDtAUTtjr74uGiUtJR63E3TcGaRr1sY9Hye2
 tqKC1MVnj+UFzaZw57OJI9s8At6HBz7NXx4ZZ/MrkKp3jaV5BFhz11rWPAF9SM2E
 DqMyIXSrKLCeLr1LocizvrTvNQFGQSdmlbnywnJ2PP679JbJsZz714igxTOvdQBt
 M4AGRl/BnC6ZUJV3+/cdpRfqUAi0TPYxouphQ5ynm0zuIG0VjCYhSWM/w9k3LiZD
 pamQYOVdBCUrIcPyXMyEt6DszZM5qlt+4syCygcYfdr3PklFrTxeqF9mhetEuJRR
 UcOEXAdknHFcPFUnMakAYrL9PBnVyb2INsdsRpOj2GTb/neJKPg=
 =en99
 -----END PGP SIGNATURE-----

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

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

   - Add '__rust_helper' annotation to the C helpers

     This is needed to inline these helpers into Rust code

   - Remove imports available via the prelude, treewide

     This was possible thanks to a new lint in Klint that Gary has
     implemented -- more Klint-related changes, including initial
     upstream support, are coming

   - Deduplicate pin-init flags

  'kernel' crate:

   - Add support for calling a function exactly once with the new
     'do_once_lite!' macro (and 'OnceLite' type)

     Based on this, add 'pr_*_once!' macros to print only once

   - Add 'impl_flags!' macro for defining common bitflags operations:

         impl_flags!(
             /// Represents multiple permissions.
             #[derive(Debug, Clone, Default, Copy, PartialEq, Eq)]
             pub struct Permissions(u32);

             /// Represents a single permission.
             #[derive(Debug, Clone, Copy, PartialEq, Eq)]
             pub enum Permission {
                 /// Read permission.
                 Read = 1 << 0,

                 /// Write permission.
                 Write = 1 << 1,

                 /// Execute permission.
                 Execute = 1 << 2,
             }
         );

         let mut f: Permissions = Permission::Read | Permission::Write;
         assert!(f.contains(Permission::Read));
         assert!(!f.contains(Permission::Execute));

         f |= Permission::Execute;
         assert!(f.contains(Permission::Execute));

         let f2: Permissions = Permission::Write | Permission::Execute;
         assert!((f ^ f2).contains(Permission::Read));
         assert!(!(f ^ f2).contains(Permission::Write));

   - 'bug' module: support 'CONFIG_DEBUG_BUGVERBOSE_DETAILED' in the
     'warn_on!' macro in order to show the evaluated condition alongside
     the file path:

          ------------[ cut here ]------------
          WARNING: [val == 1] linux/samples/rust/rust_minimal.rs:27 at ...
          Modules linked in: rust_minimal(+)

   - Add safety module with 'unsafe_precondition_assert!' macro,
     currently a wrapper for 'debug_assert!', intended to mark the
     validation of safety preconditions where possible:

         /// # Safety
         ///
         /// The caller must ensure that `index` is less than `N`.
         unsafe fn set_unchecked(&mut self, index: usize, value: T) {
             unsafe_precondition_assert!(
                 index < N,
                 "set_unchecked() requires index ({index}) < N ({N})"
             );

             ...
         }

   - Add instructions to 'build_assert!' documentation requesting to
     always inline functions when used with function arguments

   - 'ptr' module: replace 'build_assert!' with a 'const' one

   - 'rbtree' module: reduce unsafe blocks on pointer derefs

   - 'transmute' module: implement 'FromBytes' and 'AsBytes' for
     inhabited ZSTs, and use it in Nova

   - More treewide replacements of 'c_str!' with C string literals

  'macros' crate:

   - Rewrite most procedural macros ('module!', 'concat_idents!',
     '#[export]', '#[vtable]', '#[kunit_tests]') to use the 'syn'
     parsing library which we introduced last cycle, with better
     diagnostics

     This also allows to support '#[cfg]' properly in the '#[vtable]'
     macro, to support arbitrary types in 'module!' macro (not just an
     identifier) and to remove several custom parsing helpers we had

   - Use 'quote!' from the recently vendored 'quote' library and remove
     our custom one

     The vendored one also allows us to avoid quoting '"' and '{}'
     inside the template anymore and editors can now highlight it. In
     addition, it improves robustness as it eliminates the need for
     string quoting and escaping

   - Use 'pin_init::zeroed()' to simplify KUnit code

  'pin-init' crate:

   - Rewrite all procedural macros ('[pin_]init!', '#[pin_data]',
     '#[pinned_drop]', 'derive([Maybe]Zeroable)') to use the 'syn'
     parsing library which we introduced last cycle, with better
     diagnostics

   - Implement 'InPlaceWrite' for '&'static mut MaybeUninit<T>'. This
     enables users to use external allocation mechanisms such as
     'static_cell'

   - Support tuple structs in 'derive([Maybe]Zeroable)'

   - Support attributes on fields in '[pin_]init!' (such as
     '#[cfg(...)]')

   - Add a '#[default_error(<type>)]' attribute to '[pin_]init!' to
     override the default error (when no '? Error' is specified)

   - Support packed structs in '[pin_]init!' with
     '#[disable_initialized_field_access]'

   - Remove 'try_[pin_]init!' in favor of merging their feature with
     '[pin_]init!'. Update the kernel's own 'try_[pin_]init!' macros to
     use the 'default_error' attribute

   - Correct 'T: Sized' bounds to 'T: ?Sized' in the generated
     'PinnedDrop' check by '#[pin_data]'

  Documentation:

   - Conclude the Rust experiment

  MAINTAINERS:

   - Add "RUST [RUST-ANALYZER]" entry for the rust-analyzer support.
     Tamir and Jesung will take care of it. They have both been active
     around it for a while. The new tree will flow through the Rust one

   - Add Gary as maintainer for "RUST [PIN-INIT]"

   - Update Boqun and Tamir emails to their kernel.org accounts

  And a few other cleanups and improvements"

* tag 'rust-6.20-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (59 commits)
  rust: safety: introduce `unsafe_precondition_assert!` macro
  rust: add `impl_flags!` macro for defining common bitflag operations
  rust: print: Add pr_*_once macros
  rust: bug: Support DEBUG_BUGVERBOSE_DETAILED option
  rust: print: Add support for calling a function exactly once
  rust: kbuild: deduplicate pin-init flags
  gpu: nova-core: remove imports available via prelude
  rust: clk: replace `kernel::c_str!` with C-Strings
  MAINTAINERS: Update my email address to @kernel.org
  rust: macros: support `#[cfg]` properly in `#[vtable]` macro.
  rust: kunit: use `pin_init::zeroed` instead of custom null value
  rust: macros: rearrange `#[doc(hidden)]` in `module!` macro
  rust: macros: allow arbitrary types to be used in `module!` macro
  rust: macros: convert `#[kunit_tests]` macro to use `syn`
  rust: macros: convert `concat_idents!` to use `syn`
  rust: macros: convert `#[export]` to use `syn`
  rust: macros: use `quote!` for `module!` macro
  rust: macros: use `syn` to parse `module!` macro
  rust: macros: convert `#[vtable]` macro to use `syn`
  rust: macros: use `quote!` from vendored crate
  ...
2026-02-10 11:53:01 -08:00
..
debugging Documentation: use a source-read extension for the index link boilerplate 2026-01-23 11:59:34 -07:00
1.Intro.rst Doc: correct spelling and wording mistakes 2026-01-06 14:39:58 -07:00
2.Process.rst Doc: correct spelling and wording mistakes 2026-01-06 14:39:58 -07:00
3.Early-stage.rst
4.Coding.rst Doc: correct spelling and wording mistakes 2026-01-06 14:39:58 -07:00
5.Posting.rst doc: development-process: add notice on testing 2026-02-02 10:02:05 -07:00
6.Followthrough.rst
7.AdvancedTopics.rst Doc: correct spelling and wording mistakes 2026-01-06 14:39:58 -07:00
8.Conclusion.rst
adding-syscalls.rst docs: fix 're-use' -> 'reuse' in documentation 2026-02-02 09:54:15 -07:00
applying-patches.rst
backporting.rst docs: fix typos and whitespace in Documentation/process/backporting.rst 2024-11-12 13:22:16 -07:00
botching-up-ioctls.rst
changes.rst bpf-next-7.0 2026-02-10 11:26:21 -08:00
code-of-conduct-interpretation.rst Documentation/CoC: Spell out the TAB role in enforcement decisions 2025-03-12 16:31:48 -06:00
code-of-conduct.rst
coding-assistants.rst docs: add AI Coding Assistants documentation 2026-01-06 14:55:06 -07:00
coding-style.rst docs: kdoc: move kernel-doc to tools/docs 2026-01-20 15:31:06 -07:00
conclave.rst Documentation: Project continuity 2026-01-24 16:16:47 -08:00
contribution-maturity-model.rst
cve.rst
deprecated.rst slab: Introduce kmalloc_flex() and family 2026-01-14 14:43:01 -08:00
development-process.rst
email-clients.rst docs: process: email-client: add Thunderbird "Toggle Line Wrap" extension 2026-01-06 14:38:28 -07:00
embargoed-hardware-issues.rst Documentation: embargoed-hardware-issues.rst: Add myself for Power 2025-06-18 16:38:50 +02:00
generated-content.rst Documentation: Provide guidelines for tool-generated content 2026-01-20 14:51:22 -07:00
handling-regressions.rst
howto.rst
index.rst A slightly calmer cycle for docs this time around, though there is still a 2026-02-09 20:53:18 -08:00
kernel-docs.rst kernel-docs: Add book to process/kernel-docs.rst 2025-02-18 13:24:01 -07:00
kernel-driver-statement.rst
kernel-enforcement-statement.rst
license-rules.rst docs/licensing: Clarify wording about "GPL" and "Proprietary" 2024-11-22 10:44:25 -07:00
maintainer-handbooks.rst
maintainer-kvm-x86.rst
maintainer-netdev.rst docs: netdev: refine 15-patch limit 2026-01-17 15:59:25 -08:00
maintainer-pgp-guide.rst Documentation: Improve wording on requirements for a free Nitrokey 2025-12-22 15:30:51 -07:00
maintainer-soc-clean-dts.rst docs: process: maintainer-soc-clean-dts: linux-next is decisive 2025-02-26 13:15:57 -06:00
maintainer-soc.rst Documentation/process: maintainer-soc: Mark 'make' as commands 2026-01-07 17:47:43 +01:00
maintainer-tip.rst Align git commit ID abbreviation guidelines and checks 2024-12-30 11:40:45 -07:00
maintainers.rst
management-style.rst
programming-language.rst rust: conclude the Rust experiment 2026-01-19 01:13:22 +01:00
researcher-guidelines.rst
security-bugs.rst Documentation: insist on the plain-text requirement for security reports 2025-12-22 15:32:03 -07:00
stable-api-nonsense.rst
stable-kernel-rules.rst
submit-checklist.rst docs/.../submit-checklist: Use Documentation/admin-guide/abi.rst for cross-ref of README 2025-03-12 16:41:56 -06:00
submitting-patches.rst docs: submitting-patches: suggest adding previous version links 2026-01-06 14:52:48 -07:00
volatile-considered-harmful.rst