Skip to content

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

@DianaNites

Description

@DianaNites
Contributor

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"
    ]
}

Activity

Veykril

Veykril commented on May 26, 2023

@Veykril
Member

Doing this for flycheck (that is cargo check) is kind of tricky right now, as we built the command before we even analyze crates. We'd have to feed back this info after having analyzed all crates which we only do lazily ... So we probably want to change flycheck do built the command on demand.

added
A-flycheckissues with flycheck a.k.a. "check on save"
on May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargocargo related issuesA-flycheckissues with flycheck a.k.a. "check on save"A-no_stdissues related to no_std handlingC-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Veykril@DianaNites

        Issue actions

          Feature Request: Detect `no_std` per-crate and ignore `check.allTargets` · Issue #14205 · rust-lang/rust-analyzer