Automatically calculate std::env::consts::ARCH.
This simplifies the definition for ARCH. Note that this changes asmjs-unknown-emscripten ARCH to `wasm32`, which reflects the actual target arch.
This commit is contained in:
parent
d9e8d62907
commit
8c6c1dd3d3
2 changed files with 2 additions and 76 deletions
|
@ -63,4 +63,5 @@ fn main() {
|
|||
println!("cargo:rustc-link-lib=c");
|
||||
println!("cargo:rustc-link-lib=compiler_rt");
|
||||
}
|
||||
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
|
||||
}
|
||||
|
|
|
@ -882,7 +882,7 @@ pub mod consts {
|
|||
/// - s390x
|
||||
/// - sparc64
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub const ARCH: &str = super::arch::ARCH;
|
||||
pub const ARCH: &str = env!("STD_ENV_ARCH");
|
||||
|
||||
/// The family of the operating system. Example value is `unix`.
|
||||
///
|
||||
|
@ -966,81 +966,6 @@ pub mod consts {
|
|||
pub const EXE_EXTENSION: &str = os::EXE_EXTENSION;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "x86";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "x86_64";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "arm";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "aarch64";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "mips")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "mips";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "mips64")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "mips64";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "powerpc")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "powerpc";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "powerpc64")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "powerpc64";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "s390x")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "s390x";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "sparc64")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "sparc64";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "le32")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "le32";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "asmjs")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "asmjs";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod arch {
|
||||
pub const ARCH: &str = "wasm32";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "hexagon")]
|
||||
mod arch {
|
||||
pub const ARCH: &'static str = "hexagon";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
mod arch {
|
||||
pub const ARCH: &'static str = "riscv64";
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue