summaryrefslogtreecommitdiff
path: root/user/rust/0009-compiletest-Match-suffixed-environments.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/rust/0009-compiletest-Match-suffixed-environments.patch')
-rw-r--r--user/rust/0009-compiletest-Match-suffixed-environments.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/user/rust/0009-compiletest-Match-suffixed-environments.patch b/user/rust/0009-compiletest-Match-suffixed-environments.patch
new file mode 100644
index 000000000..9ca4d9900
--- /dev/null
+++ b/user/rust/0009-compiletest-Match-suffixed-environments.patch
@@ -0,0 +1,48 @@
+From 0b28aa018f3f64913101495ce9806d356230856e Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 2 Sep 2019 22:10:10 -0500
+Subject: [PATCH 09/16] compiletest: Match suffixed environments
+
+---
+ src/tools/compiletest/src/header.rs | 2 +-
+ src/tools/compiletest/src/util.rs | 8 ++++++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
+index 52f777db2da..4bf3c1a8527 100644
+--- a/src/tools/compiletest/src/header.rs
++++ b/src/tools/compiletest/src/header.rs
+@@ -820,10 +820,10 @@ impl Config {
+
+ if name == "test" ||
+ util::matches_os(&self.target, name) || // target
++ util::matches_env(&self.target, name) || // env
+ name == util::get_arch(&self.target) || // architecture
+ name == util::get_pointer_width(&self.target) || // pointer width
+ name == self.stage_id.split('-').next().unwrap() || // stage
+- Some(name) == util::get_env(&self.target) || // env
+ (self.target != self.host && name == "cross-compile") ||
+ match self.compare_mode {
+ Some(CompareMode::Nll) => name == "compare-mode-nll",
+diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
+index 8caf5ca00f5..d23f4edc55d 100644
+--- a/src/tools/compiletest/src/util.rs
++++ b/src/tools/compiletest/src/util.rs
+@@ -101,8 +101,12 @@ pub fn get_arch(triple: &str) -> &'static str {
+ panic!("Cannot determine Architecture from triple");
+ }
+
+-pub fn get_env(triple: &str) -> Option<&str> {
+- triple.split('-').nth(3)
++pub fn matches_env(triple: &str, name: &str) -> bool {
++ if let Some(env) = triple.split('-').nth(3) {
++ env.starts_with(name)
++ } else {
++ false
++ }
+ }
+
+ pub fn get_pointer_width(triple: &str) -> &'static str {
+--
+2.21.0
+