Do not attempt to instrument rust code for coverage if rust_toolchain.llvm-cov is None #1432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No functional changes intended.
This PR updates rules_rust so that if no
llvm-cov
is passed to the rust_toolchain, rust code is not attempted to be instrumented for coverage. The PR 7465c1a added rust test coverage support. Before that, rust test code was not being instrumented for coverage.We've got a case where the underlying rust toolchain doesn't support coverage instrumentation, in particular the toolchain is compiled without support for the profiler runtime, which is required by
-C instrument-coverage
(https://doc.rust-lang.org/rustc/instrument-coverage.html#how-it-works). Before this PR, the-C instrument-coverage
rust arg was added unconditionally to the rustc invocation, which fails if therustc
didn't support it. The ability to disable rust coverage instrumentation is useful in such cases, where there is also code in other languages which is instrumented.