Skip to content

Commit 2400d70

Browse files
committed
Update cargo-metadata
1 parent 8295a93 commit 2400d70

File tree

9 files changed

+28
-41
lines changed

9 files changed

+28
-41
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_flycheck/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ doctest = false
1111
crossbeam-channel = "0.4.0"
1212
lsp-types = { version = "0.74.0", features = ["proposed"] }
1313
log = "0.4.8"
14-
cargo_metadata = "0.9.1"
14+
cargo_metadata = "0.10.0"
1515
serde_json = "1.0.48"
1616
jod-thread = "0.1.1"
1717
ra_env = { path = "../ra_env" }

crates/ra_flycheck/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ impl FlycheckThread {
205205
}
206206

207207
CheckEvent::Msg(Message::BuildScriptExecuted(_msg)) => {}
208+
CheckEvent::Msg(Message::BuildFinished(_)) => {}
209+
CheckEvent::Msg(Message::TextLine(_)) => {}
208210
CheckEvent::Msg(Message::Unknown) => {}
209211
}
210212
}

crates/ra_proc_macro_srv/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ memmap = "0.7"
1818
test_utils = { path = "../test_utils" }
1919

2020
[dev-dependencies]
21-
cargo_metadata = "0.9.1"
21+
cargo_metadata = "0.10.0"
2222
difference = "2.0.0"
2323
# used as proc macro test target
24-
serde_derive = "=1.0.106"
24+
serde_derive = "1.0.106"

crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,15 @@ SUBTREE $
2020
PUNCH = [alone] 4294967295
2121
SUBTREE {} 4294967295
2222
PUNCH # [alone] 4294967295
23-
SUBTREE [] 4294967295
24-
IDENT allow 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
3923
SUBTREE [] 4294967295
4024
IDENT allow 4294967295
4125
SUBTREE () 4294967295
4226
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
4332
IDENT extern 4294967295
4433
IDENT crate 4294967295
4534
IDENT serde 4294967295

crates/ra_proc_macro_srv/src/tests/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn test_derive_serialize_proc_macro() {
1010
assert_expand(
1111
"serde_derive",
1212
"Serialize",
13-
"1.0.106",
13+
"1.0",
1414
r##"struct Foo {}"##,
1515
include_str!("fixtures/test_serialize_proc_macro.txt"),
1616
);
@@ -21,7 +21,7 @@ fn test_derive_serialize_proc_macro_failed() {
2121
assert_expand(
2222
"serde_derive",
2323
"Serialize",
24-
"1.0.106",
24+
"1.0",
2525
r##"
2626
struct {}
2727
"##,
@@ -37,7 +37,7 @@ SUBTREE $
3737

3838
#[test]
3939
fn 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");
4141

4242
assert_eq_text!(
4343
&res,

crates/ra_proc_macro_srv/src/tests/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::str::FromStr;
88
use test_utils::assert_eq_text;
99

1010
mod fixtures {
11-
use cargo_metadata::{parse_messages, Message};
11+
use cargo_metadata::Message;
1212
use std::process::Command;
1313

1414
// Use current project metadata to get the proc-macro dylib path
@@ -19,12 +19,12 @@ mod fixtures {
1919
.unwrap()
2020
.stdout;
2121

22-
for message in parse_messages(command.as_slice()) {
22+
for message in Message::parse_stream(command.as_slice()) {
2323
match message.unwrap() {
2424
Message::CompilerArtifact(artifact) => {
2525
if artifact.target.kind.contains(&"proc-macro".to_string()) {
2626
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)) {
2828
return artifact.filenames[0].clone();
2929
}
3030
}

crates/ra_project_model/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ doctest = false
1111
log = "0.4.8"
1212
rustc-hash = "1.1.0"
1313

14-
cargo_metadata = "0.9.1"
14+
cargo_metadata = "0.10.0"
1515

1616
ra_arena = { path = "../ra_arena" }
1717
ra_cfg = { path = "../ra_cfg" }

crates/ra_project_model/src/cargo_workspace.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl CargoWorkspace {
162162
meta.current_dir(parent);
163163
}
164164
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()]);
166166
}
167167
let meta = meta.exec().with_context(|| {
168168
format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display())
@@ -305,19 +305,13 @@ pub fn load_extern_resources(
305305

306306
let mut res = ExternResources::default();
307307

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()) {
309309
if let Ok(message) = message {
310310
match message {
311311
Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => {
312312
res.out_dirs.insert(package_id.clone(), out_dir);
313-
res.cfgs.insert(
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-
);
313+
res.cfgs.insert(package_id, cfgs);
319314
}
320-
321315
Message::CompilerArtifact(message) => {
322316
if message.target.kind.contains(&"proc-macro".to_string()) {
323317
let package_id = message.package_id;
@@ -330,6 +324,8 @@ pub fn load_extern_resources(
330324
}
331325
Message::CompilerMessage(_) => (),
332326
Message::Unknown => (),
327+
Message::BuildFinished(_) => {}
328+
Message::TextLine(_) => {}
333329
}
334330
}
335331
}

0 commit comments

Comments
 (0)