rust-analyzer fails to resolve xpcom::interfaces::*
Categories
(Developer Infrastructure :: Developer Environment Integration, defect, P5)
Tracking
(firefox136 fixed)
| Tracking | Status | |
|---|---|---|
| firefox136 | --- | fixed |
People
(Reporter: saschanaz, Assigned: nrishel)
References
Details
(Whiteboard: [fidedi])
Attachments
(1 file)
Probably some include! macro related issue? Perhaps a rust-analyzer bug, but filing here until we figure it out as it affects Firefox dev experience.
For example, hovering mouse cursor on interface names on authrs_bridge/src/lib.rs shows nothing, and the interface names are rendered as plaintext color (white on my config) instead of struct name color (green on my config). (Edit: This affects searchfox too; clicking on interfaces only gives "Search for the substring ..." instead of "Go to definition". Thanks Andrew!)
Similar thing affects windows-rs crate where any modules include!-ed from build/rust/windows/src/lib.rs do not autocomplete.
(Tested on Windows 11)
| Reporter | ||
Comment 1•2 years ago
|
||
It seems rust-analyzer fails to expand include! macro if the destination is outside of the crate directory. Tried playing with "Inline macro" feature in VSCode rust-analyzer within xpcom/rust/nserror/src/lib.rs, and it works for "lol.rs", "../lol.rs" but then stops working for "../../lol.rs"; it silently gives empty string. (lol.rs is a file I added to test this, with only a string literal "what" in it.)
Tried nightly toolchain and the behavior is still same.
| Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 2•2 years ago
|
||
The severity field is not set for this bug.
:ahochheiden, could you have a look please?
For more information, please visit BugBot documentation.
Comment 3•2 years ago
|
||
It seems like this is entirely a rust-analyzer issue, and there's nothing we can really do about this from a build system perspective.
I suppose keeping it open until it's resolved upstream is fine though, just for visibility.
| Assignee | ||
Comment 4•2 years ago
•
|
||
Found a workaround for the time being.
- Replace
mozilla-unified\build\rust\windows\src\lib.rswith.mozbuild\windows-rs\src\lib.rs - In CMD (not mozilla build's MSYS or powershell) run
mklink /d C:\[some path]\mozilla-unified\build\rust\windows\src\Windows C:\[some other path]\.mozbuild\windows-rs\src\Windows - Restart rust-analyzer server if VS Code was running (or restart VS Code).
For commit convenience you can add ^build/rust/windows/src/Windows/.* to .hgignore and save these changes as a commit that can be removed from a patch's history as needed.
| Reporter | ||
Comment 5•2 years ago
|
||
(That's windows-rs specific as it has very special situation, and not really applies for generated types like xpcom interfaces.)
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 6•1 year ago
|
||
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Description
•