diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-12-20 11:07:05 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-12-20 11:55:02 +0100 |
| commit | 23e2f8aa8662daee809dce4f8eef6932628d3836 (patch) | |
| tree | b2488d98e66ce7d989376a57bc94f2ad8e82fe69 /src/tools/rust-analyzer/crates | |
| parent | 4aa34abe649f0521dc361b71004cf3dfa3e2addc (diff) | |
internal: Split serde derive feature into `serde_derive` usage
Ideally we'd not have any dependency pull in the derive feature for faster build times, once that is the case this change would have an actual effect. See https://github.com/matklad/macro-dep-test/blob/master/README.md for context.
Diffstat (limited to 'src/tools/rust-analyzer/crates')
13 files changed, 19 insertions, 12 deletions
diff --git a/src/tools/rust-analyzer/crates/paths/Cargo.toml b/src/tools/rust-analyzer/crates/paths/Cargo.toml index d4b0a54ed64..f0dafab70c1 100644 --- a/src/tools/rust-analyzer/crates/paths/Cargo.toml +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml index 911301e22b4..dac8e094357 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs index 883528558d9..bbd9f582df9 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs +++ b/src/tools/rust-analyzer/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<R: BufRead>( from_proto: ProtocolRead<R>, inp: &mut R, diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs index af3412e90e4..5de1e59f280 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/project-model/Cargo.toml b/src/tools/rust-analyzer/crates/project-model/Cargo.toml index 68e0e1ba554..ed647950e66 100644 --- a/src/tools/rust-analyzer/crates/project-model/Cargo.toml +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs b/src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs index dc71b13eeec..524323b9736 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs b/src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs index 4ae3426ed97..ba4946bf0b9 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/cargo_workspace.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/ra-salsa/Cargo.toml b/src/tools/rust-analyzer/crates/ra-salsa/Cargo.toml index f8a3156fe40..57a20be0cad 100644 --- a/src/tools/rust-analyzer/crates/ra-salsa/Cargo.toml +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml b/src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml index 7c8610280b3..fa9ff6b56df 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs index b035d779a7d..f2ad4f081c4 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs index 5e43a3c60d8..2fd52547336 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/rust-analyzer/src/tracing/json.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/tracing/json.rs index f540a33b451..9e35990a5bc 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/tracing/json.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/span/src/lib.rs b/src/tools/rust-analyzer/crates/span/src/lib.rs index e12575b9b15..20c3b087af5 100644 --- a/src/tools/rust-analyzer/crates/span/src/lib.rs +++ b/src/tools/rust-analyzer/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, } |
