<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/scripts/generate_rust_analyzer.py, branch v7.0-rc7</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.0-rc7</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.0-rc7'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-02-10T19:53:01+00:00</updated>
<entry>
<title>Merge tag 'rust-6.20-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux</title>
<updated>2026-02-10T19:53:01+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-10T19:53:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a9aabb3b839aba094ed80861054993785c61462c'/>
<id>urn:sha1:a9aabb3b839aba094ed80861054993785c61462c</id>
<content type='text'>
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 &lt;&lt; 0,

                 /// Write permission.
                 Write = 1 &lt;&lt; 1,

                 /// Execute permission.
                 Execute = 1 &lt;&lt; 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(&amp;mut self, index: usize, value: T) {
             unsafe_precondition_assert!(
                 index &lt; N,
                 "set_unchecked() requires index ({index}) &lt; 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 '&amp;'static mut MaybeUninit&lt;T&gt;'. 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(&lt;type&gt;)]' 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
  ...
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: fix resolution of #[pin_data] macros</title>
<updated>2026-01-26T01:19:29+00:00</updated>
<author>
<name>SeungJong Ha</name>
<email>engineer.jjhama@gmail.com</email>
</author>
<published>2026-01-23T13:18:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e440bc5c190cd0e5f148b2892aeb1f4bbbf54507'/>
<id>urn:sha1:e440bc5c190cd0e5f148b2892aeb1f4bbbf54507</id>
<content type='text'>
Currently, rust-analyzer fails to properly resolve structs annotated with
`#[pin_data]`. This prevents IDE features like "Go to Definition" from
working correctly for those structs.

Add the missing configuration to `generate_rust_analyzer.py` to ensure
the `pin-init` crate macros are handled correctly.

Signed-off-by: SeungJong Ha &lt;engineer.jjhama@gmail.com&gt;
Fixes: d7659acca7a3 ("rust: add pin-init crate build infrastructure")
Cc: stable@vger.kernel.org
Tested-by: Tamir Duberstein &lt;tamird@kernel.org&gt;
Acked-by: Tamir Duberstein &lt;tamird@kernel.org&gt;
Acked-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Link: https://patch.msgid.link/20260123-fix-pin-init-crate-dependecies-v2-1-bb1c2500e54c@gmail.com
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: compile sysroot with correct edition</title>
<updated>2026-01-18T19:26:29+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@kernel.org</email>
</author>
<published>2026-01-16T20:46:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac3c50b9a24e9ebeb585679078d6c47922034bb6'/>
<id>urn:sha1:ac3c50b9a24e9ebeb585679078d6c47922034bb6</id>
<content type='text'>
Use `core_edition` for all sysroot crates rather than just core as all
were updated to edition 2024 in Rust 1.87.

Fixes: f4daa80d6be7 ("rust: compile libcore with edition 2024 for 1.87+")
Signed-off-by: Tamir Duberstein &lt;tamird@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260116-rust-analyzer-sysroot-v2-1-094aedc33208@kernel.org
[ Added `&gt;`s to make the quote a single block. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: compile quote with correct edition</title>
<updated>2026-01-18T19:26:29+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2026-01-15T16:45:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bc83834c157676e7cca62b876b5e3da1bee06285'/>
<id>urn:sha1:bc83834c157676e7cca62b876b5e3da1bee06285</id>
<content type='text'>
Our copy of the quote crate uses edition 2018, thus generate the correct
rust-analyzer configuration for it.

Fixes: 88de91cc1ce7 ("rust: quote: enable support in kbuild")
Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260115-rust-analyzer-quote-edition-v1-1-d492f880dde4@gmail.com
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: quote: treat `core` and `std` as dependencies</title>
<updated>2026-01-18T19:26:26+00:00</updated>
<author>
<name>Jesung Yang</name>
<email>y.j3ms.n@gmail.com</email>
</author>
<published>2025-11-25T09:33:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3a50257e560043bf8968f807af65f32c98d7dbf9'/>
<id>urn:sha1:3a50257e560043bf8968f807af65f32c98d7dbf9</id>
<content type='text'>
Fix the `generate_rust_analyzer.py` script to ensure that the
`rust-project.json` it produces includes `core` and `std` in the `deps`
field for the `quote` crate.

`quote` directly references items from both `core` and `std`, so
rust-analyzer should treat them as dependencies to provide correct IDE
support.

For example, the `::quote::ToTokens` trait is implemented for
`std::ffi::CString`. With `std` listed in the `deps` field,
rust-analyzer can show the expected autocomplete for the
`::quote::ToTokens` methods on `std::ffi::CString`.

Verified the explicit uses of `core` and `std` using:

    grep -rnE 'core::|std::' rust/quote/

Fixes: 88de91cc1ce7 ("rust: quote: enable support in kbuild")
Signed-off-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Link: https://patch.msgid.link/cef76fc1105481d219953c8552eb5eb07dac707a.1764062688.git.y.j3ms.n@gmail.com
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: syn: treat `std` as a dependency</title>
<updated>2026-01-18T19:25:26+00:00</updated>
<author>
<name>Jesung Yang</name>
<email>y.j3ms.n@gmail.com</email>
</author>
<published>2025-11-25T09:32:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=87417cc95b0f1096cc27011ec750d9f988a63e83'/>
<id>urn:sha1:87417cc95b0f1096cc27011ec750d9f988a63e83</id>
<content type='text'>
Fix the `generate_rust_analyzer.py` script to ensure that the
`rust-project.json` it produces includes `std` in the `deps` field for
the `syn` crate.

`syn` directly references items from `std`, so rust-analyzer should
treat it as a dependency to provide correct IDE support.

For example, `syn::Punctuated` contains fields of type `Vec&lt;..&gt;` and
`Option&lt;..&gt;`, both of which come from the standard library prelude.
With `std` listed in the `deps` field, rust-analyzer can infer the types
of these fields instead of showing `{unknown}`.

Verified the explicit uses of `std` using:

    grep -rn 'std::' rust/syn/

Fixes: 737401751ace ("rust: syn: enable support in kbuild")
Signed-off-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Tested-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Link: https://patch.msgid.link/6dbdf6e1c1639ae381ca9ab7041f84728ffa2267.1764062688.git.y.j3ms.n@gmail.com
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: remove sysroot assertion</title>
<updated>2026-01-18T19:24:15+00:00</updated>
<author>
<name>Onur Özkan</name>
<email>work@onurozkan.dev</email>
</author>
<published>2025-12-24T13:53:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1b83ef9f7ad4635c913b80ef5e718f95f48e85af'/>
<id>urn:sha1:1b83ef9f7ad4635c913b80ef5e718f95f48e85af</id>
<content type='text'>
With nixpkgs's rustc, rust-src component is not bundled
with the compiler by default and is instead provided from
a separate store path, so this assumption does not hold.

The assertion assumes these paths are in the same location
which causes `make LLVM=1 rust-analyzer` to fail on NixOS.

Link: https://rust-for-linux.zulipchat.com/#narrow/stream/x/topic/x/near/565284250
Signed-off-by: Onur Özkan &lt;work@onurozkan.dev&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Fixes: fe992163575b ("rust: Support latest version of `rust-analyzer`")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20251224135343.32476-1-work@onurozkan.dev
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: add `syn` dependency and remove `proc-macro[2]` and `quote` workarounds</title>
<updated>2026-01-17T09:49:31+00:00</updated>
<author>
<name>Benno Lossin</name>
<email>lossin@kernel.org</email>
</author>
<published>2026-01-16T10:54:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=514e4ed2c9da9112fcd378b1bd9b9d120edf7ca9'/>
<id>urn:sha1:514e4ed2c9da9112fcd378b1bd9b9d120edf7ca9</id>
<content type='text'>
`syn` makes parsing Rust from proc-macros a lot simpler. `pin-init` has
not used `syn` up until now, because the we did not support it. That
changed in commit 54e3eae85562 ("Merge patch series "`syn` support""),
so we can finally utilize the added ergonomics of parsing proc-macro
input with `syn`.

Previously we only had the `proc-macro` library available, whereas the
user-space version also used `proc-macro2` and `quote`. Now both are
available, so remove the workarounds.

Due to these changes, clippy emits warnings about unnecessary
`.to_string()` as `proc-macro2` provides an additional `PartialEq` impl
on `Ident`, so the warnings are fixed.

[ Adjusted wording from upstream version and added build system changes
  for the kernel - Benno ]

Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Tested-by: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Signed-off-by: Benno Lossin &lt;lossin@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: Add pin_init_internal deps</title>
<updated>2026-01-14T18:53:02+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@kernel.org</email>
</author>
<published>2025-07-23T15:39:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=74e15ac34b098934895fd27655d098971d2b43d9'/>
<id>urn:sha1:74e15ac34b098934895fd27655d098971d2b43d9</id>
<content type='text'>
Commit d7659acca7a3 ("rust: add pin-init crate build infrastructure")
did not add dependencies to `pin_init_internal`, resulting in broken
navigation. Thus add them now.

[ Tamir elaborates:

  "before this series, go-to-symbol from pin_init_internal to e.g.
   proc_macro::TokenStream doesn't work."

     - Miguel ]

Signed-off-by: Tamir Duberstein &lt;tamird@kernel.org&gt;
Reviewed-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Acked-by: Benno Lossin &lt;lossin@kernel.org&gt;
Fixes: d7659acca7a3 ("rust: add pin-init crate build infrastructure")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250723-rust-analyzer-pin-init-v1-3-3c6956173c78@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>scripts: generate_rust_analyzer: Add pin_init -&gt; compiler_builtins dep</title>
<updated>2026-01-14T18:53:02+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@kernel.org</email>
</author>
<published>2025-07-23T15:39:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=98dcca855343512a99432224447f07c5988753ad'/>
<id>urn:sha1:98dcca855343512a99432224447f07c5988753ad</id>
<content type='text'>
Add a dependency edge from `pin_init` to `compiler_builtins` to
`scripts/generate_rust_analyzer.py` to match `rust/Makefile`. This has
been incorrect since commit d7659acca7a3 ("rust: add pin-init crate
build infrastructure").

Signed-off-by: Tamir Duberstein &lt;tamird@kernel.org&gt;
Reviewed-by: Jesung Yang &lt;y.j3ms.n@gmail.com&gt;
Acked-by: Benno Lossin &lt;lossin@kernel.org&gt;
Fixes: d7659acca7a3 ("rust: add pin-init crate build infrastructure")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250723-rust-analyzer-pin-init-v1-2-3c6956173c78@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
</feed>
