From b368f3e7c87fdc870683eb9cae68145601b718f0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 15 Feb 2022 09:35:42 -0800 Subject: [PATCH 1/2] Fix tests due to dylib/cdylib error. Cargo no longer allows to set both cdylib and dylib at the same time (since it didn't work): https://github.com/rust-lang/cargo/pull/10243 --- tests/all/Cargo.toml | 2 +- tests/test_samples.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/all/Cargo.toml b/tests/all/Cargo.toml index 435dfaf4..b5e833b8 100644 --- a/tests/all/Cargo.toml +++ b/tests/all/Cargo.toml @@ -44,7 +44,7 @@ feat1 = [] feat2 = [] [lib] -crate-type = ["rlib", "cdylib", "dylib", "staticlib"] +crate-type = ["rlib", "cdylib", "staticlib"] [[bin]] name = "otherbin" diff --git a/tests/test_samples.rs b/tests/test_samples.rs index c5d9c3ce..9ed501cb 100644 --- a/tests/test_samples.rs +++ b/tests/test_samples.rs @@ -291,13 +291,10 @@ fn all_the_fields() { assert_eq!(all.targets.len(), 8); let lib = get_file_name!("lib.rs"); assert_eq!(lib.name, "all"); - assert_eq!( - sorted!(lib.kind), - vec!["cdylib", "dylib", "rlib", "staticlib"] - ); + assert_eq!(sorted!(lib.kind), vec!["cdylib", "rlib", "staticlib"]); assert_eq!( sorted!(lib.crate_types), - vec!["cdylib", "dylib", "rlib", "staticlib"] + vec!["cdylib", "rlib", "staticlib"] ); assert_eq!(lib.required_features.len(), 0); assert_eq!(lib.edition, "2018"); From 4c85f5a53eddf6a3e55e46f755e44522b9ecf7d8 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 15 Feb 2022 09:37:07 -0800 Subject: [PATCH 2/2] Fix features table check as of 1.60. As part of namespaced features, optional dependencies now appear as a feature in the features table: https://github.com/rust-lang/cargo/pull/10269 --- tests/test_samples.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_samples.rs b/tests/test_samples.rs index 9ed501cb..f899e6de 100644 --- a/tests/test_samples.rs +++ b/tests/test_samples.rs @@ -158,7 +158,7 @@ struct TestObject { #[test] fn all_the_fields() { - // All the fields currently generated as of 1.58. This tries to exercise as + // All the fields currently generated as of 1.60. This tries to exercise as // much as possible. let ver = cargo_version(); let minimum = semver::Version::parse("1.56.0").unwrap(); @@ -329,7 +329,13 @@ fn all_the_fields() { let build = get_file_name!("build.rs"); assert_eq!(build.kind, vec!["custom-build"]); - assert_eq!(all.features.len(), 3); + if ver >= semver::Version::parse("1.60.0").unwrap() { + // 1.60 now reports optional dependencies within the features table + assert_eq!(all.features.len(), 4); + assert_eq!(all.features["bitflags"], vec!["dep:bitflags"]); + } else { + assert_eq!(all.features.len(), 3); + } assert_eq!(all.features["feat1"].len(), 0); assert_eq!(all.features["feat2"].len(), 0); assert_eq!(sorted!(all.features["default"]), vec!["bitflags", "feat1"]);