Skip to content

rust-analyser hangs at "Fetching", and uses CPU at 100% #16614

@lmsonic

Description

@lmsonic

rust-analyzer version: 0.3.1850 (latest at time of writing)

rustc version: rustc 1.78.0-nightly (3246e7951 2024-02-19)

System specs:
Windows 10
Processor 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz
Installed RAM 16,0 GB (15,8 GB usable)
System type 64-bit operating system, x64-based processor

relevant settings:
Project is a bevy project setup as in this link https://bevyengine.org/learn/quick-start/getting-started/setup/ (I am using VSCode)

# Cargo.toml

[dependencies]
bevy = { version = "0.12.0", features = ["dynamic_linking"] }

# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

# .cargo/config.toml
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # Use LLD Linker
rustflags = [
    "-Zshare-generics=n",
    "-Zthreads=0",        # (Nightly) Use improved multithreading with the recommended amount of threads.
]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
[profile.dev]
debug = 1
# Rust analyser settings in vscode
    "rust-analyzer.server.extraEnv": {
        "CARGO_TARGET_DIR": "target/analyzer",
    },
    "rust-analyzer.check.extraArgs": [
        "--target-dir=target/analyzer"
    ],
    "rust-analyzer.cargo.extraEnv": {
        "CARGO_PROFILE_RUST_ANALYZER_INHERITS": "dev",
        "RUSTFLAGS": "-Clinker=rust-lld.exe"
    },
    "rust-analyzer.cargo.extraArgs": [
        "--profile",
        "rust-analyzer"
    ],
    "rust-analyzer.check.overrideCommand": [
        "cargo",
        "clippy",
        "--workspace",
        "--message-format=json",
        "--all-targets",
    ],

Like in the title, rust-analyser hangs at "Fetching" when starting the project, if I click on show logs it doesn't show anything, but it keeps using the CPU with multiple rustc processes at 100%. I tried cleaning up the cache, reinstalling rust, messing with num thread and cache priming settings, but nothing worked.

The only thing that worked to make it usable was to revert to v0.3.1839, and now everything works fine. I will stay on that for now until it gets fixed :)

Metadata

Metadata

Assignees

Labels

Broken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions