Made components of `rustc` bundles mandatory for `rust_toolchain`. (#1104)

* Made components of `rustc` bundles mandatory for `rust_toolchain`.

* Regenerate documentation
diff --git a/docs/flatten.md b/docs/flatten.md
index 7a44d10..6923f01 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -1164,13 +1164,13 @@
 | <a id="rust_toolchain-debug_info"></a>debug_info |  Rustc debug info levels per opt level   | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} |
 | <a id="rust_toolchain-default_edition"></a>default_edition |  The edition to use for rust_* rules that don't specify an edition.   | String | optional | "2018" |
 | <a id="rust_toolchain-dylib_ext"></a>dylib_ext |  The extension for dynamic libraries created from rustc.   | String | required |  |
-| <a id="rust_toolchain-exec_triple"></a>exec_triple |  The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations   | String | optional | "" |
+| <a id="rust_toolchain-exec_triple"></a>exec_triple |  The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations   | String | required |  |
 | <a id="rust_toolchain-opt_level"></a>opt_level |  Rustc optimization levels.   | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} |
 | <a id="rust_toolchain-os"></a>os |  The operating system for the current toolchain   | String | required |  |
-| <a id="rust_toolchain-rust_doc"></a>rust_doc |  The location of the <code>rustdoc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
+| <a id="rust_toolchain-rust_doc"></a>rust_doc |  The location of the <code>rustdoc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required |  |
 | <a id="rust_toolchain-rust_lib"></a>rust_lib |  **Deprecated**: Use <code>rust_std</code>   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rust_std"></a>rust_std |  The Rust standard library.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| <a id="rust_toolchain-rustc"></a>rustc |  The location of the <code>rustc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
+| <a id="rust_toolchain-rustc"></a>rustc |  The location of the <code>rustc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required |  |
 | <a id="rust_toolchain-rustc_lib"></a>rustc_lib |  The libraries used by rustc during compilation.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rustc_srcs"></a>rustc_srcs |  The source code of rustc.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rustfmt"></a>rustfmt |  The location of the <code>rustfmt</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md
index 7d1b1f7..17cb0a5 100644
--- a/docs/rust_repositories.md
+++ b/docs/rust_repositories.md
@@ -92,13 +92,13 @@
 | <a id="rust_toolchain-debug_info"></a>debug_info |  Rustc debug info levels per opt level   | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {"dbg": "2", "fastbuild": "0", "opt": "0"} |
 | <a id="rust_toolchain-default_edition"></a>default_edition |  The edition to use for rust_* rules that don't specify an edition.   | String | optional | "2018" |
 | <a id="rust_toolchain-dylib_ext"></a>dylib_ext |  The extension for dynamic libraries created from rustc.   | String | required |  |
-| <a id="rust_toolchain-exec_triple"></a>exec_triple |  The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations   | String | optional | "" |
+| <a id="rust_toolchain-exec_triple"></a>exec_triple |  The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations   | String | required |  |
 | <a id="rust_toolchain-opt_level"></a>opt_level |  Rustc optimization levels.   | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {"dbg": "0", "fastbuild": "0", "opt": "3"} |
 | <a id="rust_toolchain-os"></a>os |  The operating system for the current toolchain   | String | required |  |
-| <a id="rust_toolchain-rust_doc"></a>rust_doc |  The location of the <code>rustdoc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
+| <a id="rust_toolchain-rust_doc"></a>rust_doc |  The location of the <code>rustdoc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required |  |
 | <a id="rust_toolchain-rust_lib"></a>rust_lib |  **Deprecated**: Use <code>rust_std</code>   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rust_std"></a>rust_std |  The Rust standard library.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| <a id="rust_toolchain-rustc"></a>rustc |  The location of the <code>rustc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
+| <a id="rust_toolchain-rustc"></a>rustc |  The location of the <code>rustc</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required |  |
 | <a id="rust_toolchain-rustc_lib"></a>rustc_lib |  The libraries used by rustc during compilation.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rustc_srcs"></a>rustc_srcs |  The source code of rustc.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
 | <a id="rust_toolchain-rustfmt"></a>rustfmt |  The location of the <code>rustfmt</code> binary. Can be a direct source or a filegroup containing one item.   | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl
index 3785b2e..d9eea01 100644
--- a/rust/toolchain.bzl
+++ b/rust/toolchain.bzl
@@ -345,6 +345,7 @@
                 "The platform triple for the toolchains execution environment. " +
                 "For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations"
             ),
+            mandatory = True,
         ),
         "opt_level": attr.string_dict(
             doc = "Rustc optimization levels.",
@@ -362,6 +363,7 @@
             doc = "The location of the `rustdoc` binary. Can be a direct source or a filegroup containing one item.",
             allow_single_file = True,
             cfg = "exec",
+            mandatory = True,
         ),
         "rust_lib": attr.label(
             doc = "**Deprecated**: Use `rust_std`",
@@ -373,6 +375,7 @@
             doc = "The location of the `rustc` binary. Can be a direct source or a filegroup containing one item.",
             allow_single_file = True,
             cfg = "exec",
+            mandatory = True,
         ),
         "rustc_lib": attr.label(
             doc = "The libraries used by rustc during compilation.",
diff --git a/test/unit/toolchain/toolchain_test.bzl b/test/unit/toolchain/toolchain_test.bzl
index 917e7d0..2e6d208 100644
--- a/test/unit/toolchain/toolchain_test.bzl
+++ b/test/unit/toolchain/toolchain_test.bzl
@@ -1,6 +1,7 @@
 """Unit tests for rust toolchains."""
 
 load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
 load("//rust:toolchain.bzl", "rust_stdlib_filegroup", "rust_toolchain")
 
 def _toolchain_specifies_target_triple_test_impl(ctx):
@@ -54,12 +55,29 @@
         srcs = ["toolchain-test-triple.json"],
     )
 
+    write_file(
+        name = "mock_rustc",
+        out = "mock_rustc.exe",
+        content = [],
+        is_executable = True,
+    )
+
+    write_file(
+        name = "mock_rustdoc",
+        out = "mock_rustdoc.exe",
+        content = [],
+        is_executable = True,
+    )
+
     rust_toolchain(
         name = "rust_triple_toolchain",
         binary_ext = "",
         dylib_ext = ".so",
+        exec_triple = "x86_64-unknown-none",
         os = "linux",
+        rust_doc = ":mock_rustdoc",
         rust_std = ":std_libs",
+        rustc = ":mock_rustc",
         staticlib_ext = ".a",
         stdlib_linkflags = [],
         target_triple = "toolchain-test-triple",
@@ -69,8 +87,11 @@
         name = "rust_json_toolchain",
         binary_ext = "",
         dylib_ext = ".so",
+        exec_triple = "x86_64-unknown-none",
         os = "linux",
+        rust_doc = ":mock_rustdoc",
         rust_std = ":std_libs",
+        rustc = ":mock_rustc",
         staticlib_ext = ".a",
         stdlib_linkflags = [],
         target_json = ":target_json",
@@ -80,8 +101,11 @@
         name = "rust_location_expand_toolchain",
         binary_ext = "",
         dylib_ext = ".so",
+        exec_triple = "x86_64-unknown-none",
         os = "linux",
+        rust_doc = ":mock_rustdoc",
         rust_std = ":std_libs",
+        rustc = ":mock_rustc",
         staticlib_ext = ".a",
         stdlib_linkflags = ["test:$(location :stdlib_srcs)"],
         target_json = ":target_json",
@@ -108,5 +132,6 @@
         tests = [
             ":toolchain_specifies_target_triple_test",
             ":toolchain_specifies_target_json_test",
+            ":toolchain_location_expands_linkflags_test",
         ],
     )