rust-analyzer
rust-analyzer copied to clipboard
Auto Import not working with `derive_more` proc macros
This is not a duplicate of #6183 because
- the import resolves.
-
procMacro.enableis set totrue.
rust-analyzer version: 0.3.1983-standalone (7852a4c77 2024-06-02)
rustc version: 1.78.0 (9b00956e5 2024-04-29)
editor or extension: VSCode
relevant settings:
-
"rust-analyzer.completion.autoimport": true -
"rust-analyzer.procMacro.enable": true
to reproduce:
- Create a new library crate project with dependencies
derive_moreandparse-display. - In
lib.rs, define the following struct:
struct Example(i32);
- Add
#[derive(Display)]on the line above. While typing, observe that Auto Import correctly suggestsparse_display::Display. Remove the derive attribute. - Add
#[derive(From)]on the line above the struct definition. While typing, observe that Auto Import does not suggestderive_more::From. - To fix the error, replace
Fromwithderive_more::From. Observe that the macro resolves and the code compiles.
LIkely due to the collision of the From trait in the prelude, r-a doesn't handle those well for auto imports yet iirc
@rustbot claim
@rustbot release-assignment