rust-lang / rust-lang/rust-analyzer

local .cargo/config build.target ignored in project of workspace

Open
#11,064 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide C-bug E-unknown S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

By this document, .cargo/config.toml supports local configuration. So I put .cargo/config in project directory, not in root of workspace.

I put config.toml like below

[build]
target = "wasm32-unknown-unknown"

Because that project was only for wasm32.

It's fine to run cargo check in that project, but rust-analyzer seems not to check the build.target i put in config.toml, so they ignore #[cfg(target_family = "wasm")].

to be clear, i didn't put any .cargo/config in root of workspace.

rust-analyzer version: 0add6e95e 2021-12-20 stable

rustc version: 1.56.1 (59eed8a2a 2021-11-01)

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 the workspace setup with a project-local .cargo/config.toml containing build.target = "wasm32-unknown-unknown", comparing cargo check with rust-analyzer's diagnostics. Trace how rust-analyzer discovers Cargo configuration for workspace members; done means the project uses the configured target and recognizes the wasm cfg attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.