diff options
-rw-r--r-- | Cargo.lock | 22 | ||||
-rw-r--r-- | crates/flycheck/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/flycheck/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/utils.rs | 2 | ||||
-rw-r--r-- | crates/ra_project_model/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 4 | ||||
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_project_model/src/sysroot.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 2 | ||||
-rw-r--r-- | crates/toolchain/Cargo.toml (renamed from crates/ra_toolchain/Cargo.toml) | 8 | ||||
-rw-r--r-- | crates/toolchain/src/lib.rs (renamed from crates/ra_toolchain/src/lib.rs) | 4 | ||||
-rw-r--r-- | editors/code/src/toolchain.ts | 4 |
14 files changed, 30 insertions, 32 deletions
diff --git a/Cargo.lock b/Cargo.lock index 598b739c7..c48c6a597 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -358,8 +358,8 @@ dependencies = [ | |||
358 | "crossbeam-channel", | 358 | "crossbeam-channel", |
359 | "jod-thread", | 359 | "jod-thread", |
360 | "log", | 360 | "log", |
361 | "ra_toolchain", | ||
362 | "serde_json", | 361 | "serde_json", |
362 | "toolchain", | ||
363 | ] | 363 | ] |
364 | 364 | ||
365 | [[package]] | 365 | [[package]] |
@@ -1143,9 +1143,9 @@ dependencies = [ | |||
1143 | "memmap", | 1143 | "memmap", |
1144 | "ra_mbe", | 1144 | "ra_mbe", |
1145 | "ra_proc_macro", | 1145 | "ra_proc_macro", |
1146 | "ra_toolchain", | ||
1147 | "serde_derive", | 1146 | "serde_derive", |
1148 | "test_utils", | 1147 | "test_utils", |
1148 | "toolchain", | ||
1149 | "tt", | 1149 | "tt", |
1150 | ] | 1150 | ] |
1151 | 1151 | ||
@@ -1161,11 +1161,11 @@ dependencies = [ | |||
1161 | "ra_cfg", | 1161 | "ra_cfg", |
1162 | "ra_db", | 1162 | "ra_db", |
1163 | "ra_proc_macro", | 1163 | "ra_proc_macro", |
1164 | "ra_toolchain", | ||
1165 | "rustc-hash", | 1164 | "rustc-hash", |
1166 | "serde", | 1165 | "serde", |
1167 | "serde_json", | 1166 | "serde_json", |
1168 | "stdx", | 1167 | "stdx", |
1168 | "toolchain", | ||
1169 | ] | 1169 | ] |
1170 | 1170 | ||
1171 | [[package]] | 1171 | [[package]] |
@@ -1211,13 +1211,6 @@ dependencies = [ | |||
1211 | ] | 1211 | ] |
1212 | 1212 | ||
1213 | [[package]] | 1213 | [[package]] |
1214 | name = "ra_toolchain" | ||
1215 | version = "0.1.0" | ||
1216 | dependencies = [ | ||
1217 | "home", | ||
1218 | ] | ||
1219 | |||
1220 | [[package]] | ||
1221 | name = "rayon" | 1214 | name = "rayon" |
1222 | version = "1.3.1" | 1215 | version = "1.3.1" |
1223 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1320,7 +1313,6 @@ dependencies = [ | |||
1320 | "ra_ssr", | 1313 | "ra_ssr", |
1321 | "ra_syntax", | 1314 | "ra_syntax", |
1322 | "ra_text_edit", | 1315 | "ra_text_edit", |
1323 | "ra_toolchain", | ||
1324 | "rayon", | 1316 | "rayon", |
1325 | "rustc-hash", | 1317 | "rustc-hash", |
1326 | "serde", | 1318 | "serde", |
@@ -1328,6 +1320,7 @@ dependencies = [ | |||
1328 | "stdx", | 1320 | "stdx", |
1329 | "test_utils", | 1321 | "test_utils", |
1330 | "threadpool", | 1322 | "threadpool", |
1323 | "toolchain", | ||
1331 | "tt", | 1324 | "tt", |
1332 | "vfs", | 1325 | "vfs", |
1333 | "vfs-notify", | 1326 | "vfs-notify", |
@@ -1613,6 +1606,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1613 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" | 1606 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" |
1614 | 1607 | ||
1615 | [[package]] | 1608 | [[package]] |
1609 | name = "toolchain" | ||
1610 | version = "0.0.0" | ||
1611 | dependencies = [ | ||
1612 | "home", | ||
1613 | ] | ||
1614 | |||
1615 | [[package]] | ||
1616 | name = "tracing" | 1616 | name = "tracing" |
1617 | version = "0.1.18" | 1617 | version = "0.1.18" |
1618 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1618 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/crates/flycheck/Cargo.toml b/crates/flycheck/Cargo.toml index ff8a1e568..acc72bc59 100644 --- a/crates/flycheck/Cargo.toml +++ b/crates/flycheck/Cargo.toml | |||
@@ -14,4 +14,4 @@ log = "0.4.8" | |||
14 | cargo_metadata = "0.11.1" | 14 | cargo_metadata = "0.11.1" |
15 | serde_json = "1.0.48" | 15 | serde_json = "1.0.48" |
16 | jod-thread = "0.1.1" | 16 | jod-thread = "0.1.1" |
17 | ra_toolchain = { path = "../ra_toolchain" } | 17 | toolchain = { path = "../toolchain" } |
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index 31e14246d..16078d104 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs | |||
@@ -193,7 +193,7 @@ impl FlycheckActor { | |||
193 | extra_args, | 193 | extra_args, |
194 | features, | 194 | features, |
195 | } => { | 195 | } => { |
196 | let mut cmd = Command::new(ra_toolchain::cargo()); | 196 | let mut cmd = Command::new(toolchain::cargo()); |
197 | cmd.arg(command); | 197 | cmd.arg(command); |
198 | cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) | 198 | cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) |
199 | .arg(self.workspace_root.join("Cargo.toml")); | 199 | .arg(self.workspace_root.join("Cargo.toml")); |
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml index a690cc044..1c25e7229 100644 --- a/crates/ra_proc_macro_srv/Cargo.toml +++ b/crates/ra_proc_macro_srv/Cargo.toml | |||
@@ -23,4 +23,4 @@ cargo_metadata = "0.11.1" | |||
23 | difference = "2.0.0" | 23 | difference = "2.0.0" |
24 | # used as proc macro test target | 24 | # used as proc macro test target |
25 | serde_derive = "1.0.106" | 25 | serde_derive = "1.0.106" |
26 | ra_toolchain = { path = "../ra_toolchain" } | 26 | toolchain = { path = "../toolchain" } |
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs index dcb00671f..1b6a0b6fb 100644 --- a/crates/ra_proc_macro_srv/src/tests/utils.rs +++ b/crates/ra_proc_macro_srv/src/tests/utils.rs | |||
@@ -12,7 +12,7 @@ mod fixtures { | |||
12 | 12 | ||
13 | // Use current project metadata to get the proc-macro dylib path | 13 | // Use current project metadata to get the proc-macro dylib path |
14 | pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { | 14 | pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { |
15 | let command = Command::new(ra_toolchain::cargo()) | 15 | let command = Command::new(toolchain::cargo()) |
16 | .args(&["check", "--message-format", "json"]) | 16 | .args(&["check", "--message-format", "json"]) |
17 | .output() | 17 | .output() |
18 | .unwrap() | 18 | .unwrap() |
diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml index 27b1f5d33..171fe8626 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/ra_project_model/Cargo.toml | |||
@@ -17,7 +17,7 @@ cargo_metadata = "0.11.1" | |||
17 | arena = { path = "../arena" } | 17 | arena = { path = "../arena" } |
18 | ra_cfg = { path = "../ra_cfg" } | 18 | ra_cfg = { path = "../ra_cfg" } |
19 | ra_db = { path = "../ra_db" } | 19 | ra_db = { path = "../ra_db" } |
20 | ra_toolchain = { path = "../ra_toolchain" } | 20 | toolchain = { path = "../toolchain" } |
21 | ra_proc_macro = { path = "../ra_proc_macro" } | 21 | ra_proc_macro = { path = "../ra_proc_macro" } |
22 | paths = { path = "../paths" } | 22 | paths = { path = "../paths" } |
23 | stdx = { path = "../stdx" } | 23 | stdx = { path = "../stdx" } |
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index a526d743d..abf8dca96 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -140,7 +140,7 @@ impl CargoWorkspace { | |||
140 | cargo_features: &CargoConfig, | 140 | cargo_features: &CargoConfig, |
141 | ) -> Result<CargoWorkspace> { | 141 | ) -> Result<CargoWorkspace> { |
142 | let mut meta = MetadataCommand::new(); | 142 | let mut meta = MetadataCommand::new(); |
143 | meta.cargo_path(ra_toolchain::cargo()); | 143 | meta.cargo_path(toolchain::cargo()); |
144 | meta.manifest_path(cargo_toml.to_path_buf()); | 144 | meta.manifest_path(cargo_toml.to_path_buf()); |
145 | if cargo_features.all_features { | 145 | if cargo_features.all_features { |
146 | meta.features(CargoOpt::AllFeatures); | 146 | meta.features(CargoOpt::AllFeatures); |
@@ -288,7 +288,7 @@ pub fn load_extern_resources( | |||
288 | cargo_toml: &Path, | 288 | cargo_toml: &Path, |
289 | cargo_features: &CargoConfig, | 289 | cargo_features: &CargoConfig, |
290 | ) -> Result<ExternResources> { | 290 | ) -> Result<ExternResources> { |
291 | let mut cmd = Command::new(ra_toolchain::cargo()); | 291 | let mut cmd = Command::new(toolchain::cargo()); |
292 | cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); | 292 | cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); |
293 | if cargo_features.all_features { | 293 | if cargo_features.all_features { |
294 | cmd.arg("--all-features"); | 294 | cmd.arg("--all-features"); |
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 300e75135..46f44910c 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -513,7 +513,7 @@ fn get_rustc_cfg_options(target: Option<&str>) -> Vec<CfgFlag> { | |||
513 | } | 513 | } |
514 | 514 | ||
515 | let rustc_cfgs = { | 515 | let rustc_cfgs = { |
516 | let mut cmd = Command::new(ra_toolchain::rustc()); | 516 | let mut cmd = Command::new(toolchain::rustc()); |
517 | cmd.args(&["--print", "cfg", "-O"]); | 517 | cmd.args(&["--print", "cfg", "-O"]); |
518 | if let Some(target) = target { | 518 | if let Some(target) = target { |
519 | cmd.args(&["--target", target]); | 519 | cmd.args(&["--target", target]); |
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 6ef001769..8239797b6 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -101,13 +101,13 @@ fn get_or_install_rust_src(cargo_toml: &AbsPath) -> Result<AbsPathBuf> { | |||
101 | return Ok(path); | 101 | return Ok(path); |
102 | } | 102 | } |
103 | let current_dir = cargo_toml.parent().unwrap(); | 103 | let current_dir = cargo_toml.parent().unwrap(); |
104 | let mut rustc = Command::new(ra_toolchain::rustc()); | 104 | let mut rustc = Command::new(toolchain::rustc()); |
105 | rustc.current_dir(current_dir).args(&["--print", "sysroot"]); | 105 | rustc.current_dir(current_dir).args(&["--print", "sysroot"]); |
106 | let stdout = utf8_stdout(rustc)?; | 106 | let stdout = utf8_stdout(rustc)?; |
107 | let sysroot_path = AbsPath::assert(Path::new(stdout.trim())); | 107 | let sysroot_path = AbsPath::assert(Path::new(stdout.trim())); |
108 | let mut src = get_rust_src(sysroot_path); | 108 | let mut src = get_rust_src(sysroot_path); |
109 | if src.is_none() { | 109 | if src.is_none() { |
110 | let mut rustup = Command::new(ra_toolchain::rustup()); | 110 | let mut rustup = Command::new(toolchain::rustup()); |
111 | rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); | 111 | rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); |
112 | utf8_stdout(rustup)?; | 112 | utf8_stdout(rustup)?; |
113 | src = get_rust_src(sysroot_path); | 113 | src = get_rust_src(sysroot_path); |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 9bc5cc631..3f70510fd 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -43,7 +43,7 @@ ra_text_edit = { path = "../ra_text_edit" } | |||
43 | vfs = { path = "../vfs" } | 43 | vfs = { path = "../vfs" } |
44 | vfs-notify = { path = "../vfs-notify" } | 44 | vfs-notify = { path = "../vfs-notify" } |
45 | ra_cfg = { path = "../ra_cfg" } | 45 | ra_cfg = { path = "../ra_cfg" } |
46 | ra_toolchain = { path = "../ra_toolchain" } | 46 | toolchain = { path = "../toolchain" } |
47 | 47 | ||
48 | # This should only be used in CLI | 48 | # This should only be used in CLI |
49 | ra_db = { path = "../ra_db" } | 49 | ra_db = { path = "../ra_db" } |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index d9b75eed4..07f4af3d3 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -692,7 +692,7 @@ pub(crate) fn handle_formatting( | |||
692 | 692 | ||
693 | let mut rustfmt = match &snap.config.rustfmt { | 693 | let mut rustfmt = match &snap.config.rustfmt { |
694 | RustfmtConfig::Rustfmt { extra_args } => { | 694 | RustfmtConfig::Rustfmt { extra_args } => { |
695 | let mut cmd = process::Command::new(ra_toolchain::rustfmt()); | 695 | let mut cmd = process::Command::new(toolchain::rustfmt()); |
696 | cmd.args(extra_args); | 696 | cmd.args(extra_args); |
697 | if let Some(&crate_id) = crate_ids.first() { | 697 | if let Some(&crate_id) = crate_ids.first() { |
698 | // Assume all crates are in the same edition | 698 | // Assume all crates are in the same edition |
diff --git a/crates/ra_toolchain/Cargo.toml b/crates/toolchain/Cargo.toml index 84b748c0a..4856668f8 100644 --- a/crates/ra_toolchain/Cargo.toml +++ b/crates/toolchain/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "toolchain" |
3 | name = "ra_toolchain" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
diff --git a/crates/ra_toolchain/src/lib.rs b/crates/toolchain/src/lib.rs index 9916e52c4..3b6886f5b 100644 --- a/crates/ra_toolchain/src/lib.rs +++ b/crates/toolchain/src/lib.rs | |||
@@ -1,6 +1,4 @@ | |||
1 | //! This crate contains a single public function | 1 | //! Discovery of `cargo` & `rustc` executables. |
2 | //! [`get_path_for_executable`](fn.get_path_for_executable.html). | ||
3 | //! See docs there for more information. | ||
4 | use std::{env, iter, path::PathBuf}; | 2 | use std::{env, iter, path::PathBuf}; |
5 | 3 | ||
6 | pub fn cargo() -> PathBuf { | 4 | pub fn cargo() -> PathBuf { |
diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index 80a7915e9..a5dc3cf0c 100644 --- a/editors/code/src/toolchain.ts +++ b/editors/code/src/toolchain.ts | |||
@@ -121,12 +121,12 @@ export class Cargo { | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | /** Mirrors `ra_toolchain::cargo()` implementation */ | 124 | /** Mirrors `toolchain::cargo()` implementation */ |
125 | export function cargoPath(): string { | 125 | export function cargoPath(): string { |
126 | return getPathForExecutable("cargo"); | 126 | return getPathForExecutable("cargo"); |
127 | } | 127 | } |
128 | 128 | ||
129 | /** Mirrors `ra_toolchain::get_path_for_executable()` implementation */ | 129 | /** Mirrors `toolchain::get_path_for_executable()` implementation */ |
130 | export const getPathForExecutable = memoize( | 130 | export const getPathForExecutable = memoize( |
131 | // We apply caching to decrease file-system interactions | 131 | // We apply caching to decrease file-system interactions |
132 | (executableName: "cargo" | "rustc" | "rustup"): string => { | 132 | (executableName: "cargo" | "rustc" | "rustup"): string => { |