Re: [PATCH] rust: pin_init_internal: fix rust-analyzer `mod quote`
From: Benno Lossin
Date: Thu Mar 20 2025 - 08:18:52 EST
On Thu Mar 20, 2025 at 2:35 AM CET, Tamir Duberstein wrote:
> Replace the `#[path]` attribute with a symlink to work around a
> limitation in rust-analyzer that requires all modules to belong to the
> same "source root". This allows code navigation from `pin_init_internal`
> to `quote` to work properly.
>
> Link: https://github.com/rust-lang/rust-analyzer/issues/3898
> Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
> ---
> rust/pin-init/internal/src/lib.rs | 1 -
> rust/pin-init/internal/src/quote.rs | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/pin-init/internal/src/lib.rs b/rust/pin-init/internal/src/lib.rs
> index babe5e878550..fdd95afe3864 100644
> --- a/rust/pin-init/internal/src/lib.rs
> +++ b/rust/pin-init/internal/src/lib.rs
> @@ -20,7 +20,6 @@
> use proc_macro::TokenStream;
>
> #[cfg(kernel)]
> -#[path = "../../../macros/quote.rs"]
> #[macro_use]
> mod quote;
> #[cfg(not(kernel))]
> diff --git a/rust/pin-init/internal/src/quote.rs b/rust/pin-init/internal/src/quote.rs
> new file mode 120000
> index 000000000000..27a213d1a6ba
> --- /dev/null
> +++ b/rust/pin-init/internal/src/quote.rs
> @@ -0,0 +1 @@
> +../../../macros/quote.rs
> \ No newline at end of file
>
> ---
> base-commit: ff7f9b199e3f4cc7d61df5a9a26a7cbb5c1492e6
> change-id: 20250319-pin-init-internal-quote-b7e15e9e8233
>
> Best regards,
I'd rather not have this change, since this will introduce a dangling
symlink upstream [1].
[1]: https://github.com/rust-for-Linux/pin-init
---
Cheers,
Benno