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.
This commit is contained in:
Lukas Wirth 2024-12-20 11:07:05 +01:00
parent 27fac08c82
commit 5211972743
19 changed files with 58 additions and 56 deletions

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