rust-lang / rust-lang/rust-analyzer

Wrong `--package` passed when running tests in workspace subproject

Open
#18,752 0 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

Requested information

rust-analyzer version: rust-analyzer version: 0.3.2228-standalone (fa4a40bbe8 2024-12-22)

rustc version: rustc 1.81.0 (eeb90cda1 2024-09-04)

editor or extension: VSCode

relevant settings: N/A (default, didn't change anything)

repository link (if public, optional): https://github.com/icicle-emu/icicle-python/pull/11 (make sure to check out 21531db2e0f87a729ccae5738afc4bbff1be029a)

Bug description

Because of complex reasons it is impossible to execute cargo test in a project that links to pyo3 (specifically with the extension-module feature). As a workaround I put a [workspace] in my Cargo.toml and have a separate tests package to test my rust code. To run the tests I do cargo test --package tests, which works fine (for now I have only an example test, because I ran into this issue).

Unfortunately when clicking the 'Run test' button on the tests/tests.rs file (which is part of the tests package member of the workspace) in VSCode, rust-analyzer passes --package icicle-python (the root package).

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

Reproduce the issue using the icicle-python repository at commit 21531db2e0f87a729ccae5738afc4bbff1be029a, with the workspace's tests/tests.rs and its Cargo.toml setup. Start by comparing cargo test --package tests with the command issued by VSCode's Run test action; done means the action selects the tests workspace package instead of icicle-python.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
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.