From 2f172b4f0b024990a0fd3df2fedd0fe18b48a303 Mon Sep 17 00:00:00 2001 From: Andrew Pollack Date: Wed, 28 Sep 2022 21:32:02 +0000 Subject: [PATCH] Adding target_rustcflags to TargetCfg --- src/tools/compiletest/src/common.rs | 6 ++++-- 1 file 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 @@ pub fn run_enabled(&self) -> bool { } 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) -> 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,