diff options
-rw-r--r-- | Cargo.lock | 10 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/lib.rs | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock index 0e80b9530..fd04ec3c5 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1359,6 +1359,7 @@ dependencies = [ | |||
1359 | "rustc-hash", | 1359 | "rustc-hash", |
1360 | "serde", | 1360 | "serde", |
1361 | "serde_json", | 1361 | "serde_json", |
1362 | "serde_path_to_error", | ||
1362 | "ssr", | 1363 | "ssr", |
1363 | "stdx", | 1364 | "stdx", |
1364 | "syntax", | 1365 | "syntax", |
@@ -1528,6 +1529,15 @@ dependencies = [ | |||
1528 | ] | 1529 | ] |
1529 | 1530 | ||
1530 | [[package]] | 1531 | [[package]] |
1532 | name = "serde_path_to_error" | ||
1533 | version = "0.1.4" | ||
1534 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1535 | checksum = "42f6109f0506e20f7e0f910e51a0079acf41da8e0694e6442527c4ddf5a2b158" | ||
1536 | dependencies = [ | ||
1537 | "serde", | ||
1538 | ] | ||
1539 | |||
1540 | [[package]] | ||
1531 | name = "serde_repr" | 1541 | name = "serde_repr" |
1532 | version = "0.1.6" | 1542 | version = "0.1.6" |
1533 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1543 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 0b4d3f4eb..53e70eaf7 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -28,6 +28,7 @@ oorandom = "11.1.2" | |||
28 | rustc-hash = "1.1.0" | 28 | rustc-hash = "1.1.0" |
29 | serde = { version = "1.0.106", features = ["derive"] } | 29 | serde = { version = "1.0.106", features = ["derive"] } |
30 | serde_json = { version = "1.0.48", features = ["preserve_order"] } | 30 | serde_json = { version = "1.0.48", features = ["preserve_order"] } |
31 | serde_path_to_error = "0.1" | ||
31 | threadpool = "1.7.1" | 32 | threadpool = "1.7.1" |
32 | rayon = "1.5" | 33 | rayon = "1.5" |
33 | mimalloc = { version = "0.1.19", default-features = false, optional = true } | 34 | mimalloc = { version = "0.1.19", default-features = false, optional = true } |
diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index 79fe30e53..d538ad69a 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs | |||
@@ -46,7 +46,7 @@ pub type Error = Box<dyn std::error::Error + Send + Sync>; | |||
46 | pub type Result<T, E = Error> = std::result::Result<T, E>; | 46 | pub type Result<T, E = Error> = std::result::Result<T, E>; |
47 | 47 | ||
48 | pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> { | 48 | pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> { |
49 | let res = T::deserialize(&json) | 49 | let res = serde_path_to_error::deserialize(&json) |
50 | .map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?; | 50 | .map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?; |
51 | Ok(res) | 51 | Ok(res) |
52 | } | 52 | } |