public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts: generate_rust_analyzer.py: better pin-init macro resolvea
@ 2026-01-23 10:02 SeungJong Ha via B4 Relay
  2026-01-23 10:26 ` Miguel Ojeda
  2026-01-23 12:23 ` Jesung Yang
  0 siblings, 2 replies; 5+ messages in thread
From: SeungJong Ha via B4 Relay @ 2026-01-23 10:02 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel, SeungJong Ha

From: SeungJong Ha <engineer.jjhama@gmail.com>

Signed-off-by: SeungJong Ha <engineer.jjhama@gmail.com>
---
scripts: generate_rust_analyzer.py: Fix pin-init configuration for
better macro resolve

Hello,

I encountered an issue where rust-analyzer fails to analyze
structs decorated with the #[pin_data] attribute while testing
Rust kernel modules.

It appears that the dependencies for pin-init and drivers were
missing from the analyzer's configuration. This patch adds
those missing dependencies.

I have verified that my rust-analyzer correctly processes
\#[pin_data] structs after applying this fix.

Best regards, SeungJong
---
 scripts/generate_rust_analyzer.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index 147d0cc94068..0c6c0444917f 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -123,10 +123,18 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
     append_crate(
         "pin_init_internal",
         srctree / "rust" / "pin-init" / "internal" / "src" / "lib.rs",
-        [],
+        ["std", "proc_macro"],
         cfg=["kernel"],
         is_proc_macro=True,
     )
+    # pin_init_internal uses #[path = "../../../macros/quote.rs"] to include quote.rs
+    crates[-1]["source"] = {
+        "include_dirs": [
+            str(srctree / "rust" / "pin-init" / "internal" / "src"),
+            str(srctree / "rust" / "macros"),
+        ],
+        "exclude_dirs": [],
+    }
 
     append_crate(
         "pin_init",
@@ -190,7 +198,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
             append_crate(
                 name,
                 path,
-                ["core", "kernel"],
+                ["core", "kernel", "pin_init"],
                 cfg=cfg,
             )
 

---
base-commit: 2ad6c5cdc89acfefb01b84afa5e55262c40d6fec
change-id: 20260123-fix-pin-init-crate-dependecies-b94ac4247a48

Best regards,
-- 
SeungJong Ha <engineer.jjhama@gmail.com>



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-23 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 10:02 [PATCH] scripts: generate_rust_analyzer.py: better pin-init macro resolvea SeungJong Ha via B4 Relay
2026-01-23 10:26 ` Miguel Ojeda
2026-01-23 13:14   ` 하승종
2026-01-23 12:23 ` Jesung Yang
2026-01-23 13:15   ` 하승종

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox