Description
So I'm working on tarpaulin, and I'm trying to solve an issue where linker flags of dependencies can conflict with the linker flags I need to set for code coverage, namely -C link-dead-code
(conflict issue rust-lang/rust#64685). It should also keep the target directory smaller by not having dead code for all the dependencies included and prevent rebuilds when working with tarpaulin making things faster. So that's the motivation.
Now my idea to solve this is using cargo rustc
to just pass the flags to the crate only. However if the user is using workspaces and has multiple packages in their project all the packages need link-dead-code
applied not just the one under test. But I get the feeling from the docs that this isn't how cargo rustc
works?
Providing cargo rustc
works as I've grokked it, I was thinking that making the flags compatible with cargo build/test/etc and allowing it to operate on a whole workspace would be a solution.
Also, I'll need this to work with cargo test --bins/--examples/--doc/--lib/--benches/--tests
with the compiled artefacts and anything in the project workspace linked with dead code. But that's just a side note in case I'm wrong and there's a better solution for doing this either with cargo rustc
or a different cargo command