Skip to content

Commit

Permalink
Relax overly strict asserts in dependency queue
Browse files Browse the repository at this point in the history
Don't actually need to assert that these are unique, it works both ways and we
can have flavorful dependency graphs which otherwise trigger the assertions.

Closes #3902
  • Loading branch information
alexcrichton committed Apr 26, 2017
1 parent 80e653b commit 2511141
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cargo/util/dependency_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ impl<K: Hash + Eq + Clone, V> DependencyQueue<K, V> {

let mut my_dependencies = HashSet::new();
for dep in dependencies {
assert!(my_dependencies.insert(dep.clone()));
my_dependencies.insert(dep.clone());
let rev = self.reverse_dep_map.entry(dep.clone())
.or_insert_with(HashSet::new);
assert!(rev.insert(key.clone()));
rev.insert(key.clone());
}
&mut slot.insert((my_dependencies, value)).1
}
Expand Down
22 changes: 22 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3005,3 +3005,25 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"));

}

#[test]
fn cyclic_dev() {
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.1.0"
[dev-dependencies]
foo = { path = "." }
"#)
.file("src/lib.rs", r#"
#[test] fn test_lib() {}
"#)
.file("tests/foo.rs", r#"
extern crate foo;
"#);

assert_that(p.cargo_process("test").arg("--all"),
execs().with_status(0));
}

0 comments on commit 2511141

Please sign in to comment.