]> git.proxmox.com Git - rustc.git/blobdiff - src/vendor/compiletest_rs/src/util.rs
New upstream version 1.24.1+dfsg1
[rustc.git] / src / vendor / compiletest_rs / src / util.rs
index 85fa38bbd3be760125901c92761a22007f28ae6a..c00f28eae67afd0e3fbf5b0a25e56a7ccf4399d3 100644 (file)
@@ -51,10 +51,15 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
     ("wasm32", "wasm32"),
 ];
 
-pub fn get_os(triple: &str) -> &'static str {
+pub fn matches_os(triple: &str, name: &str) -> bool {
+    // For the wasm32 bare target we ignore anything also ignored on emscripten
+    // and then we also recognize `wasm32-bare` as the os for the target
+    if triple == "wasm32-unknown-unknown" {
+        return name == "emscripten" || name == "wasm32-bare"
+    }
     for &(triple_os, os) in OS_TABLE {
         if triple.contains(triple_os) {
-            return os;
+            return os == name;
         }
     }
     panic!("Cannot determine OS from triple");
@@ -73,7 +78,7 @@ pub fn get_env(triple: &str) -> Option<&str> {
 }
 
 pub fn get_pointer_width(triple: &str) -> &'static str {
-    if triple.contains("64") || triple.starts_with("s390x") {
+    if (triple.contains("64") && !triple.ends_with("gnux32")) || triple.starts_with("s390x") {
         "64bit"
     } else {
         "32bit"