diff options
author | Aleksey Kladov <[email protected]> | 2020-07-23 17:57:27 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-23 18:03:17 +0100 |
commit | 7c0743293e5720a5be7b44b4a781b2982d63152a (patch) | |
tree | 151555d84672f020f79eb4cf34bb5e67ec106615 /crates/ra_project_model/src/sysroot.rs | |
parent | 243b997df4dfc07910d38022828bc0f1d4745c57 (diff) |
Require quotes around key-value cfg flags in rust-project.json
This matches rustc command-line flags, as well as the build.rs format.
Diffstat (limited to 'crates/ra_project_model/src/sysroot.rs')
-rw-r--r-- | crates/ra_project_model/src/sysroot.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 68d134da4..8a92acea5 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -6,7 +6,7 @@ use anyhow::{bail, format_err, Result}; | |||
6 | use paths::{AbsPath, AbsPathBuf}; | 6 | use paths::{AbsPath, AbsPathBuf}; |
7 | use ra_arena::{Arena, Idx}; | 7 | use ra_arena::{Arena, Idx}; |
8 | 8 | ||
9 | use crate::output; | 9 | use crate::utf8_stdout; |
10 | 10 | ||
11 | #[derive(Default, Debug, Clone, Eq, PartialEq)] | 11 | #[derive(Default, Debug, Clone, Eq, PartialEq)] |
12 | pub struct Sysroot { | 12 | pub struct Sysroot { |
@@ -92,15 +92,14 @@ fn get_or_install_rust_src(cargo_toml: &AbsPath) -> Result<AbsPathBuf> { | |||
92 | let current_dir = cargo_toml.parent().unwrap(); | 92 | let current_dir = cargo_toml.parent().unwrap(); |
93 | let mut rustc = Command::new(ra_toolchain::rustc()); | 93 | let mut rustc = Command::new(ra_toolchain::rustc()); |
94 | rustc.current_dir(current_dir).args(&["--print", "sysroot"]); | 94 | rustc.current_dir(current_dir).args(&["--print", "sysroot"]); |
95 | let rustc_output = output(rustc)?; | 95 | let stdout = utf8_stdout(rustc)?; |
96 | let stdout = String::from_utf8(rustc_output.stdout)?; | ||
97 | let sysroot_path = AbsPath::assert(Path::new(stdout.trim())); | 96 | let sysroot_path = AbsPath::assert(Path::new(stdout.trim())); |
98 | let src_path = sysroot_path.join("lib/rustlib/src/rust/src"); | 97 | let src_path = sysroot_path.join("lib/rustlib/src/rust/src"); |
99 | 98 | ||
100 | if !src_path.exists() { | 99 | if !src_path.exists() { |
101 | let mut rustup = Command::new(ra_toolchain::rustup()); | 100 | let mut rustup = Command::new(ra_toolchain::rustup()); |
102 | rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); | 101 | rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); |
103 | let _output = output(rustup)?; | 102 | utf8_stdout(rustup)?; |
104 | } | 103 | } |
105 | if !src_path.exists() { | 104 | if !src_path.exists() { |
106 | bail!( | 105 | bail!( |