* [PATCH v2] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate
@ 2026-05-20 7:47 Malte Wechter
2026-06-03 13:56 ` Tamir Duberstein
0 siblings, 1 reply; 2+ messages in thread
From: Malte Wechter @ 2026-05-20 7:47 UTC (permalink / raw)
To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Tamir Duberstein, Jesung Yang
Cc: rust-for-linux, linux-kernel, Malte Wechter
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.
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 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>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate
2026-05-20 7:47 [PATCH v2] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate Malte Wechter
@ 2026-06-03 13:56 ` Tamir Duberstein
0 siblings, 0 replies; 2+ messages in thread
From: Tamir Duberstein @ 2026-06-03 13:56 UTC (permalink / raw)
To: Malte Wechter
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Jesung Yang, rust-for-linux, linux-kernel
On Wed, May 20, 2026 at 3:47 AM Malte Wechter <maltewechter@gmail.com> wrote:
>
> 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.
>
> 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:
Should this patch have a Fixes tag mentioning 36174d16?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-03 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-20 7:47 [PATCH v2] rust-analyzer: update generate_rust_analyzer to pass cfg to macros crate Malte Wechter
2026-06-03 13:56 ` Tamir Duberstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome