Merge changes from topic "roll-rust-1.47.0"

* changes:
  Use Rust 1.47.0 prebuilts
  rust: set STD_ENV_ARCH
This commit is contained in:
Thiébaud Weksteen 2020-11-06 07:28:42 +00:00 committed by Gerrit Code Review
commit 567f46fe63
2 changed files with 18 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import (
"android/soong/android"
"android/soong/cc"
"android/soong/rust/config"
)
var (
@ -138,6 +139,13 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
crate_name := ctx.RustModule().CrateName()
targetTriple := ctx.toolchain().RustTriple()
// libstd requires a specific environment variable to be set. This is
// not officially documented and may be removed in the future. See
// https://github.com/rust-lang/rust/blob/master/library/std/src/env.rs#L866.
if crate_name == "std" {
envVars = append(envVars, "STD_ENV_ARCH="+config.StdEnvArch[ctx.RustModule().Arch().ArchType])
}
inputs = append(inputs, main)
// Collect rustc flags

View File

@ -24,7 +24,7 @@ import (
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
RustDefaultVersion = "1.46.0"
RustDefaultVersion = "1.47.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
@ -32,6 +32,15 @@ var (
"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",