Merge pull request #18728 from Veykril/push-ozqlrzmqklwt

internal: Split `serde` derive feature into `serde_derive` usage
This commit is contained in:
Lukas Wirth 2024-12-20 11:09:27 +00:00 committed by GitHub
commit f3f8f4c6ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 58 additions and 56 deletions

57
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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<R: BufRead>(
from_proto: ProtocolRead<R>,
inp: &mut R,

View file

@ -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;

View file

@ -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

View file

@ -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::{

View file

@ -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;

View file

@ -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" }

View file

@ -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 }

View file

@ -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,

View file

@ -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::{

View file

@ -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,

View file

@ -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,
}

View file

@ -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]

View file

@ -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<R: Serialize>(id: RequestId, result: R) -> Response {
pub fn new_ok<R: serde::Serialize>(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<P: Serialize>(id: RequestId, method: String, params: P) -> Request {
pub fn new<P: serde::Serialize>(id: RequestId, method: String, params: P) -> Request {
Request { id, method, params: serde_json::to_value(params).unwrap() }
}
pub fn extract<P: DeserializeOwned>(
@ -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<P: DeserializeOwned>(

View file

@ -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<I> Incoming<I> {
}
impl<O> Outgoing<O> {
pub fn register<P: Serialize>(&mut self, method: String, params: P, data: O) -> Request {
pub fn register<P: serde::Serialize>(&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;

View file

@ -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