Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ same-file = "1.0.6"
schemars = "1.0.4"
security-framework = "3.3.0"
semver = { version = "1.0.26", features = ["serde"] }
serde = "1.0.219"
serde = "1.0.220"
serde_core = "1.0.220"
serde-untagged = "0.1.7"
serde-value = "0.7.0"
serde_ignored = "0.1.12"
Expand Down
7 changes: 6 additions & 1 deletion crates/cargo-platform/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-platform"
version = "0.3.1"
version = "0.3.2"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
Expand All @@ -10,6 +10,11 @@ documentation = "https://docs.rs/cargo-platform"
description = "Cargo's representation of a target platform."

[dependencies]
serde_core.workspace = true

# serde v1.0.220 is the first version that released with `serde_core`.
# This is required to avoid conflict with other `serde` users which may require an older version.
[target.'cfg(any())'.dependencies]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this target table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It bumps the requirement of serde to the minimum required for serde_core. I don't think this is required, however other serde_core users add this cfg

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a comment explaining that? My understanding is that if someone has a lockfile with a version of serde from before serde_core was added, serde will stay on the older version while cargo-platform will use serde_core and thus have the wrong definitions.

serde.workspace = true

[lints]
Expand Down
10 changes: 5 additions & 5 deletions crates/cargo-platform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,22 @@ impl Platform {
}
}

impl serde::Serialize for Platform {
impl serde_core::Serialize for Platform {
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: serde_core::Serializer,
{
self.to_string().serialize(s)
}
}

impl<'de> serde::Deserialize<'de> for Platform {
impl<'de> serde_core::Deserialize<'de> for Platform {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
D: serde_core::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
FromStr::from_str(&s).map_err(serde::de::Error::custom)
FromStr::from_str(&s).map_err(serde_core::de::Error::custom)
}
}

Expand Down
Loading