[PATCH v2 0/2] rust: fix rust-analyzer configuration for generated files

Tamir Duberstein posted 2 patches 12 months ago
scripts/generate_rust_analyzer.py | 41 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 20 deletions(-)
[PATCH v2 0/2] rust: fix rust-analyzer configuration for generated files
Posted by Tamir Duberstein 12 months ago
The individual patches should be descriptive on their own. They are
included in a single series because the second patch uses a function
introduced in the first.

I've confirmed this allows me to navigate to symbols defined in
generated files as well as to the generated files themselves. I am using
an out-of-source build.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Changes in v2:
- Add missing core dependency on uapi. Fixes navigation in
  rust/kernel/ioctl.rs.
- Link to v1: https://lore.kernel.org/r/20250210-rust-analyzer-bindings-include-v1-0-6cbf420e95b6@gmail.com

---
Tamir Duberstein (2):
      scripts: generate_rust_analyzer.py: add missing include_dirs
      scripts: generate_rust_analyzer.py: add uapi crate

 scripts/generate_rust_analyzer.py | 41 ++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 20 deletions(-)
---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250210-rust-analyzer-bindings-include-531e9dacec8d

Best regards,
-- 
Tamir Duberstein <tamird@gmail.com>
Re: [PATCH v2 0/2] rust: fix rust-analyzer configuration for generated files
Posted by Miguel Ojeda 11 months ago
On Mon, Feb 10, 2025 at 7:04 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> The individual patches should be descriptive on their own. They are
> included in a single series because the second patch uses a function
> introduced in the first.
>
> I've confirmed this allows me to navigate to symbols defined in
> generated files as well as to the generated files themselves. I am using
> an out-of-source build.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Applied to `rust-fixes` -- thanks everyone!

      [ Originally we were not using `OBJTREE` in the `kernel` crate, but
        we did pass the variable anyway, so conceptually it could have been
        there since then.

        Regarding `include_dirs`, it started in `kernel` before being in
        mainline because we included the bindings directly there (i.e.
        there was no `bindings` crate). However, when that crate got
        created, we moved the `OBJTREE` there but not the `include_dirs`.
        Nowadays, though, we happen to need the `include_dirs` also in
        the `kernel` crate for `generated_arch_static_branch_asm.rs` which
        was not there back then -- Tamir confirms it is indeed required
        for that reason. - Miguel ]

    [ Slightly reworded title. - Miguel ]

    [ Slightly reworded title. - Miguel ]

Cheers,
Miguel
Re: [PATCH v2 0/2] rust: fix rust-analyzer configuration for generated files
Posted by Andreas Hindborg 12 months ago
"Tamir Duberstein" <tamird@gmail.com> writes:

> The individual patches should be descriptive on their own. They are
> included in a single series because the second patch uses a function
> introduced in the first.
>
> I've confirmed this allows me to navigate to symbols defined in
> generated files as well as to the generated files themselves. I am using
> an out-of-source build.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

This is amazing, I have been missing this for so long 😆 With this patch
I get auto completion of symbols in `bindings` and `uapi`, without it,
no completions. I build out of tree.

For the whole series:

Tested-by: Andreas Hindborg <a.hindborg@kernel.org>


Best regards,
Andreas Hindborg
Re: [PATCH v2 0/2] rust: fix rust-analyzer configuration for generated files
Posted by Tamir Duberstein 11 months, 2 weeks ago
On Tue, Feb 11, 2025 at 10:21 AM Andreas Hindborg <a.hindborg@kernel.org> wrote:
>
> "Tamir Duberstein" <tamird@gmail.com> writes:
>
> > The individual patches should be descriptive on their own. They are
> > included in a single series because the second patch uses a function
> > introduced in the first.
> >
> > I've confirmed this allows me to navigate to symbols defined in
> > generated files as well as to the generated files themselves. I am using
> > an out-of-source build.
> >
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Hi folks, gentle ping here.

> This is amazing, I have been missing this for so long 😆 With this patch
> I get auto completion of symbols in `bindings` and `uapi`, without it,
> no completions. I build out of tree.
>
> For the whole series:
>
> Tested-by: Andreas Hindborg <a.hindborg@kernel.org>

Thanks for testing!