aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-05-23 02:58:22 +0100
committerveetaha <[email protected]>2020-05-31 01:10:23 +0100
commit030d78345fa79af07f8ebd89a9d244576fac992b (patch)
tree935da29fbb0418e8158e06f227f238bda13ee55f /crates
parent5f7225446e75509ae0d971a6f3e2b9d3e37d6f2a (diff)
Fix invoking cargo without consulting CARGO or standard installation paths
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/Cargo.toml1
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs8
2 files changed, 8 insertions, 1 deletions
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 65b487db3..2e49448cc 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -48,6 +48,7 @@ hir = { path = "../ra_hir", package = "ra_hir" }
48hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } 48hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
49hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } 49hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
50ra_proc_macro_srv = { path = "../ra_proc_macro_srv" } 50ra_proc_macro_srv = { path = "../ra_proc_macro_srv" }
51ra_toolchain = { path = "../ra_toolchain" }
51 52
52[target.'cfg(windows)'.dependencies] 53[target.'cfg(windows)'.dependencies]
53winapi = "0.3.8" 54winapi = "0.3.8"
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index 1f910ff82..1b5b3325c 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -40,6 +40,7 @@ use crate::{
40 world::WorldSnapshot, 40 world::WorldSnapshot,
41 LspError, Result, 41 LspError, Result,
42}; 42};
43use anyhow::Context;
43 44
44pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { 45pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> {
45 let _p = profile("handle_analyzer_status"); 46 let _p = profile("handle_analyzer_status");
@@ -982,10 +983,15 @@ fn to_lsp_runnable(
982 target.map_or_else(|| "run binary".to_string(), |t| format!("run {}", t)) 983 target.map_or_else(|| "run binary".to_string(), |t| format!("run {}", t))
983 } 984 }
984 }; 985 };
986 let cargo_path = ra_toolchain::cargo()
987 .to_str()
988 .context("Path to cargo executable contains invalid UTF8 characters")?
989 .to_owned();
990
985 Ok(lsp_ext::Runnable { 991 Ok(lsp_ext::Runnable {
986 range: to_proto::range(&line_index, runnable.range), 992 range: to_proto::range(&line_index, runnable.range),
987 label, 993 label,
988 bin: "cargo".to_string(), 994 bin: cargo_path,
989 args, 995 args,
990 extra_args, 996 extra_args,
991 env: { 997 env: {