mirror of https://github.com/bazelbuild/rules_rust
Include all toolchain files in the current toolchain (#2336)
rustc assumes it can read things like librustc_driver, and if you don't include it, it gets sad.
This commit is contained in:
parent
9e146e5dc5
commit
5ceebc08a4
|
@ -81,20 +81,11 @@ toolchain_files = rule(
|
|||
def _current_rust_toolchain_impl(ctx):
|
||||
toolchain = ctx.toolchains[str(Label("@rules_rust//rust:toolchain_type"))]
|
||||
|
||||
files = [
|
||||
toolchain.rustc,
|
||||
toolchain.rust_doc,
|
||||
toolchain.cargo,
|
||||
]
|
||||
|
||||
if toolchain.rustfmt:
|
||||
files.append(toolchain.rustfmt)
|
||||
|
||||
return [
|
||||
toolchain,
|
||||
toolchain.make_variables,
|
||||
DefaultInfo(
|
||||
files = depset(files),
|
||||
files = toolchain.all_files,
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load(":toolchain_test.bzl", "toolchain_test_suite")
|
||||
|
||||
toolchain_test_suite(name = "toolchain_test_suite")
|
||||
|
||||
genrule(
|
||||
name = "inspect",
|
||||
outs = ["rustc-cfg"],
|
||||
# rustc assumes it can read things like librustc_driver in order to run this command.
|
||||
# This is a test to ensure we supply all of the files rustc needs as part of the current_rust_toolchain.
|
||||
cmd = "$(RUSTC) --print=cfg > $@",
|
||||
toolchains = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
|
||||
tools = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
|
||||
)
|
||||
|
||||
build_test(
|
||||
name = "inspect_build_test",
|
||||
targets = [":inspect"],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue