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

fix: Ensure dep/feature activates the dependency on 2024 #14221

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: Show bad error for dep_name/feature_name on 2024
  • Loading branch information
epage committed Jul 9, 2024
commit 85cc9940af8dba0200075f8bd011d464f1ebd0da
57 changes: 57 additions & 0 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,63 @@ fn features_option_given_twice() {
p.cargo("check --features a --features b").run();
}

#[cargo_test(nightly, reason = "edition2024 is not stable")]
fn strong_dep_feature_edition2024() {
let p = project()
.file(
"Cargo.toml",
r#"
cargo-features = ["edition2024"]
[package]
name = "foo"
version = "0.1.0"
edition = "2024"

[features]
optional_dep = ["optional_dep/foo"]

[dependencies]
optional_dep = { path = "optional_dep", optional = true }
"#,
)
.file(
"src/main.rs",
r#"
fn main() {}
"#,
)
.file(
"optional_dep/Cargo.toml",
r#"
[package]
name = "optional_dep"
[features]
foo = []
"#,
)
.file(
"optional_dep/src/lib.rs",
r#"
"#,
)
.build();

p.cargo("metadata")
.masquerade_as_nightly_cargo(&["edition2024"])
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] feature `optional_dep` includes `optional_dep/foo`, but `optional_dep` is not a dependency
--> Cargo.toml:9:32
|
9 | optional_dep = ["optional_dep/foo"]
| ^^^^^^^^^^^^^^^^^^^^
|
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`

"#]])
.run();
}

#[cargo_test]
fn multi_multi_features() {
let p = project()
Expand Down