rust-lang / rust-lang/rust-analyzer
Very large vec literals hang rust-analyzer
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
The crate spm_precompiled has a huge vec literal (~15,000 integers) in its current released version on crates.io:
This has been fixed in https://github.com/huggingface/spm_precompiled/pull/5, but not yet released. As a result, any project that transitively depends on spm_precompiled hangs when rust-analyzer indexes all its dependencies at startup.
spm_recompiled is a dependency of some relatively popular crates, particularly tokenizers: https://crates.io/crates/spm_precompiled/reverse_dependencies, which is where this issue was noticed: https://github.com/huggingface/tokenizers/issues/1917
I'm not sure if there's anything we can do on the rust-analyzer side, but I don't see any issues discussing this so I figured I'd at least flag it.
How big a vec literal is too big for rust-analyzer?
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 rust-analyzer indexing with the released spm_precompiled dependency and its large vec literal in src/tests.rs#L69, using the linked tokenizers context. Compare behavior with the fix in spm_precompiled pull request #5. Done means identifying whether rust-analyzer can mitigate the hang or documenting why the dependency must be released first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100