Minimal repro: https://github.com/illicitonion/repro-rustworkspacerpath
I have a dynamic library which I produce. I am trying to split it into a few crates internally, to logically decompose it, and speed up compilation. I would like to end up producing a dylib with no runtime dependencies on the system (as I do when just building one crate).
If I decompose into sub-crates and don't add a [workspace] section to my Cargo.toml, my top-level dylib is produced as I expect. It has no dynamic dependency on libstd listed when I run otool -L on my Mac. However, cargo test --all doesn't pick up the sub-crate tests.
If I add a [workspace] section to my Cargo.toml, cargo test --all picks up the sub-crate tests, but my top-level dylib now has a dynamic dependency on libstd.
As far as I can tell, there doesn't appear to be a way to both have --all work, and not pick up a runtime dependency on a dylib which I'd like to avoid.
Which of the following is the bug, I'm not sure:
cargo test --all doesn't pick up non-workspace sub-crates
cargo build produces different linkage configuration depending on whether you're in a workspace
but it seems wrong that there's no way to get the best of both behaviours.
Minimal repro: https://github.com/illicitonion/repro-rustworkspacerpath
I have a dynamic library which I produce. I am trying to split it into a few crates internally, to logically decompose it, and speed up compilation. I would like to end up producing a dylib with no runtime dependencies on the system (as I do when just building one crate).
If I decompose into sub-crates and don't add a [workspace] section to my Cargo.toml, my top-level dylib is produced as I expect. It has no dynamic dependency on libstd listed when I run
otool -Lon my Mac. However,cargo test --alldoesn't pick up the sub-crate tests.If I add a [workspace] section to my Cargo.toml,
cargo test --allpicks up the sub-crate tests, but my top-level dylib now has a dynamic dependency on libstd.As far as I can tell, there doesn't appear to be a way to both have
--allwork, and not pick up a runtime dependency on a dylib which I'd like to avoid.Which of the following is the bug, I'm not sure:
cargo test --alldoesn't pick up non-workspace sub-cratescargo buildproduces different linkage configuration depending on whether you're in a workspacebut it seems wrong that there's no way to get the best of both behaviours.