aboutsummaryrefslogtreecommitdiff
path: root/Cargo.lock
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-08 11:11:19 +0100
committerGitHub <[email protected]>2020-05-08 11:11:19 +0100
commit8295a9340c1fbda805497035054ead0b10c0d88e (patch)
treeccab3f149b9633ae95570d78fa5d6b8d3b3392e6 /Cargo.lock
parent363c1f2f493d206f2cc10c348a02f3efadd8c77a (diff)
parent3077eae2a61f97c28c0d4e3456f6ab873126e5b8 (diff)
Merge #4329
4329: Look for `cargo`, `rustc`, and `rustup` in standard installation path r=matklad a=cdisselkoen Discussed in #3118. This is approximately a 90% fix for the issue described there. This PR creates a new crate `ra_env` with a function `get_path_for_executable()`; see docs there. `get_path_for_executable()` improves and generalizes the function `cargo_binary()` which was previously duplicated in the `ra_project_model` and `ra_flycheck` crates. (Both of those crates now depend on the new `ra_env` crate.) The new function checks (e.g.) `$CARGO` and `$PATH`, but also falls back on `~/.cargo/bin` manually before erroring out. This should allow most users to not have to worry about setting the `$CARGO` or `$PATH` variables for VSCode, which can be difficult e.g. on macOS as discussed in #3118. I've attempted to replace all calls to `cargo`, `rustc`, and `rustup` in rust-analyzer with appropriate invocations of `get_path_for_executable()`; I don't think I've missed any in Rust code, but there is at least one invocation in TypeScript code which I haven't fixed. (I'm not sure whether it's affected by the same problem or not.) https://github.com/rust-analyzer/rust-analyzer/blob/a4778ddb7a00f552a8e653bbf56ae9fd69cfe1d3/editors/code/src/cargo.ts#L79 I'm sure this PR could be improved a bunch, so I'm happy to take feedback/suggestions on how to solve this problem better, or just bikeshedding variable/function/crate names etc. cc @Veetaha Fixes #3118. Co-authored-by: Craig Disselkoen <[email protected]> Co-authored-by: veetaha <[email protected]>
Diffstat (limited to 'Cargo.lock')
-rw-r--r--Cargo.lock19
1 files changed, 19 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 264b9b7fb..36cff6402 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -465,6 +465,15 @@ dependencies = [
465] 465]
466 466
467[[package]] 467[[package]]
468name = "home"
469version = "0.5.3"
470source = "registry+https://github.com/rust-lang/crates.io-index"
471checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
472dependencies = [
473 "winapi 0.3.8",
474]
475
476[[package]]
468name = "idna" 477name = "idna"
469version = "0.2.0" 478version = "0.2.0"
470source = "registry+https://github.com/rust-lang/crates.io-index" 479source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -949,6 +958,14 @@ dependencies = [
949] 958]
950 959
951[[package]] 960[[package]]
961name = "ra_env"
962version = "0.1.0"
963dependencies = [
964 "anyhow",
965 "home",
966]
967
968[[package]]
952name = "ra_flycheck" 969name = "ra_flycheck"
953version = "0.1.0" 970version = "0.1.0"
954dependencies = [ 971dependencies = [
@@ -958,6 +975,7 @@ dependencies = [
958 "jod-thread", 975 "jod-thread",
959 "log", 976 "log",
960 "lsp-types", 977 "lsp-types",
978 "ra_env",
961 "serde_json", 979 "serde_json",
962] 980]
963 981
@@ -1162,6 +1180,7 @@ dependencies = [
1162 "ra_arena", 1180 "ra_arena",
1163 "ra_cfg", 1181 "ra_cfg",
1164 "ra_db", 1182 "ra_db",
1183 "ra_env",
1165 "ra_proc_macro", 1184 "ra_proc_macro",
1166 "rustc-hash", 1185 "rustc-hash",
1167 "serde", 1186 "serde",