rust-lang / rust-lang/cargo

unstable features breaks unrelated sub-project

Open
#6,015 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-workspaces C-bug S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

So for my project cargo-tarpaulin I've had to switch to the nightly publish-lockfile to get past an issue some users have had. As tarpaulin is meant to run on other peoples crates in my tests folder I have a folder called data with some sub-projects to run tarpaulin on to make sure it works.

However, now when I go into subproject and run cargo test on stable it gives me an error because of the present of publish-lockfile in the project root. But as these test projects aren't used to by tarpaulin and don't pull in tarpaulin as a library and my current working directory is their root I don't think they should take into account any parent folders.

Here is a link to the project https://github.com/xd009642/tarpaulin/tree/master/tests/data/simple_project

The error:

[xd009642@localhost simple_project]$ cargo test
error: failed to parse manifest at `/home/xd009642/code/rust/tarpaulin/Cargo.toml`

Caused by:
  the cargo feature `publish-lockfile` requires a nightly version of Cargo, but this is the `stable` channel

And the Cargo.toml in the directory cargo test was ran in:

[package]
name = "simple_project"
version = "0.1.0"
authors = ["Daniel McKenna <danielmckenna93@gmail.com>"]

[dependencies]

Moving the folder simple project to a folder above tarpaulins root fixes this but obviously I'd prefer a workaround or some fix for this as it also affects tarpaulin (I use cargo as a library to build the project tests and handle features/packages).

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 cargo test from tests/data/simple_project with the parent Cargo.toml containing publish-lockfile, then inspect how Cargo discovers parent manifests. Compare the behavior with the standalone Cargo.toml shown in the issue; done means the stable command no longer parses the unrelated parent manifest while Cargo still handles the repository's own tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.