The github repo contains the code, I will also brief list it here, there are two crates, one is test-utils, another is client,
This is the client code with a dev-dependency on test-utils:
#[derive(Eq, PartialEq, Debug)]
pub struct Name {
pub first_name: String,
pub last_name: String,
}
pub fn full_name(first: String, last: String) -> Name {
Name {
first_name: first,
last_name: last,
}
}
mod test {
use super::*;
#[test]
fn full_name_works() {
assert_eq!(
full_name(String::from("hello"), String::from("world")),
test_utils::helper()
)
}
}
This is test-utils code with a dependency on client:
use client::Name;
pub fn helper() -> Name {
Name {
first_name: String::from("hello"),
last_name: String::from("world"),
}
}
(I do not understand the compiler internals; this is just me guessing.)
Intuitively, it seems that to resolve this cyclical dependency, we need something like:
normal/crate-client depends on
normal/test-utils depends on [normal/crate-client]
dev/crate-client depends on [normal/test-utils]
Now, persumerably, dev/crate-client and normal/crate-client can be compiled with different configs, so ti seems unlikely that the compiler can magically unify dev/crate-client::Name with normal/crate-client::Name