Skip to content

Native diagnostics do not respect workspace check setting #19606

Open
@my4ng

Description

@my4ng

rust-analyzer version: rust-analyzer version: 0.3.2379-standalone (8365cf8 2025-04-13)
rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: VSCode 0.3.2379

relevant settings: .vscode/settings.json:

{
    "rust-analyzer.cargo.features": ["foo"],
    "rust-analyzer.check.workspace": false,
    "rust-analyzer.cargo.extraArgs": ["-p", "foobar"],
}

repository link (if public, optional): https://github.com/my4ng/foobar

In this minimal example, the workspace contains foobar and bart packages, where bart depends on foobar with feature bar. The rust-analyzer setting aims to only check foobar with feature foo (disabled workspace). However, the native diagnostics give the error:

bar is here! rust-analyzer(macro-error)
[{
	"resource": "/home/my4ng/Programming/foobar/src/main.rs",
	"owner": "rust-analyzer",
	"code": {
		"value": "macro-error",
		"target": {
			"$mid": 1,
			"path": "/manual.html",
			"scheme": "https",
			"authority": "rust-analyzer.github.io",
			"fragment": "macro-error"
		}
	},
	"severity": 8,
	"message": "bar is here!",
	"source": "rust-analyzer",
	"startLineNumber": 6,
	"startColumn": 1,
	"endLineNumber": 6,
	"endColumn": 14
}]

Indeed "rust-analyzer.diagnostics.enable": false will disable the diagnostics error. It is also distinct from a rustc error if, for example, the workspace setting is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions