Remove transition from binary/test/bench rules, add to grpc/proto (#309)

This mostly reverts commit a1d8936, removing the
proc_macro_host_transition from most rules.  This fixes #305, by no
longer having a transition on rust_binary.  It still solves #300 by
adding this transition to rust_proto_library and rust_grpc_library.
Those rules are meant to mirror rust_library, so they should share the
same cfg values.  Sharing the same configuration means that
rust_proto_library or rust_grpc_library can be dependencies to
rust_library or rust_binary and not cause another configuration of the
library to be generated.

The example introduced by #301 is moved in this commit into a subfolder
to provide a more clear directory structure.
diff --git a/examples/proto/BUILD b/examples/proto/BUILD
index d3e31bc..9ddf0e3 100644
--- a/examples/proto/BUILD
+++ b/examples/proto/BUILD
@@ -1,7 +1,4 @@
 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__"])
 
@@ -9,23 +6,3 @@
     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/basic/BUILD b/examples/proto/basic/BUILD
new file mode 100644
index 0000000..cf2b3ef
--- /dev/null
+++ b/examples/proto/basic/BUILD
@@ -0,0 +1,25 @@
+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__"])
+
+rust_proto_library(
+    name = "common_proto_rust",
+    deps = ["//proto: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/basic/lib.rs
similarity index 100%
rename from examples/proto/lib.rs
rename to examples/proto/basic/lib.rs
diff --git a/examples/proto/main.rs b/examples/proto/basic/main.rs
similarity index 100%
rename from examples/proto/main.rs
rename to examples/proto/basic/main.rs
diff --git a/proto/proto.bzl b/proto/proto.bzl
index bd60a15..f4174e2 100644
--- a/proto/proto.bzl
+++ b/proto/proto.bzl
@@ -35,14 +35,15 @@
 """
 
 load(
-    "//proto:toolchain.bzl",
+    "@io_bazel_rules_rust//proto:toolchain.bzl",
     "GRPC_COMPILE_DEPS",
     "PROTO_COMPILE_DEPS",
     _generate_proto = "rust_generate_proto",
     _generated_file_stem = "generated_file_stem",
 )
-load("//rust:private/rustc.bzl", "CrateInfo", "rustc_compile_action")
-load("//rust:private/utils.bzl", "find_toolchain")
+load("@io_bazel_rules_rust//rust:private/rustc.bzl", "CrateInfo", "rustc_compile_action")
+load("@io_bazel_rules_rust//rust:private/utils.bzl", "find_toolchain")
+load("@io_bazel_rules_rust//rust:private/transitions.bzl", "proc_macro_host_transition")
 
 RustProtoProvider = provider(
     fields = {
@@ -225,7 +226,11 @@
                 "@io_bazel_rules_rust//proto:optional_output_wrapper",
             ),
         ),
+        "_whitelist_function_transition": attr.label(
+            default = "//tools/whitelists/function_transition_whitelist",
+        ),
     },
+    cfg = proc_macro_host_transition,
     fragments = ["cpp"],
     host_fragments = ["cpp"],
     toolchains = [
@@ -285,7 +290,11 @@
                 "@io_bazel_rules_rust//proto:optional_output_wrapper",
             ),
         ),
+        "_whitelist_function_transition": attr.label(
+            default = "//tools/whitelists/function_transition_whitelist",
+        ),
     },
+    cfg = proc_macro_host_transition,
     fragments = ["cpp"],
     host_fragments = ["cpp"],
     toolchains = [
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index ceabbdb..971514a 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -321,9 +321,6 @@
         ],
     ),
     "_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"),
-    "_whitelist_function_transition": attr.label(
-        default = "//tools/whitelists/function_transition_whitelist",
-    ),
 }
 
 _rust_library_attrs = {
@@ -336,6 +333,9 @@
         """),
         default = "rlib",
     ),
+    "_whitelist_function_transition": attr.label(
+        default = "//tools/whitelists/function_transition_whitelist",
+    ),
 }
 
 _rust_test_attrs = {
@@ -443,7 +443,6 @@
     executable = True,
     fragments = ["cpp"],
     host_fragments = ["cpp"],
-    cfg = proc_macro_host_transition,
     toolchains = [
         "@io_bazel_rules_rust//rust:toolchain",
         "@bazel_tools//tools/cpp:toolchain_type",
@@ -541,7 +540,6 @@
     executable = True,
     fragments = ["cpp"],
     host_fragments = ["cpp"],
-    cfg = proc_macro_host_transition,
     test = True,
     toolchains = [
         "@io_bazel_rules_rust//rust:toolchain",
@@ -690,7 +688,6 @@
     executable = True,
     fragments = ["cpp"],
     host_fragments = ["cpp"],
-    cfg = proc_macro_host_transition,
     toolchains = [
         "@io_bazel_rules_rust//rust:toolchain",
         "@bazel_tools//tools/cpp:toolchain_type",