rust-lang / rust-lang/rust-analyzer
rust-analyzer incorrectly expands derives on bevy's `LoadedUntypedAsset`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.1722-standalone
rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)
relevant settings:
"rust-analyzer.diagnostics.disabled": [
"unresolved-method",
"E0616"
],
"rust-analyzer.hover.documentation.keywords.enable": false,
"rust-analyzer.cargo.buildScripts.useRustcWrapper": false,
Bevy 0.12 has this LoadedUntypedAsset type:
#[derive(Asset, TypePath)]
pub struct LoadedUntypedAsset {
#[dependency]
pub handle: UntypedHandle,
}
This type does not work correctly in rust-analyzer when wrapped in the Assets collection, which requires T: Asset. This is caused by rust-analyzer incorrectly expanding the derives on the type: running "expand macro recursively" on the Asset derive gives the output of the TypePath derive instead, and running it on the TypePath token says "not available".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Bevy 0.12 LoadedUntypedAsset example and inspecting rust-analyzer's "expand macro recursively" entry point; the issue names no repository file or test. Compare the Asset and TypePath derive expansions, and consider the issue done when each derive expands to its own output and the type works where T: Asset is required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100