rust-lang / rust-lang/rust-analyzer
features in dev-dependencies are used for normal dependencies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I made a minimal example: https://github.com/elwerene/rust_analyzer_dev_dependency_features
rust-analyzer version: rust-analyzer version: 0.3.1839-standalone
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)
cargo clippy --workspace output:
Checking traits v0.0.0 (/home/rene/Downloads/rust_analyzer_dev_dependency_features/traits)
Checking foo v0.0.0 (/home/rene/Downloads/rust_analyzer_dev_dependency_features/foo)
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
cargo check --workspace output:
cargo check --workspace
Checking traits v0.0.0 (/home/rene/Downloads/rust_analyzer_dev_dependency_features/traits)
Checking foo v0.0.0 (/home/rene/Downloads/rust_analyzer_dev_dependency_features/foo)
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
rust-analyzer error:
[{
"resource": "/home/rene/rust_analyzer_dev_dependency_features/foo/src/lib.rs",
"owner": "rustc",
"code": {
"value": "Click for full compiler diagnostic",
"target": {
"$mid": 1,
"path": "/diagnostic message [0]",
"scheme": "rust-analyzer-diagnostics-view",
"query": "0",
"fragment": "file:///home/rene/rust_analyzer_dev_dependency_features/foo/src/lib.rs"
}
},
"severity": 8,
"message": "not all trait items implemented, missing: `only_for_test_cases`\nmissing `only_for_test_cases` in implementation",
"source": "rustc",
"startLineNumber": 3,
"startColumn": 1,
"endLineNumber": 3,
"endColumn": 25,
"relatedInformation": [
{
"startLineNumber": 8,
"startColumn": 1,
"endLineNumber": 8,
"endColumn": 1,
"message": "implement the missing item: `fn only_for_test_cases() { todo!() }`: `fn only_for_test_cases() { todo!() }\n`",
"resource": "/home/rene/rust_analyzer_dev_dependency_features/foo/src/lib.rs"
}
]
}]
If I set the Cargo workspace to resolver version 1 I get the same error as rust analyzer in clippy/check.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using the linked minimal example and inspect foo/src/lib.rs alongside the workspace Cargo configuration. Compare cargo check --workspace and cargo clippy --workspace with rust-analyzer diagnostics, including the resolver version change; done means dev-dependency features are not applied to normal dependencies incorrectly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100