Make compiletest do exact matching on triples

This avoids the issues of the previous substring matching, ensuring
`ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries.
This commit is contained in:
varkor 2018-03-19 01:36:53 +00:00
parent eae6d512f0
commit 61e1fbc659

View File

@ -75,16 +75,18 @@ pub fn matches_os(triple: &str, name: &str) -> bool {
if triple == "wasm32-unknown-unknown" {
return name == "emscripten" || name == "wasm32-bare"
}
let triple: Vec<_> = triple.split('-').collect();
for &(triple_os, os) in OS_TABLE {
if triple.contains(triple_os) {
if triple.contains(&triple_os) {
return os == name;
}
}
panic!("Cannot determine OS from triple");
}
pub fn get_arch(triple: &str) -> &'static str {
let triple: Vec<_> = triple.split('-').collect();
for &(triple_arch, arch) in ARCH_TABLE {
if triple.contains(triple_arch) {
if triple.contains(&triple_arch) {
return arch;
}
}