rust-lang / rust-lang/rust-analyzer

Certain types not found with a custom rust-project.json (e.g. AtomicU32)

Open
#20,463 6 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

So, I'm developing on a project using meson to compile rust source files and so it does generate a rust-project.json file that works quite nicely. However certain types aren't detected in the code autocompletion, like AtomicU32, however AtomicBool and AtomicPtr are.

I was wondering if something special needs to be done to the rust-project.json to make those appear as well, maybe certain implicit cfgs aren't detected? It's not quite clear from the documentation if anything needs to be done there to make this work.

rust-analyzer.linkedProjects points to the generated rust-project.json file.

{
    "sysroot": "/home/kherbst/.rustup/toolchains/1.82-x86_64-unknown-linux-gnu",
    "sysroot_src": "/home/kherbst/.rustup/toolchains/1.82-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/",
    "crates": [
        ...
    ]
}

rust-analyzer version: rust-analyzer version: 1.89.0 (2948388 2025-08-04) [/home/kherbst/.cargo/bin/rust-analyzer]

rustc version: rustc 1.82.0 (f6e511eec 2024-10-15), but same issue with stable

editor or extension: VSCode

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 with the generated rust-project.json and the rust-analyzer.linkedProjects configuration, comparing the available cfg information for AtomicU32 with AtomicBool and AtomicPtr. Trace how rust-analyzer reads the linked project and sysroot; done when AtomicU32 is available in code completion for this setup.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.