rust-lang / rust-lang/rust-analyzer

It should be possible to test and debug `#[cfg_attr(X, ignore)]` marked runnables in isolation

Open
#15,352 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Follow-up to https://github.com/rust-lang/rust-analyzer/issues/15341.

The fix for the linked issue #15341 was to flag unit tests with

#[cfg_attr(miri, ignore)]

To ignore them when miri is enabled instead of a top-level #[cfg(not(miri))].
This allowed rust-analyzer to properly identify all unit tests again.

However, it is still no longer possible to click and test or debug single unit tests flagged this way. Clicking on the in-code links no longer works as intended. For example trying to run the flagged test is as if cargo test is run with all tests filtered out.

Temporarily unflagging the respective unit test fixes the issue. However, this obviously is not an acceptable long-term solution.

I mean those IDE links/buttons:
image

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 reviewing the linked issue #15341 and reproducing the problem with a unit test marked #[cfg_attr(miri, ignore)]. Check the in-code run and debug links for that test; done means either action targets the individual test successfully instead of filtering out all tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.