diff --git a/Cargo.lock b/Cargo.lock index 2628c9a9d1..14f1d9d08b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,18 +1008,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "lsp-server" -version = "0.7.7" -dependencies = [ - "crossbeam-channel", - "ctrlc", - "log", - "lsp-types", - "serde", - "serde_json", -] - [[package]] name = "lsp-server" version = "0.7.7" @@ -1032,6 +1020,19 @@ dependencies = [ "serde_json", ] +[[package]] +name = "lsp-server" +version = "0.7.8" +dependencies = [ + "crossbeam-channel", + "ctrlc", + "log", + "lsp-types", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "lsp-types" version = "0.95.0" @@ -1289,7 +1290,6 @@ name = "paths" version = "0.0.0" dependencies = [ "camino", - "serde", ] [[package]] @@ -1357,6 +1357,7 @@ dependencies = [ "paths", "rustc-hash 2.0.0", "serde", + "serde_derive", "serde_json", "span", "stdx", @@ -1446,6 +1447,7 @@ dependencies = [ "rustc-hash 2.0.0", "semver", "serde", + "serde_derive", "serde_json", "span", "stdx", @@ -1674,7 +1676,7 @@ dependencies = [ "intern", "itertools", "load-cargo", - "lsp-server 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-server 0.7.7", "lsp-types", "memchr", "mimalloc", @@ -1693,6 +1695,7 @@ dependencies = [ "scip", "semver", "serde", + "serde_derive", "serde_json", "stdx", "syntax", @@ -1820,18 +1823,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.206" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.206" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -1922,12 +1925,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "stdx" version = "0.0.0" @@ -1944,9 +1941,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -2262,13 +2259,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" -dependencies = [ - "serde", - "stable_deref_trait", -] +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" [[package]] name = "tt" diff --git a/Cargo.toml b/Cargo.toml index 8086569a78..1e5577554e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -138,7 +138,8 @@ pulldown-cmark = { version = "0.9.0", default-features = false } rayon = "1.8.0" rustc-hash = "2.0.0" semver = "1.0.14" -serde = { version = "1.0.192", features = ["derive"] } +serde = { version = "1.0.192" } +serde_derive = { version = "1.0.192" } serde_json = "1.0.108" smallvec = { version = "1.10.0", features = [ "const_new", @@ -157,7 +158,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features = "time", "tracing-log", ] } -triomphe = { version = "0.1.10", default-features = false, features = ["std"] } +triomphe = { version = "0.1.14", default-features = false, features = ["std"] } url = "2.3.1" xshell = "0.2.5" diff --git a/crates/paths/Cargo.toml b/crates/paths/Cargo.toml index d4b0a54ed6..f0dafab70c 100644 --- a/crates/paths/Cargo.toml +++ b/crates/paths/Cargo.toml @@ -14,10 +14,9 @@ doctest = false [dependencies] camino.workspace = true -serde = { workspace = true, optional = true } [features] -serde1 = ["camino/serde1", "dep:serde"] +serde1 = ["camino/serde1"] [lints] workspace = true diff --git a/crates/proc-macro-api/Cargo.toml b/crates/proc-macro-api/Cargo.toml index 911301e22b..dac8e09435 100644 --- a/crates/proc-macro-api/Cargo.toml +++ b/crates/proc-macro-api/Cargo.toml @@ -14,6 +14,7 @@ doctest = false [dependencies] serde.workspace = true +serde_derive.workspace = true serde_json = { workspace = true, features = ["unbounded_depth"] } tracing.workspace = true rustc-hash.workspace = true diff --git a/crates/proc-macro-api/src/msg.rs b/crates/proc-macro-api/src/msg.rs index 883528558d..bbd9f582df 100644 --- a/crates/proc-macro-api/src/msg.rs +++ b/crates/proc-macro-api/src/msg.rs @@ -4,7 +4,8 @@ pub(crate) mod flat; use std::io::{self, BufRead, Write}; use paths::Utf8PathBuf; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::de::DeserializeOwned; +use serde_derive::{Deserialize, Serialize}; use crate::ProcMacroKind; @@ -123,7 +124,7 @@ impl ExpnGlobals { } } -pub trait Message: Serialize + DeserializeOwned { +pub trait Message: serde::Serialize + DeserializeOwned { fn read( from_proto: ProtocolRead, inp: &mut R, diff --git a/crates/proc-macro-api/src/msg/flat.rs b/crates/proc-macro-api/src/msg/flat.rs index af3412e90e..5de1e59f28 100644 --- a/crates/proc-macro-api/src/msg/flat.rs +++ b/crates/proc-macro-api/src/msg/flat.rs @@ -39,7 +39,7 @@ use std::collections::VecDeque; use intern::Symbol; use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; +use serde_derive::{Deserialize, Serialize}; use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange}; use crate::msg::EXTENDED_LEAF_DATA; diff --git a/crates/project-model/Cargo.toml b/crates/project-model/Cargo.toml index 68e0e1ba55..ed647950e6 100644 --- a/crates/project-model/Cargo.toml +++ b/crates/project-model/Cargo.toml @@ -19,6 +19,7 @@ rustc-hash.workspace = true semver.workspace = true serde_json.workspace = true serde.workspace = true +serde_derive.workspace = true tracing.workspace = true triomphe.workspace = true la-arena.workspace = true diff --git a/crates/project-model/src/build_dependencies.rs b/crates/project-model/src/build_dependencies.rs index dc71b13eee..524323b973 100644 --- a/crates/project-model/src/build_dependencies.rs +++ b/crates/project-model/src/build_dependencies.rs @@ -15,7 +15,7 @@ use itertools::Itertools; use la_arena::ArenaMap; use paths::{AbsPath, AbsPathBuf, Utf8PathBuf}; use rustc_hash::{FxHashMap, FxHashSet}; -use serde::Deserialize; +use serde::Deserialize as _; use toolchain::Tool; use crate::{ diff --git a/crates/project-model/src/cargo_workspace.rs b/crates/project-model/src/cargo_workspace.rs index 4ae3426ed9..ba4946bf0b 100644 --- a/crates/project-model/src/cargo_workspace.rs +++ b/crates/project-model/src/cargo_workspace.rs @@ -8,7 +8,7 @@ use cargo_metadata::{CargoOpt, MetadataCommand}; use la_arena::{Arena, Idx}; use paths::{AbsPath, AbsPathBuf, Utf8PathBuf}; use rustc_hash::{FxHashMap, FxHashSet}; -use serde::Deserialize; +use serde_derive::Deserialize; use serde_json::from_value; use span::Edition; use toolchain::Tool; diff --git a/crates/ra-salsa/Cargo.toml b/crates/ra-salsa/Cargo.toml index f8a3156fe4..57a20be0ca 100644 --- a/crates/ra-salsa/Cargo.toml +++ b/crates/ra-salsa/Cargo.toml @@ -20,7 +20,7 @@ parking_lot = "0.12.1" rustc-hash = "2.0.0" smallvec = "1.0.0" oorandom = "11" -triomphe = "0.1.11" +triomphe.workspace = true itertools.workspace = true ra-salsa-macros = { version = "0.0.0", path = "ra-salsa-macros", package = "salsa-macros" } diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 7c8610280b..fa9ff6b56d 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -36,6 +36,7 @@ rayon.workspace = true rustc-hash.workspace = true serde_json = { workspace = true, features = ["preserve_order"] } serde.workspace = true +serde_derive.workspace = true tenthash = "0.4.0" num_cpus = "1.15.0" mimalloc = { version = "0.1.30", default-features = false, optional = true } diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs index b035d779a7..f2ad4f081c 100644 --- a/crates/rust-analyzer/src/flycheck.rs +++ b/crates/rust-analyzer/src/flycheck.rs @@ -6,7 +6,8 @@ use std::{fmt, io, process::Command, time::Duration}; use crossbeam_channel::{select_biased, unbounded, Receiver, Sender}; use paths::{AbsPath, AbsPathBuf, Utf8PathBuf}; use rustc_hash::FxHashMap; -use serde::Deserialize; +use serde::Deserialize as _; +use serde_derive::Deserialize; pub(crate) use cargo_metadata::diagnostic::{ Applicability, Diagnostic, DiagnosticCode, DiagnosticLevel, DiagnosticSpan, diff --git a/crates/rust-analyzer/src/test_runner.rs b/crates/rust-analyzer/src/test_runner.rs index 5e43a3c60d..2fd5254733 100644 --- a/crates/rust-analyzer/src/test_runner.rs +++ b/crates/rust-analyzer/src/test_runner.rs @@ -5,7 +5,8 @@ use std::process::Command; use crossbeam_channel::Sender; use paths::AbsPath; -use serde::Deserialize; +use serde::Deserialize as _; +use serde_derive::Deserialize; use toolchain::Tool; use crate::{ diff --git a/crates/rust-analyzer/src/tracing/json.rs b/crates/rust-analyzer/src/tracing/json.rs index f540a33b45..9e35990a5b 100644 --- a/crates/rust-analyzer/src/tracing/json.rs +++ b/crates/rust-analyzer/src/tracing/json.rs @@ -54,7 +54,7 @@ where fn on_event(&self, _event: &Event<'_>, _ctx: Context<'_, S>) {} fn on_close(&self, id: Id, ctx: Context<'_, S>) { - #[derive(serde::Serialize)] + #[derive(serde_derive::Serialize)] struct JsonDataInner { name: &'static str, elapsed_ms: u128, diff --git a/crates/span/src/lib.rs b/crates/span/src/lib.rs index e12575b9b1..20c3b087af 100644 --- a/crates/span/src/lib.rs +++ b/crates/span/src/lib.rs @@ -262,8 +262,9 @@ pub struct MacroFileId { /// `MacroCallId` identifies a particular macro invocation, like /// `println!("Hello, {}", world)`. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct MacroCallId(ra_salsa::InternId); +pub struct MacroCallId(InternId); +#[cfg(feature = "ra-salsa")] impl ra_salsa::InternKey for MacroCallId { fn from_intern_id(v: ra_salsa::InternId) -> Self { MacroCallId(v) @@ -362,6 +363,7 @@ mod intern_id_proxy { use std::fmt; use std::num::NonZeroU32; + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub(super) struct InternId { value: NonZeroU32, } diff --git a/lib/lsp-server/Cargo.toml b/lib/lsp-server/Cargo.toml index cce007ae54..2fa3272e65 100644 --- a/lib/lsp-server/Cargo.toml +++ b/lib/lsp-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lsp-server" -version = "0.7.7" +version = "0.7.8" description = "Generic LSP server scaffold." license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/lsp-server" @@ -9,7 +9,8 @@ edition = "2021" [dependencies] log = "0.4.17" serde_json = "1.0.108" -serde = { version = "1.0.192", features = ["derive"] } +serde = { version = "1.0.216" } +serde_derive = { version = "1.0.216" } crossbeam-channel.workspace = true [dev-dependencies] diff --git a/lib/lsp-server/src/msg.rs b/lib/lsp-server/src/msg.rs index 53c64796f2..11f98f5079 100644 --- a/lib/lsp-server/src/msg.rs +++ b/lib/lsp-server/src/msg.rs @@ -3,7 +3,8 @@ use std::{ io::{self, BufRead, Write}, }; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::de::DeserializeOwned; +use serde_derive::{Deserialize, Serialize}; use crate::error::ExtractError; @@ -196,7 +197,7 @@ impl Message { } impl Response { - pub fn new_ok(id: RequestId, result: R) -> Response { + pub fn new_ok(id: RequestId, result: R) -> Response { Response { id, result: Some(serde_json::to_value(result).unwrap()), error: None } } pub fn new_err(id: RequestId, code: i32, message: String) -> Response { @@ -206,7 +207,7 @@ impl Response { } impl Request { - pub fn new(id: RequestId, method: String, params: P) -> Request { + pub fn new(id: RequestId, method: String, params: P) -> Request { Request { id, method, params: serde_json::to_value(params).unwrap() } } pub fn extract( @@ -231,7 +232,7 @@ impl Request { } impl Notification { - pub fn new(method: String, params: impl Serialize) -> Notification { + pub fn new(method: String, params: impl serde::Serialize) -> Notification { Notification { method, params: serde_json::to_value(params).unwrap() } } pub fn extract( diff --git a/lib/lsp-server/src/req_queue.rs b/lib/lsp-server/src/req_queue.rs index 347a9fb6fb..c216864bee 100644 --- a/lib/lsp-server/src/req_queue.rs +++ b/lib/lsp-server/src/req_queue.rs @@ -1,7 +1,5 @@ use std::collections::HashMap; -use serde::Serialize; - use crate::{ErrorCode, Request, RequestId, Response, ResponseError}; /// Manages the set of pending requests, both incoming and outgoing. @@ -56,7 +54,7 @@ impl Incoming { } impl Outgoing { - pub fn register(&mut self, method: String, params: P, data: O) -> Request { + pub fn register(&mut self, method: String, params: P, data: O) -> Request { let id = RequestId::from(self.next_id); self.pending.insert(id.clone(), data); self.next_id += 1; diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 01ad333631..b505ee835b 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -16,7 +16,8 @@ xflags = "0.3.0" time = { version = "0.3", default-features = false } zip = { version = "0.6", default-features = false, features = ["deflate", "time"] } stdx.workspace = true -proc-macro2 = "1.0.47" +# https://github.com/dtolnay/proc-macro2/issues/475 +proc-macro2 = "=1.0.86" quote = "1.0.20" ungrammar = "1.16.1" either.workspace = true