rust-lang / rust-lang/rust-analyzer
Missing "Run Doctest" CodeLens for trait method doctests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.3041
rustc version: rustc 1.98.0 (88d9e12ae 2026-08-18)
editor or extension: VSCode
relevant settings: none
code snippet to reproduce:
///```
///assert!(true); // This does have a doctest
///```
trait Trait {
///```
///assert!(true); // This does not
///```
fn method(&self);
}
The first doc-test has a Run Doctest lens while the second has none.
cargo test --doc correctly finds both doctests and runs them:
running 2 tests
test src/lib.rs - Trait::method (line 5) ... ok
test src/lib.rs - Trait (line 1) ... ok
Example image
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 issue in src/lib.rs and run cargo test --doc to confirm that both doctests are discovered. Then trace rust-analyzer's Run Doctest CodeLens handling for the trait and its method; done means the method receives a lens like the trait while cargo test --doc still reports both tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100