pw_rust: Make rust_bin tool definition more robust

The existing rust_bin tool definition in the generate_toolchain template
is missing a few critical pieces:

1) depfile generation -- without this, Ninja won't recompile Rust
   targets when a module (rather than the main.rs or lib.rs) changes.
2) Unused GN rust_bin toolchain arguments. rustenv, crate_name,
   crate_type, rustflags, rustdeps, externs all are provided by GN for
   Rust targets and are necessary to get proper compilation,
   dependencies, flags, etc.

This commit adds the missing pieces. The depfile arguments to rustc look
a little bit arbitrary, but they're just what's required to get rustc to
output depfiles that Ninja can understand (borrowed from Fuchsia).

Tested:
  Set some rustflags in a target, verified they're set properly.
  Added a Rust target that depends on a module in another file, verified
  that without this change, changes to that module do not cause a
  rebuild, and after this change, they do.
Change-Id: Ifc4cd5a4d099fada960dae9e0b663c47bd51cec2
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/127013
Reviewed-by: Erik Gilling <konkers@google.com>
Commit-Queue: Eli Lipsitz <elipsitz@google.com>
diff --git a/pw_toolchain/generate_toolchain.gni b/pw_toolchain/generate_toolchain.gni
index 336566e..2235539 100644
--- a/pw_toolchain/generate_toolchain.gni
+++ b/pw_toolchain/generate_toolchain.gni
@@ -377,13 +377,22 @@
           _outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
 
           description = "rustc {{output}}"
+          depfile = "{{output}}.d"
           command =
               string_join(" ",
                           [
                             # TODO(b/234872510): Ensure this works with Windows.
                             "RUST_BACKTRACE=1",
+                            "{{rustenv}}",
                             invoker.rustc,
                             "{{source}}",
+                            "--crate-name {{crate_name}}",
+                            "--crate-type {{crate_type}}",
+                            "{{rustflags}}",
+                            "{{rustdeps}}",
+                            "{{externs}}",
+                            "--emit=dep-info=$depfile,link",
+                            "-Zdep-info-omit-d-target",
                             "-o $_outfile",
                             "--color always",
                             "-D warnings",