Circular dependencies between crates and "cargo test"


Currently I am investigating a possibility of parallelizing large crate compilation.
It takes about 80sec for a build (and 100+ sec for incremental build).
I am quite successful in splitting it into 5 sub-crates which are now built in parallel giving nice total speed-up. A gathering/parent crate collects all those sub-crates into one reference point for other crates to use.

However I was forced to do rather unusual/hacky things like making sub-crates non-autonomous by using “extern” forward references to other sub-crate functions and having extra “dummy” sub-crate force sub-crate linker order in parent crate.

So far so good.
“cargo build” for parent crate works fine.
Other crate referencing parent crates are also built and work ok.

Unfortunately, doing “cargo test -v” for parent crate fails due to “rustc --crate-name parent_crate src/ --emit=dep-info,link …” command issued by cargo. Unit tests binary is built fine though and can be run manually.

As far as I understand the reason for cargo to try and link sub-crates is to get some compiler generated information, but which one? Is there some way for disable this “link” stage in cargo?