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

Panic when adding cyclic dev-dependency #3902

Closed
dbrgn opened this issue Apr 6, 2017 · 2 comments · Fixed by #3921
Closed

Panic when adding cyclic dev-dependency #3902

dbrgn opened this issue Apr 6, 2017 · 2 comments · Fixed by #3921

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Apr 6, 2017

When adding a library as its own dependency, Cargo detects it:

$ cargo test
error: cyclic package dependency: package `foo v0.1.0 (file:///tmp/foo)` depends on itself

But when creating an integration test and adding the current library as dev-dependency, it panics on cargo test. Steps to reproduce:

$ cargo new foo
$ cd foo
$ rustup override add nightly
$ echo -e '[dev-dependencies]\nfoo = { path = "." }' >> Cargo.toml
$ mkdir tests
$ echo "extern crate foo;" > tests/integration.rs
$ cargo test
thread 'main' panicked at 'assertion failed: my_dependencies.insert(dep.clone())', /checkout/cargo/src/cargo/util/dependency_queue.rs:86
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Backtrace:

   0: cargo::ops::cargo_rustc::compile
             at /checkout/cargo/src/cargo/util/dependency_queue.rs:86
             at /checkout/cargo/src/cargo/ops/cargo_rustc/job_queue.rs:103
             at /checkout/cargo/src/cargo/ops/cargo_rustc/mod.rs:237
   1: cargo::ops::cargo_rustc::compile_targets
             at /checkout/cargo/src/cargo/ops/cargo_rustc/mod.rs:135
   2: cargo::ops::cargo_compile::compile_ws
             at /checkout/cargo/src/cargo/ops/cargo_compile.rs:269
   3: cargo::ops::cargo_compile::compile_with_exec
             at /checkout/cargo/src/cargo/ops/cargo_compile.rs:153
   4: cargo::ops::cargo_test::compile_tests
             at /checkout/cargo/src/cargo/ops/cargo_compile.rs:141
             at /checkout/cargo/src/cargo/ops/cargo_test.rs:71
   5: cargo::ops::cargo_test::run_tests
             at /checkout/cargo/src/cargo/ops/cargo_test.rs:17
   6: cargo::try_execute_builtin_command
             at /checkout/cargo/src/bin/test.rs:147
             at /checkout/cargo/src/cargo/lib.rs:120
             at /checkout/cargo/src/bin/cargo.rs:259
   7: cargo::execute
             at /checkout/cargo/src/bin/cargo.rs:223
   8: cargo::call_main_without_stdin
             at /checkout/cargo/src/cargo/lib.rs:120
   9: cargo::main
             at /checkout/cargo/src/bin/cargo.rs:91
             at /checkout/cargo/src/bin/cargo.rs:84

(Fun fact: When running this with RUST_BACKTRACE=1, the backtrace takes reeeeally long to generate.)

@dbrgn
Copy link
Contributor Author

dbrgn commented Apr 6, 2017

As a sidenote, I tried adding the library as its own dev-dependency to see whether that could be a way to pass feature flags to integration tests. I wasn't trying to break Cargo :)

@alexcrichton
Copy link
Member

Wow I don't think I've ever seen an assertion get tripped in that module!

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Apr 26, 2017
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 rust-lang#3902
bors added a commit that referenced this issue Apr 26, 2017
Relax overly strict asserts in dependency queue

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants