rust-lang / rust-lang/rust-analyzer

Run doctest fails if the path include generic types

Open
#19,319 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

This is related to https://github.com/emacs-rustic/rustic/issues/92

rust-analyzer version: 1.85.0

rustc version: 1.85.0

editor or extension: Emacs rustic (lsp-mode)

relevant settings: Nothing relevant

repository link (if public, optional): priority-queue
code snippet to reproduce: See the doctest at priority_queue::PriorityQueue::push

The command provided by Rust analyzer for the Run Doctest button does not work properly if the type where the doctest is includes generic types.

This is probably due to the command not properly escaping the <, > characters.

The output is:

cargo test --doc --package priority-queue -- priority_queue::PriorityQueue<I,P,H>::push --show-output
/bin/bash: line 1: I,P,H: No such file or directory

Compilation exited abnormally with code 1 at Mon Mar  3 23:16:28, duration 0.04 s

After opening the issue in the rustic repository, I was suggested that the fix should be provided in either rust-analyzer or lsp-mode

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

Start by reproducing the Run Doctest command for the doctest at priority_queue::PriorityQueue::push and inspect how rust-analyzer constructs the command shown in the issue. Compare the generated command with the shell error; done means doctests whose paths contain generic types run successfully without treating the angle brackets as shell syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.