Disable unsupported Rust targets.

Explicitly disable targets requiring unsupported toolchains when
processing Rust modules.

Bug: 140640858
Test: Darwin builds no longer breaking.
Change-Id: I8c60a2829508ae6de16bf347060818ca5c04f65e
diff --git a/rust/rust.go b/rust/rust.go
index 5a2514e..62ccfc7 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -173,6 +173,24 @@
 
 	android.InitDefaultableModule(mod)
 
+	// Explicitly disable unsupported targets.
+	android.AddLoadHook(mod, func(ctx android.LoadHookContext) {
+		disableTargets := struct {
+			Target struct {
+				Darwin struct {
+					Enabled *bool
+				}
+				Linux_bionic struct {
+					Enabled *bool
+				}
+			}
+		}{}
+		disableTargets.Target.Darwin.Enabled = proptools.BoolPtr(false)
+		disableTargets.Target.Linux_bionic.Enabled = proptools.BoolPtr(false)
+
+		ctx.AppendProperties(&disableTargets)
+	})
+
 	return mod
 }