about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Pollack <andrewpollack@google.com>2022-09-28 21:32:02 +0000
committerAndrew Pollack <andrewpollack@google.com>2022-09-28 21:32:02 +0000
commit2f172b4f0b024990a0fd3df2fedd0fe18b48a303 (patch)
treecfeaa1f34674945d5034441733aa78bc70b6b21d
parent09ae7846a272a500ff7145255f0de5556c0b8949 (diff)
downloadrust-2f172b4f0b024990a0fd3df2fedd0fe18b48a303.tar.gz
rust-2f172b4f0b024990a0fd3df2fedd0fe18b48a303.zip
Adding target_rustcflags to TargetCfg
-rw-r--r--src/tools/compiletest/src/common.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 4994fb9bbf9..b9ac6c9f364 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -385,7 +385,8 @@ impl Config {
     }
 
     fn target_cfg(&self) -> &TargetCfg {
-        self.target_cfg.borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target))
+        self.target_cfg
+            .borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target, &self.target_rustcflags))
     }
 
     pub fn matches_arch(&self, arch: &str) -> bool {
@@ -456,11 +457,12 @@ pub enum Endian {
 }
 
 impl TargetCfg {
-    fn new(rustc_path: &Path, target: &str) -> TargetCfg {
+    fn new(rustc_path: &Path, target: &str, target_rustcflags: &Option<String>) -> TargetCfg {
         let output = match Command::new(rustc_path)
             .arg("--print=cfg")
             .arg("--target")
             .arg(target)
+            .args(target_rustcflags.into_iter().map(|s| s.split_whitespace()).flatten())
             .output()
         {
             Ok(output) => output,