diff --git a/examples/proto/BUILD b/examples/proto/BUILD index 9ddf0e33f2..d3e31bc57a 100644 --- a/examples/proto/BUILD +++ b/examples/proto/BUILD @@ -1,4 +1,7 @@ load("@rules_proto//proto:defs.bzl", "proto_library") +load("@io_bazel_rules_rust//proto:proto.bzl", "rust_proto_library") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary") package(default_visibility = ["//proto:__subpackages__"]) @@ -6,3 +9,23 @@ proto_library( name = "common", srcs = ["common.proto"], ) + +rust_proto_library( + name = "common_proto_rust", + deps = [":common"], +) + +rust_library( + name = "common_lib", + srcs = ["lib.rs"], + deps = [":common_proto_rust"], +) + +rust_binary( + name = "common_bin", + srcs = ["main.rs"], + deps = [ + ":common_lib", + ":common_proto_rust", + ], +) diff --git a/examples/proto/lib.rs b/examples/proto/lib.rs new file mode 100644 index 0000000000..ace5038f8e --- /dev/null +++ b/examples/proto/lib.rs @@ -0,0 +1,5 @@ +extern crate common_proto_rust; + +pub fn do_something(x: &common_proto_rust::Config) -> bool { + true +} diff --git a/examples/proto/main.rs b/examples/proto/main.rs new file mode 100644 index 0000000000..12ed82fe90 --- /dev/null +++ b/examples/proto/main.rs @@ -0,0 +1,6 @@ +extern crate common_lib; +extern crate common_proto_rust; + +pub fn main() { + common_lib::do_something(&common_proto_rust::Config::new()); +} diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index 60fb1a8edd..edfac8f360 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -331,9 +331,6 @@ _rust_library_attrs = { """), default = "rlib", ), - "_whitelist_function_transition": attr.label( - default = "//tools/whitelists/function_transition_whitelist", - ), } _rust_test_attrs = { @@ -354,7 +351,6 @@ rust_library = rule( _rust_library_attrs.items()), fragments = ["cpp"], host_fragments = ["cpp"], - cfg = proc_macro_host_transition, toolchains = [ "@io_bazel_rules_rust//rust:toolchain", "@bazel_tools//tools/cpp:toolchain_type",