You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.../a $ cargo build
Compiling a v0.0.1 (.../a)
.../a $ cargo test
Compiling c v0.0.1 (.../a)
Compiling a v0.0.1 (.../a)
.../a/src/lib.rs:1:14: 1:29 error: can't find crate for `b`
.../a/src/lib.rs:1 #[cfg(test)] extern crate b;
^~~~~~~~~~~~~~~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `a`.
To learn more, run the command again with --verbose.
Allowing progress by removing the offending line leads to this:
.../a $ cargo test
Compiling c v0.0.1 (.../a)
Compiling a v0.0.1 (.../a)
Compiling b v0.0.1 (.../a)
Could not compile `b`.
--- stderr
error: extern location does not exist: .../a/target/deps/liba-609ef28031a9b714.rlib
.../b/src/lib.rs:1:1: 1:16 error: can't find crate for `a`
.../b/src/lib.rs:1 extern crate a;
^~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
To learn more, run the command again with --verbose.
If that extern crate is removed (leaving only a/src/lib.rs with anything significant, but b/Cargo.toml with the same dependency), the building becomes racy:
.../a $ rm -rf target && cargo test
Compiling c v0.0.1 (.../a)
Compiling a v0.0.1 (.../a)
.../a/src/lib.rs:2:14: 2:29 error: can't find crate for `c`
.../a/src/lib.rs:2 #[cfg(test)] extern crate c;
^~~~~~~~~~~~~~~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `a`.
To learn more, run the command again with --verbose.
.../a $ rm -rf target && cargo test
Compiling c v0.0.1 (.../a)
Compiling a v0.0.1 (.../a)
Compiling b v0.0.1 (.../a)
Running target/a-e8d8fdc9319b934d
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
Doc-tests a
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
In summary, the dependency cycle is causing the b library to be built after the a test runner (the first failure), and not even building the a library at all (the second failure), even though the dependency chain is actually:
Example, I want cargo test to test the macro code example there, but the macro crate depends on the main crate, and so the dev dep in the other direction hits this.
This is a series of commits which culminates in fixing #432, fixing a number of other related issues along the way. The biggest user-facing fix here is that if you run `cargo build` followed by `cargo test` your library will no longer be rebuilt if you have dev-dependencies.
a
b
c
c/src/lib.rs
empty.Allowing progress by removing the offending line leads to this:
If that
extern crate
is removed (leaving onlya/src/lib.rs
with anything significant, butb/Cargo.toml
with the same dependency), the building becomes racy:In summary, the dependency cycle is causing the
b
library to be built after thea
test runner (the first failure), and not even building thea
library at all (the second failure), even though the dependency chain is actually:(which should be fine?)
The text was updated successfully, but these errors were encountered: