rust: set STD_ENV_ARCH

In 1.47.0, std::env requires the STD_ENV_ARCH environment variable to be
set to the target architecture [1].

[1] https://github.com/rust-lang/rust/blob/8e8939b8045b7af6076fb718e2e298844aaf4650/library/std/src/env.rs#L866

Bug: 171280890
Test: cd external/rust; mm
Change-Id: If4ddf4b9bad2a1a7518a358a5fb597170a97c67e
diff --git a/rust/config/global.go b/rust/config/global.go
index 71c4240..326b85f 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -32,6 +32,15 @@
 		"libtest",
 	}
 
+	// Mapping between Soong internal arch types and std::env constants.
+	// Required as Rust uses aarch64 when Soong uses arm64.
+	StdEnvArch = map[android.ArchType]string{
+		android.Arm:    "arm",
+		android.Arm64:  "aarch64",
+		android.X86:    "x86",
+		android.X86_64: "x86_64",
+	}
+
 	GlobalRustFlags = []string{
 		"--remap-path-prefix $$(pwd)=",
 		"-C codegen-units=1",