blob: 23ace215609cff1969c907227cfe6aa3fca3a145 [file] [log] [blame]
load("@rules_fuchsia//fuchsia:defs.bzl", "if_fuchsia")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_doc")
rust_binary(
name = "hello_rust",
srcs = ["src/main.rs"],
edition = "2021",
# Unfortunately, there doesn't seem to be a way of configuring these in
# rust_toolchain.
#
# The Rust rules always use the C++ linker (clang++) which knows how to find
# libc and libzircon, so we only have to specify the remaining libstd dep
# here.
#
# We could use the newly-merged experimental_use_cc_common_link and then
# supply stdlib_linkflags (which only works with cc link actions), but
# that's a bit of a hack. It wouldn't solve panic=abort, which is needed by
# our toolchain dist but not the upstream one.
#
# So what we probably need is our own macro to wrap this, or to modify
# rules_rust somehow.
deps = if_fuchsia(["@fuchsia_sdk//pkg/fdio"]),
rustc_flags = [
"-Cpanic=abort",
],
)
rust_doc(
name = "hello_rust_doc",
crate = ":hello_rust",
)