Re: [PATCH v2] scripts: generate_rust_analyzer.py: add missing macros deps
From: Fiona Behrens
Date: Mon Feb 10 2025 - 11:32:42 EST
Tamir Duberstein <tamird@xxxxxxxxx> writes:
> The macros crate has depended on std and proc_macro since its
> introduction in commit 1fbde52bde73 ("rust: add `macros` crate"). These
> dependencies were omitted from commit 8c4555ccc55c ("scripts: add
> `generate_rust_analyzer.py`") resulting in missing go-to-definition and
> autocomplete, and false-positive warnings emitted from rust-analyzer
> such as:
>
> [{
> "resource": "/Users/tamird/src/linux/rust/macros/module.rs",
> "owner": "_generated_diagnostic_collection_name_#1",
> "code": {
> "value": "non_snake_case",
> "target": {
> "$mid": 1,
> "path": "/rustc/",
> "scheme": "https",
> "authority": "doc.rust-lang.org",
> "query": "search=non_snake_case"
> }
> },
> "severity": 4,
> "message": "Variable `None` should have snake_case name, e.g. `none`",
> "source": "rust-analyzer",
> "startLineNumber": 123,
> "startColumn": 17,
> "endLineNumber": 123,
> "endColumn": 21
> }]
>
> Add the missing dependencies to improve the developer experience.
>
> Fixes: 8c4555ccc55c ("scripts: add `generate_rust_analyzer.py`")
> Suggested-by: Chayim Refael Friedman <chayimfr@xxxxxxxxx>
> Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
Competing with https://lore.kernel.org/rust-for-linux/20241205115438.234221-1-me@xxxxxxxxxx/
but I do like your aproach more.
Reviewed-by: Fiona Behrens <me@xxxxxxxxxx>
> ---
> Changes in v2:
> - Change macros deps from [core] to [std, proc_macro], improving
> autocomplete and go-to-definition.
> - Remove Wedson Almeida Filho <wedsonaf@xxxxxxxxxx> from cc; email
> bounced.
> - Link to v1: https://lore.kernel.org/r/20250209-rust-analyzer-macros-core-dep-v1-1-5ebeb3eb60a9@xxxxxxxxx