From cc4999ea8e6d605e41a1e2e3e846cf633df8a2c2 Mon Sep 17 00:00:00 2001 From: Zach Reizner Date: Wed, 14 Nov 2018 16:43:07 -0800 Subject: [PATCH] Fallback to unknown vendor with vendored target triples When a target triple is searched for, only exact matches with be returned. This change will fallback to an "unknown" vendor in the target triple if one with the specific vendor can not be found. --- src/librustc_target/spec/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 9ee4582fabf7b..fa3a87d8bf17f 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -247,11 +247,19 @@ macro_rules! supported_targets { // run-time that the parser works correctly t = Target::from_json(t.to_json())?; debug!("Got builtin target: {:?}", t); - Ok(t) + return Ok(t) }, )+ - _ => Err(format!("Unable to find target: {}", target)) + _ => {}, } + let mut triple: Vec<&str> = target.splitn(3, '-').collect(); + if triple.len() >= 3 { + if triple[1] != "unknown" { + triple[1] = "unknown"; + return load_specific(&triple.join("-")) + } + } + Err(format!("Unable to find target: {}", target)) } pub fn get_targets() -> Box> {