]> git.lizzy.rs Git - rust.git/commitdiff
Make compiletest do exact matching on triples
authorvarkor <github@varkor.com>
Mon, 19 Mar 2018 01:36:53 +0000 (01:36 +0000)
committervarkor <github@varkor.com>
Tue, 20 Mar 2018 11:49:30 +0000 (11:49 +0000)
This avoids the issues of the previous substring matching, ensuring
`ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries.

src/tools/compiletest/src/util.rs

index b73f3e2f649549915528fc52258a57b14460ec92..c612f0117aaf7f311365369302807cea21eef268 100644 (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;
         }
     }