aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-05-09 23:22:26 +0100
committerEdwin Cheng <[email protected]>2020-05-09 23:22:26 +0100
commit2400d70442364769b4ae18315fc178427d2d95a9 (patch)
tree95a2ac4b2b8ab3f510305e69ffd46d98190098e9
parent8295a9340c1fbda805497035054ead0b10c0d88e (diff)
Update cargo-metadata
-rw-r--r--Cargo.lock12
-rw-r--r--crates/ra_flycheck/Cargo.toml2
-rw-r--r--crates/ra_flycheck/src/lib.rs2
-rw-r--r--crates/ra_proc_macro_srv/Cargo.toml4
-rw-r--r--crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt21
-rw-r--r--crates/ra_proc_macro_srv/src/tests/mod.rs6
-rw-r--r--crates/ra_proc_macro_srv/src/tests/utils.rs6
-rw-r--r--crates/ra_project_model/Cargo.toml2
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs14
9 files changed, 28 insertions, 41 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 36cff6402..c185add12 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -89,9 +89,9 @@ dependencies = [
89 89
90[[package]] 90[[package]]
91name = "cargo_metadata" 91name = "cargo_metadata"
92version = "0.9.1" 92version = "0.10.0"
93source = "registry+https://github.com/rust-lang/crates.io-index" 93source = "registry+https://github.com/rust-lang/crates.io-index"
94checksum = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" 94checksum = "b8de60b887edf6d74370fc8eb177040da4847d971d6234c7b13a6da324ef0caf"
95dependencies = [ 95dependencies = [
96 "semver", 96 "semver",
97 "serde", 97 "serde",
@@ -1515,18 +1515,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
1515 1515
1516[[package]] 1516[[package]]
1517name = "serde" 1517name = "serde"
1518version = "1.0.106" 1518version = "1.0.107"
1519source = "registry+https://github.com/rust-lang/crates.io-index" 1519source = "registry+https://github.com/rust-lang/crates.io-index"
1520checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" 1520checksum = "eba7550f2cdf88ffc23ab0f1607133486c390a8c0f89b57e589b9654ee15e04d"
1521dependencies = [ 1521dependencies = [
1522 "serde_derive", 1522 "serde_derive",
1523] 1523]
1524 1524
1525[[package]] 1525[[package]]
1526name = "serde_derive" 1526name = "serde_derive"
1527version = "1.0.106" 1527version = "1.0.107"
1528source = "registry+https://github.com/rust-lang/crates.io-index" 1528source = "registry+https://github.com/rust-lang/crates.io-index"
1529checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" 1529checksum = "10be45e22e5597d4b88afcc71f9d7bfadcd604bf0c78a3ab4582b8d2b37f39f3"
1530dependencies = [ 1530dependencies = [
1531 "proc-macro2", 1531 "proc-macro2",
1532 "quote", 1532 "quote",
diff --git a/crates/ra_flycheck/Cargo.toml b/crates/ra_flycheck/Cargo.toml
index d0f7fb2dc..578a45894 100644
--- a/crates/ra_flycheck/Cargo.toml
+++ b/crates/ra_flycheck/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
11crossbeam-channel = "0.4.0" 11crossbeam-channel = "0.4.0"
12lsp-types = { version = "0.74.0", features = ["proposed"] } 12lsp-types = { version = "0.74.0", features = ["proposed"] }
13log = "0.4.8" 13log = "0.4.8"
14cargo_metadata = "0.9.1" 14cargo_metadata = "0.10.0"
15serde_json = "1.0.48" 15serde_json = "1.0.48"
16jod-thread = "0.1.1" 16jod-thread = "0.1.1"
17ra_env = { path = "../ra_env" } 17ra_env = { path = "../ra_env" }
diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs
index d8b727b0e..39b02ca94 100644
--- a/crates/ra_flycheck/src/lib.rs
+++ b/crates/ra_flycheck/src/lib.rs
@@ -205,6 +205,8 @@ impl FlycheckThread {
205 } 205 }
206 206
207 CheckEvent::Msg(Message::BuildScriptExecuted(_msg)) => {} 207 CheckEvent::Msg(Message::BuildScriptExecuted(_msg)) => {}
208 CheckEvent::Msg(Message::BuildFinished(_)) => {}
209 CheckEvent::Msg(Message::TextLine(_)) => {}
208 CheckEvent::Msg(Message::Unknown) => {} 210 CheckEvent::Msg(Message::Unknown) => {}
209 } 211 }
210 } 212 }
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml
index 886e14870..bb3003278 100644
--- a/crates/ra_proc_macro_srv/Cargo.toml
+++ b/crates/ra_proc_macro_srv/Cargo.toml
@@ -18,7 +18,7 @@ memmap = "0.7"
18test_utils = { path = "../test_utils" } 18test_utils = { path = "../test_utils" }
19 19
20[dev-dependencies] 20[dev-dependencies]
21cargo_metadata = "0.9.1" 21cargo_metadata = "0.10.0"
22difference = "2.0.0" 22difference = "2.0.0"
23# used as proc macro test target 23# used as proc macro test target
24serde_derive = "=1.0.106" 24serde_derive = "1.0.106"
diff --git a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
index 6776f5231..bc010cfe9 100644
--- a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
+++ b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
@@ -23,23 +23,12 @@ SUBTREE $
23 SUBTREE [] 4294967295 23 SUBTREE [] 4294967295
24 IDENT allow 4294967295 24 IDENT allow 4294967295
25 SUBTREE () 4294967295 25 SUBTREE () 4294967295
26 IDENT unknown_lints 4294967295
27 PUNCH # [alone] 4294967295
28 SUBTREE [] 4294967295
29 IDENT cfg_attr 4294967295
30 SUBTREE () 4294967295
31 IDENT feature 4294967295
32 PUNCH = [alone] 4294967295
33 LITERAL "cargo-clippy" 0
34 PUNCH , [alone] 4294967295
35 IDENT allow 4294967295
36 SUBTREE () 4294967295
37 IDENT useless_attribute 4294967295
38 PUNCH # [alone] 4294967295
39 SUBTREE [] 4294967295
40 IDENT allow 4294967295
41 SUBTREE () 4294967295
42 IDENT rust_2018_idioms 4294967295 26 IDENT rust_2018_idioms 4294967295
27 PUNCH , [alone] 4294967295
28 IDENT clippy 4294967295
29 PUNCH : [joint] 4294967295
30 PUNCH : [alone] 4294967295
31 IDENT useless_attribute 4294967295
43 IDENT extern 4294967295 32 IDENT extern 4294967295
44 IDENT crate 4294967295 33 IDENT crate 4294967295
45 IDENT serde 4294967295 34 IDENT serde 4294967295
diff --git a/crates/ra_proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs
index 9cf58511c..82cefbb29 100644
--- a/crates/ra_proc_macro_srv/src/tests/mod.rs
+++ b/crates/ra_proc_macro_srv/src/tests/mod.rs
@@ -10,7 +10,7 @@ fn test_derive_serialize_proc_macro() {
10 assert_expand( 10 assert_expand(
11 "serde_derive", 11 "serde_derive",
12 "Serialize", 12 "Serialize",
13 "1.0.106", 13 "1.0",
14 r##"struct Foo {}"##, 14 r##"struct Foo {}"##,
15 include_str!("fixtures/test_serialize_proc_macro.txt"), 15 include_str!("fixtures/test_serialize_proc_macro.txt"),
16 ); 16 );
@@ -21,7 +21,7 @@ fn test_derive_serialize_proc_macro_failed() {
21 assert_expand( 21 assert_expand(
22 "serde_derive", 22 "serde_derive",
23 "Serialize", 23 "Serialize",
24 "1.0.106", 24 "1.0",
25 r##" 25 r##"
26 struct {} 26 struct {}
27"##, 27"##,
@@ -37,7 +37,7 @@ SUBTREE $
37 37
38#[test] 38#[test]
39fn test_derive_proc_macro_list() { 39fn test_derive_proc_macro_list() {
40 let res = list("serde_derive", "1.0.106").join("\n"); 40 let res = list("serde_derive", "1.0").join("\n");
41 41
42 assert_eq_text!( 42 assert_eq_text!(
43 &res, 43 &res,
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs
index 646a427c5..71436eee0 100644
--- a/crates/ra_proc_macro_srv/src/tests/utils.rs
+++ b/crates/ra_proc_macro_srv/src/tests/utils.rs
@@ -8,7 +8,7 @@ use std::str::FromStr;
8use test_utils::assert_eq_text; 8use test_utils::assert_eq_text;
9 9
10mod fixtures { 10mod fixtures {
11 use cargo_metadata::{parse_messages, Message}; 11 use cargo_metadata::Message;
12 use std::process::Command; 12 use std::process::Command;
13 13
14 // Use current project metadata to get the proc-macro dylib path 14 // Use current project metadata to get the proc-macro dylib path
@@ -19,12 +19,12 @@ mod fixtures {
19 .unwrap() 19 .unwrap()
20 .stdout; 20 .stdout;
21 21
22 for message in parse_messages(command.as_slice()) { 22 for message in Message::parse_stream(command.as_slice()) {
23 match message.unwrap() { 23 match message.unwrap() {
24 Message::CompilerArtifact(artifact) => { 24 Message::CompilerArtifact(artifact) => {
25 if artifact.target.kind.contains(&"proc-macro".to_string()) { 25 if artifact.target.kind.contains(&"proc-macro".to_string()) {
26 let repr = format!("{} {}", crate_name, version); 26 let repr = format!("{} {}", crate_name, version);
27 if artifact.package_id.repr.starts_with(&repr) { 27 if artifact.package_id.repr.starts_with(dbg!(&repr)) {
28 return artifact.filenames[0].clone(); 28 return artifact.filenames[0].clone();
29 } 29 }
30 } 30 }
diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml
index 626478468..946deed5d 100644
--- a/crates/ra_project_model/Cargo.toml
+++ b/crates/ra_project_model/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
11log = "0.4.8" 11log = "0.4.8"
12rustc-hash = "1.1.0" 12rustc-hash = "1.1.0"
13 13
14cargo_metadata = "0.9.1" 14cargo_metadata = "0.10.0"
15 15
16ra_arena = { path = "../ra_arena" } 16ra_arena = { path = "../ra_arena" }
17ra_cfg = { path = "../ra_cfg" } 17ra_cfg = { path = "../ra_cfg" }
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index eb9f33ee8..9152a6d9d 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -162,7 +162,7 @@ impl CargoWorkspace {
162 meta.current_dir(parent); 162 meta.current_dir(parent);
163 } 163 }
164 if let Some(target) = cargo_features.target.as_ref() { 164 if let Some(target) = cargo_features.target.as_ref() {
165 meta.other_options(&[String::from("--filter-platform"), target.clone()]); 165 meta.other_options(vec![String::from("--filter-platform"), target.clone()]);
166 } 166 }
167 let meta = meta.exec().with_context(|| { 167 let meta = meta.exec().with_context(|| {
168 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display()) 168 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display())
@@ -305,19 +305,13 @@ pub fn load_extern_resources(
305 305
306 let mut res = ExternResources::default(); 306 let mut res = ExternResources::default();
307 307
308 for message in cargo_metadata::parse_messages(output.stdout.as_slice()) { 308 for message in cargo_metadata::Message::parse_stream(output.stdout.as_slice()) {
309 if let Ok(message) = message { 309 if let Ok(message) = message {
310 match message { 310 match message {
311 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { 311 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => {
312 res.out_dirs.insert(package_id.clone(), out_dir); 312 res.out_dirs.insert(package_id.clone(), out_dir);
313 res.cfgs.insert( 313 res.cfgs.insert(package_id, cfgs);
314 package_id,
315 // FIXME: Current `cargo_metadata` uses `PathBuf` instead of `String`,
316 // change when https://github.com/oli-obk/cargo_metadata/pulls/112 reaches crates.io
317 cfgs.iter().filter_map(|c| c.to_str().map(|s| s.to_owned())).collect(),
318 );
319 } 314 }
320
321 Message::CompilerArtifact(message) => { 315 Message::CompilerArtifact(message) => {
322 if message.target.kind.contains(&"proc-macro".to_string()) { 316 if message.target.kind.contains(&"proc-macro".to_string()) {
323 let package_id = message.package_id; 317 let package_id = message.package_id;
@@ -330,6 +324,8 @@ pub fn load_extern_resources(
330 } 324 }
331 Message::CompilerMessage(_) => (), 325 Message::CompilerMessage(_) => (),
332 Message::Unknown => (), 326 Message::Unknown => (),
327 Message::BuildFinished(_) => {}
328 Message::TextLine(_) => {}
333 } 329 }
334 } 330 }
335 } 331 }