Skip to content

Commit cc4999e

Browse files
committed
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.
1 parent 8ec22e7 commit cc4999e

File tree

1 file changed

+10
-2
lines changed
  • src/librustc_target/spec

1 file changed

+10
-2
lines changed

src/librustc_target/spec/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,19 @@ macro_rules! supported_targets {
247247
// run-time that the parser works correctly
248248
t = Target::from_json(t.to_json())?;
249249
debug!("Got builtin target: {:?}", t);
250-
Ok(t)
250+
return Ok(t)
251251
},
252252
)+
253-
_ => Err(format!("Unable to find target: {}", target))
253+
_ => {},
254254
}
255+
let mut triple: Vec<&str> = target.splitn(3, '-').collect();
256+
if triple.len() >= 3 {
257+
if triple[1] != "unknown" {
258+
triple[1] = "unknown";
259+
return load_specific(&triple.join("-"))
260+
}
261+
}
262+
Err(format!("Unable to find target: {}", target))
255263
}
256264

257265
pub fn get_targets() -> Box<dyn Iterator<Item=String>> {

0 commit comments

Comments
 (0)