Skip to content

Commit 3e58a1d

Browse files
authored
Disable path mapping when rustc_env has location expansions (bazelbuild#4117)
Location expansion happens outside the control of path mapping logic and would produce paths with build configuration in them, breaking path mapping's logic of replacing all build configuration with the literal "cfg".
1 parent 155a8af commit 3e58a1d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

rust/private/rustc.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,12 +1446,17 @@ def construct_arguments(
14461446
all_args = [process_wrapper_flags, rustc_path, rustc_flags]
14471447
if rust_flags_args != None:
14481448
all_args.append(rust_flags_args)
1449+
has_location_expansion = _has_location_expansion(authored_rustc_flags)
1450+
rustc_env_attr = getattr(crate_info, "rustc_env", None)
1451+
if not has_location_expansion and rustc_env_attr:
1452+
has_location_expansion = _has_location_expansion(rustc_env_attr.values())
1453+
14491454
args = struct(
14501455
process_wrapper_flags = process_wrapper_flags,
14511456
rustc_path = rustc_path,
14521457
rustc_flags = rustc_flags,
14531458
extra_rustc_flags = rust_flags_args,
1454-
supports_path_mapping = not _has_location_expansion(authored_rustc_flags),
1459+
supports_path_mapping = not has_location_expansion,
14551460
all = all_args,
14561461
)
14571462

0 commit comments

Comments
 (0)