fn to_pkgid(&self) -> PackageId;
}
-impl ToPkgId for &'static str {
+impl<'a> ToPkgId for &'a str {
fn to_pkgid(&self) -> PackageId {
PackageId::new(*self, "1.0.0", ®istry_loc()).unwrap()
}
}
-impl ToPkgId for (&'static str, &'static str) {
+impl<'a> ToPkgId for (&'a str, &'a str) {
fn to_pkgid(&self) -> PackageId {
let (name, vers) = *self;
PackageId::new(name, vers, ®istry_loc()).unwrap()
}
}
-impl ToPkgId for (&'static str, String) {
+impl<'a> ToPkgId for (&'a str, String) {
fn to_pkgid(&self) -> PackageId {
let (name, ref vers) = *self;
PackageId::new(name, vers, ®istry_loc()).unwrap()
("baz", "1.0.0")])));
}
+#[test]
+fn resolving_backtrack_features() {
+ // test for cargo/issues/4347
+ let mut bad = dep("bar");
+ bad.set_features(vec!["bad".to_string()]);
+
+ let reg = registry(vec![
+ pkg!(("foo", "1.0.2") => [bad]),
+ pkg!(("foo", "1.0.1") => [dep("bar")]),
+ pkg!("bar"),
+ ]);
+
+ let res = resolve(&pkg_id("root"), vec![
+ dep_req("foo", "^1"),
+ ], ®).unwrap();
+
+ assert_that(&res, contains(names(&[("root", "1.0.0"),
+ ("foo", "1.0.1"),
+ ("bar", "1.0.0")])));
+}
+
#[test]
fn resolving_allows_multiple_compatible_versions() {
let reg = registry(vec![