Skip to content
Draft
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1535,12 +1535,16 @@ def construct_arguments(
if rustc_env_attr:
target_has_location_expansion = has_location_expansion(rustc_env_attr.values())

# Path mapping requires sandboxed execution, which these tags disable.
tags = getattr(attr, "tags", [])
requires_unsandboxed_execution = "no-sandbox" in tags or "local" in tags

args = struct(
process_wrapper_flags = process_wrapper_flags,
rustc_path = rustc_path,
rustc_flags = rustc_flags,
extra_rustc_flags = rust_flags_args,
supports_path_mapping = not target_has_location_expansion,
supports_path_mapping = not target_has_location_expansion and not requires_unsandboxed_execution,
all = all_args,
)

Expand Down
7 changes: 7 additions & 0 deletions test/path_mapping/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@rules_rust//rust:defs.bzl", "rust_test")

rust_test(
name = "no_sandbox_test",
srcs = ["no_sandbox_test.rs"],
tags = ["no-sandbox"],
)
4 changes: 4 additions & 0 deletions test/path_mapping/no_sandbox_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[test]
fn runs_without_sandboxing() {
assert_eq!(2 + 2, 4);
}