Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly depend on serde_derive #14450

Closed
wants to merge 1 commit into from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 30, 2023

serde depending on serde_derive increases our compile times by a good chunk which is unfortunate as that doesn't have to be the case.
image

This PR explicitly changes that for our workspace members, though unfortunately the following dependencies still activate that feature for us:

  • camino v1.1.4
  • cargo-platform v0.1.2
  • cargo_metadata v0.15.3
  • lsp-types v0.94.0
  • url v2.3.1

And I am unsure whether these libraries are open to changing that.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2023
@lnicola
Copy link
Member

lnicola commented Mar 30, 2023

Does this make cargo build serde_derive earlier?

@Veykril
Copy link
Member Author

Veykril commented Mar 30, 2023

No this would make cargo build serde earlier, as it no longer needs to wait for serde_derive to build (just so serde can re-export the derive attributes).

That is if we can get the library authors of the listed crates change this as well.

use serde::{de, Deserialize};
use serde::{
de,
Deserialize::{self},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ::{self} is actually required (it explicitly only imports the type namespace), without it this will import both the derive attribute and the trait, while we already have the derive attribute in scope via the serde_derive::Deserialize import (which is only the case because the derive feature is still enabled thanks to the deps).

I'll move this PR to draft though and wait until we can maybe get our deps to move, then we don't need these path shenanigans.

@Veykril
Copy link
Member Author

Veykril commented Mar 30, 2023

Turns out using derive is recommended as the crates break if serde and serde_derive don't have the same version number 🙃 Oh well

@Veykril Veykril closed this Mar 30, 2023
@matklad
Copy link
Member

matklad commented Aug 21, 2023

I think we can do that with https://github.com/matklad/macro-dep-test

I mean, serde might up doing that upstream, but, even before that, I think we ourselves can depend on serde with derive feature enabled under any() cfg. That’ll bind the versions of any existing serde release.

@Veykril Veykril deleted the serde-derive branch August 21, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants