We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7667fb8 commit 4b44d27Copy full SHA for 4b44d27
build.rs
@@ -3,8 +3,19 @@ use std::env;
3
use platforms::Platform;
4
5
fn from_build() -> Result<String, String> {
6
- let tuple =
7
- env::var("RUSTUP_OVERRIDE_BUILD_TRIPLE").unwrap_or_else(|_| env::var("TARGET").unwrap());
+ let tuple = {
+ if let Ok(tuple) = env::var("RUSTUP_OVERRIDE_BUILD_TUPLE") {
8
+ tuple
9
+ } else if let Ok(tuple) = env::var("RUSTUP_OVERRIDE_BUILD_TRIPLE") {
10
11
+ } else if let Ok(tuple) = env::var("TARGET") {
12
13
+ } else {
14
+ panic!(
15
+ "Unable to get target tuple from environment; Be sure that TARGET env var is set, or its overrides"
16
+ )
17
+ }
18
+ };
19
if Platform::ALL.iter().any(|p| p.target_triple == tuple) {
20
Ok(tuple)
21
} else {
0 commit comments