Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,15 @@ def construct_arguments(
# https://doc.rust-lang.org/rustc/instrument-coverage.html
rustc_flags.add("--codegen=instrument-coverage")

# Crates with generated sources are compiled from the output tree (see
# `transform_sources`), so the coverage mapping records their files
# with a bazel-out/... prefix. Bazel's lcov merger silently drops all
# coverage for such crates, so we remap the prefix away. Skipped when
# `remap_path_prefix` is None (rustdoc), since rustdoc only supports
# `--remap-path-prefix` behind `-Zunstable-options`.
if remap_path_prefix != None:
rustc_flags.add("--remap-path-prefix={}/=".format(ctx.bin_dir.path))

if toolchain._experimental_link_std_dylib:
rustc_flags.add("--codegen=prefer-dynamic")

Expand Down
Loading