Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo test --features dep/feat does not imply --features dep in beta #9265

Closed
tspiteri opened this issue Mar 14, 2021 · 3 comments · Fixed by #9275
Closed

cargo test --features dep/feat does not imply --features dep in beta #9265

tspiteri opened this issue Mar 14, 2021 · 3 comments · Fixed by #9275
Assignees
Labels
A-features Area: features — conditional compilation

Comments

@tspiteri
Copy link

In rustc 1.50.0, cargo --features dep/feat also seems to imply --features dep, but this does not seem to be the case in 1.51.0-beta.6.

For example, for two library crates foo and bar.

foo/Cargo.toml:

[package]
name = "foo"
version = "0.1.0"
edition = "2018"

[features]
foof = []

bar/Cargo.toml:

[package]
name = "bar"
version = "0.1.0"
edition = "2018"

[dependencies.foo]
path = "../foo"
optional = true

This works with stable rustc 1.50.0 (cb75ad5db 2021-02-10):

$ cargo +stable test --features foo/foof -p foo

This gives an error with beta rustc 1.51.0-beta.6 (6a1835ad7 2021-03-12):

$ cargo +beta test --features foo/foof -p foo
error: package ID specification `foo` did not match any packages

I don't know if this used to work unintentionally up to 1.50.0 and the "glitch got fixed" in the beta.

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@JohnTitor
Copy link
Member

This is a cargo issue, @rust-lang/cargo could someone check and transfer it?

@ehuss ehuss transferred this issue from rust-lang/rust Mar 15, 2021
@rustbot

This comment has been minimized.

@ehuss
Copy link
Contributor

ehuss commented Mar 15, 2021

Transferred to rust-lang/cargo.

I think this was unintended, as part of #8997.

@ehuss ehuss added the A-features Area: features — conditional compilation label Mar 15, 2021
@ehuss ehuss self-assigned this Mar 15, 2021
@bors bors closed this as completed in 841179e Mar 16, 2021
ehuss pushed a commit to ehuss/cargo that referenced this issue Mar 16, 2021
Fix --feature pkg/feat for V1 resolver for non-member.

rust-lang#8997 had an unintended regression where `-p foo --feature foo/feat` syntax where `foo` is an **optional non-member** fails with an error that `foo` did not match any packages.  The issue is that the member/feature selection routine needed to slot this into the features for the package in the current working directory (it was incorrectly treating `foo` as a workspace member).

V2 outright does not allow specifying features for non-workspace members.

Fixes rust-lang#9265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features — conditional compilation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants