From: Malte Wechter <maltewechter@gmail.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Jesung Yang" <y.j3ms.n@gmail.com>,
"David Gow" <david@davidgow.net>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Malte Wechter <maltewechter@gmail.com>
Subject: [PATCH v3] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate
Date: Wed, 03 Jun 2026 16:20:51 +0200 [thread overview]
Message-ID: <20260603-rust-analyzer-macro-v3-1-9f7fdb4908e5@gmail.com> (raw)
The configuration passed to rust-analyzer for the `macros` create is
different from the configuration used to build the crate. Update
rust-analyzer configuration for the `macros` crate to reflect the
settings used to compile the crate. Without this change, rust-analyzer
does not understand conditional compilation gated by configuration
redicates based on the `CONFIG_*`configuration values in the macros
crate.
Fixes: 36174d16f3ec ("rust: kunit: support KUnit-mapped `assert!` macros in `#[test]`s")
Signed-off-by: Malte Wechter <maltewechter@gmail.com>
---
We are currently moving the 'configfs_attrs' macro to a procedual implementation,
with this we wanted to gate the macro on CONFIG_CONFIGFS_FS, since the macros crate is
build with these configurations since 36174d16 ("rust: kunit: support KUnit-mapped `assert!` macros in `#[test]`s").
It compiles but rust-analyzer does not reflect this as adding:
#[cfg(CONFIG_CONFIGFS_FS)]
mod configfs_attrs;
will _never_ mark configfs_attrs module as included since the cfg's are not passed to
the macros crate.
---
Changes in v3:
- Add fixes tag
- Link to v2: https://lore.kernel.org/r/20260520-rust-analyzer-macro-v2-1-bcf5bdeca1a1@gmail.com
Changes in v2:
- Update commit message
- Link to v1: https://lore.kernel.org/r/20260508-rust-analyzer-macro-v1-1-9122b940d003@gmail.com
---
scripts/generate_rust_analyzer.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index d5f9a0ca742c..69990a96522e 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -238,6 +238,7 @@ def generate_crates(
"macros",
srctree / "rust" / "macros" / "lib.rs",
[std, proc_macro, proc_macro2, quote, syn],
+ cfg=generated_cfg,
)
build_error = append_crate(
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260506-rust-analyzer-macro-22f387f8eff4
Best regards,
--
Malte Wechter <maltewechter@gmail.com>
next reply other threads:[~2026-06-03 14:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 14:20 Malte Wechter [this message]
2026-06-03 14:27 ` [PATCH v3] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate Tamir Duberstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260603-rust-analyzer-macro-v3-1-9f7fdb4908e5@gmail.com \
--to=maltewechter@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=david@davidgow.net \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=y.j3ms.n@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.