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
The dependency "graph" looks like lib-crate cfg(test) => util-crate => lib-crate (lib).
If you run nix-build examples/4-circular-dependency:
building
Compiling lib-crate v0.1.0 (/build/lib-crate)
error[E0308]: mismatched types
--> src/lib.rs:6:33
|
6 | assert_eq!(util_crate::show(&LibFoo), "Libfoo");
| ^^^^^^^ expected struct `lib_crate::LibFoo`, found struct `LibFoo`
|
= note: expected reference `&lib_crate::LibFoo`
found reference `&LibFoo`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: could not compile `lib-crate`.
cargo2nix strips out all the dependency info from Cargo.toml when it builds crates, since the tool itself is the one managing dependency resolution. However, when building a crate like this, we can't prevent Cargo from discovering that lib-crate's source code is available alongside the tests, meaning that, even though the version we intend to use is already being picked up by the rustc wrapper, Cargo then recompiles the lib before building the tests.
The error above reads strangely but just means that it can't unify lib_crate-$metadata_for_lib::LibFoo with lib_crate-$metadata_for_test::LibFoo.
The text was updated successfully, but these errors were encountered:
Sorry, my suggested repro here is actually meaningless, because it has the same error with regular cargo builds. I'm going to close this for now and reopen once I can get a proper repro.
You can check the example here: https://github.com/pikajude/cargo2nix/tree/circular-dep-demonstration/examples/4-circular-dependency
The dependency "graph" looks like
lib-crate cfg(test) => util-crate => lib-crate (lib)
.If you run
nix-build examples/4-circular-dependency
:cargo2nix strips out all the dependency info from Cargo.toml when it builds crates, since the tool itself is the one managing dependency resolution. However, when building a crate like this, we can't prevent Cargo from discovering that
lib-crate
's source code is available alongside the tests, meaning that, even though the version we intend to use is already being picked up by the rustc wrapper, Cargo then recompiles the lib before building the tests.The error above reads strangely but just means that it can't unify
lib_crate-$metadata_for_lib::LibFoo
withlib_crate-$metadata_for_test::LibFoo
.The text was updated successfully, but these errors were encountered: