rust-lang / rust-lang/rust-analyzer

Very large vec literals hang rust-analyzer

Open
#21,748 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
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:

https://github.com/huggingface/spm_precompiled/blob/81b911a362adef3ad3cc6d5835d2980690dbb871/src/tests.rs#L69

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.