Skip to content
Open
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: 6 additions & 0 deletions rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ toolchain_type(
name = "toolchain_type",
)

# Miri needs a separate toolchain contract because it brings a different
# driver binary, sysroot, and runtime closure than normal rustc compilation.
toolchain_type(
name = "miri_toolchain_type",
)

alias(
name = "toolchain",
actual = "toolchain_type",
Expand Down
13 changes: 13 additions & 0 deletions rust/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ load(
"//rust/private:lints.bzl",
_rust_lint_config = "rust_lint_config",
)
load(
"//rust/private:miri.bzl",
_miri_binary = "miri_binary",
_miri_test = "miri_test",
)
load(
"//rust/private:rust.bzl",
_rust_binary = "rust_binary",
Expand Down Expand Up @@ -102,6 +107,14 @@ rust_test = _rust_test
rust_test_suite = _rust_test_suite
# See @rules_rust//rust/private:rust.bzl for a complete description.

# Miri rules wrap already-declared Rust targets so they can reuse the existing
# crate graph instead of re-encoding the full rust_* rule surface.
miri_test = _miri_test
# See @rules_rust//rust/private:miri.bzl for a complete description.

miri_binary = _miri_binary
# See @rules_rust//rust/private:miri.bzl for a complete description.

rust_doc = _rust_doc
# See @rules_rust//rust/private:rustdoc.bzl for a complete description.

Expand Down
10 changes: 10 additions & 0 deletions rust/private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//rust/private:rust_analyzer.bzl", "rust_analyzer_detect_sysroot")

# Exported for docs
Expand Down Expand Up @@ -31,6 +32,15 @@ bzl_library(
],
)

# This build setting is flipped by the Miri transition so the normal Rust
# compilation pipeline can rebuild target-side crates against the Miri sysroot
# without affecting unrelated Rust builds.
bool_flag(
name = "miri_enabled",
build_setting_default = False,
visibility = ["//visibility:public"],
)

rust_analyzer_detect_sysroot(
name = "rust_analyzer_detect_sysroot",
visibility = ["//visibility:public"],
Expand Down
Loading