rust-lang / rust-lang/rust-analyzer

Feature Request: Detect `no_std` per-crate and ignore `check.allTargets`

Open
#14,205 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-cargo A-flycheck A-no_std C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

If possible, the option for RA to detect that a crate* is no_std and disable check.allTargets, to seamlessly prevent issues like #2142 once and for all, where you can either have RA checking tests where it makes sense, or you can stop bogus errors in no_std crates, but not both.

*specifically, in my case, I have a VSCode workspace with various cargo crates/workspaces, some no_std, some not, with per-folder .cargo/config.toml setting targets.

Alternatively, another option would be do detect no_std and use a new option, checkOnSave.extraNoStdArgs, for something like as a (manual) solution. Or both?

{
    "rust-analyzer.checkOnSave.allTargets": false,
	"rust-analyzer.checkOnSave.extraArgs": [
        "--all-targets"
    ]
    "rust-analyzer.checkOnSave.extraNoStdArgs": [
        "--bins"
    ]
}

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

No files, tests, or entry points are named in the issue. Start by reviewing rust-analyzer's check-on-save settings and the proposed per-crate no_std detection, then clarify whether automatic check.allTargets handling, extraNoStdArgs, or both are required. Done means behavior is defined for mixed workspaces with per-folder .cargo/config.toml target settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.