aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-05 18:25:52 +0100
committerGitHub <[email protected]>2020-05-05 18:25:52 +0100
commit8803e748a627f2ff45d441e70b3deda3f038c40e (patch)
tree7bf401e386cc5939bc6548aad91d7f652ea2e5be /crates/ra_project_model/src/lib.rs
parentdf7b59081fabd96c6ee5599aad58c941cfb6beb7 (diff)
parent04e32fbffca22e632594218e8dfafdc39281c6f7 (diff)
Merge #4166
4166: Defining a default target to support cross-compilation targets r=matklad a=FuriouZz Related to #4163 Co-authored-by: Christophe MASSOLIN <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r--crates/ra_project_model/src/lib.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 731cbd291..c2b33c1dc 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -543,7 +543,7 @@ impl ProjectWorkspace {
543 } 543 }
544} 544}
545 545
546pub fn get_rustc_cfg_options() -> CfgOptions { 546pub fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions {
547 let mut cfg_options = CfgOptions::default(); 547 let mut cfg_options = CfgOptions::default();
548 548
549 // Some nightly-only cfgs, which are required for stdlib 549 // Some nightly-only cfgs, which are required for stdlib
@@ -558,10 +558,12 @@ pub fn get_rustc_cfg_options() -> CfgOptions {
558 558
559 match (|| -> Result<String> { 559 match (|| -> Result<String> {
560 // `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here. 560 // `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here.
561 let output = Command::new("rustc") 561 let mut cmd = Command::new("rustc");
562 .args(&["--print", "cfg", "-O"]) 562 cmd.args(&["--print", "cfg", "-O"]);
563 .output() 563 if let Some(target) = target {
564 .context("Failed to get output from rustc --print cfg -O")?; 564 cmd.args(&["--target", target.as_str()]);
565 }
566 let output = cmd.output().context("Failed to get output from rustc --print cfg -O")?;
565 if !output.status.success() { 567 if !output.status.success() {
566 bail!( 568 bail!(
567 "rustc --print cfg -O exited with exit code ({})", 569 "rustc --print cfg -O exited with exit code ({})",