rust/pin-init/internal/src/lib.rs | 1 - rust/pin-init/internal/src/quote.rs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
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@gmail.com>
---
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,
--
Tamir Duberstein <tamird@gmail.com>
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@gmail.com> > --- > 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
On Thu, Mar 20, 2025 at 8:16 AM Benno Lossin <benno.lossin@proton.me> wrote: > > 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@gmail.com> > > --- > > 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 I agree it's aesthetically displeasing. I'm not aware of any alternative that fixes the development workflow of this crate in the kernel.
On Thu Mar 20, 2025 at 2:31 PM CET, Tamir Duberstein wrote: > On Thu, Mar 20, 2025 at 8:16 AM Benno Lossin <benno.lossin@proton.me> wrote: >> 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 > > I agree it's aesthetically displeasing. I'm not aware of any > alternative that fixes the development workflow of this crate in the > kernel. I don't think it's too bad, and this code is going away soon-ish anyways. --- Cheers, Benno
On Thu, Mar 20, 2025 at 10:10 AM Benno Lossin <benno.lossin@proton.me> wrote: > > On Thu Mar 20, 2025 at 2:31 PM CET, Tamir Duberstein wrote: > > On Thu, Mar 20, 2025 at 8:16 AM Benno Lossin <benno.lossin@proton.me> wrote: > >> 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 > > > > I agree it's aesthetically displeasing. I'm not aware of any > > alternative that fixes the development workflow of this crate in the > > kernel. > > I don't think it's too bad, and this code is going away soon-ish > anyways. What would Andreas say? :) I don't think the going away soon argument is relevant in this case - the same applies to the dangling symlink.
On Wed, Mar 19, 2025 at 09:35:40PM -0400, 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@gmail.com> Are we allowed to have symlinks? Alice
On Thu, Mar 20, 2025 at 3:46 AM Alice Ryhl <aliceryhl@google.com> wrote: > > On Wed, Mar 19, 2025 at 09:35:40PM -0400, 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@gmail.com> > > Are we allowed to have symlinks? There are 77 symlinks in the kernel by my count. Perhaps most interesting are these: include/dt-bindings/clock/qcom,dispcc-sm8150.h include/dt-bindings/clock/qcom,dispcc-sm8350.h include/dt-bindings/clock/qcom,sm8650-dispcc.h include/dt-bindings/input/linux-event-codes.h I'm not sure if there are further criteria we need to satisfy.
© 2016 - 2025 Red Hat, Inc.