diff --git a/Cargo.toml b/Cargo.toml index 41c11afa..b09c5f07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "serde_derive_internals", "test_suite", ] +resolver = "2" [patch.crates-io] serde = { path = "serde" } diff --git a/serde/Cargo.toml b/serde/Cargo.toml index 8c81e0f1..ae2855c5 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -6,7 +6,7 @@ build = "build.rs" categories = ["encoding", "no-std", "no-std::no-alloc"] description = "A generic serialization/deserialization framework" documentation = "https://docs.rs/serde" -edition = "2018" +edition = "2021" homepage = "https://serde.rs" keywords = ["serde", "serialization", "no_std"] license = "MIT OR Apache-2.0" diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index 540632f4..b2cc64c8 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -206,7 +206,7 @@ macro_rules! declare_error_trait { /// containing an integer, the unexpected type is the integer and the /// expected type is the string. #[cold] - fn invalid_type(unexp: Unexpected, exp: &Expected) -> Self { + fn invalid_type(unexp: Unexpected, exp: &dyn Expected) -> Self { Error::custom(format_args!("invalid type: {}, expected {}", unexp, exp)) } @@ -224,7 +224,7 @@ macro_rules! declare_error_trait { /// that is not valid UTF-8, the unexpected value is the bytes and the /// expected value is a string. #[cold] - fn invalid_value(unexp: Unexpected, exp: &Expected) -> Self { + fn invalid_value(unexp: Unexpected, exp: &dyn Expected) -> Self { Error::custom(format_args!("invalid value: {}, expected {}", unexp, exp)) } @@ -238,7 +238,7 @@ macro_rules! declare_error_trait { /// expected. For example `exp` might say that a tuple of size 6 was /// expected. #[cold] - fn invalid_length(len: usize, exp: &Expected) -> Self { + fn invalid_length(len: usize, exp: &dyn Expected) -> Self { Error::custom(format_args!("invalid length {}, expected {}", len, exp)) } @@ -492,7 +492,7 @@ impl Expected for &str { } } -impl Display for Expected + '_ { +impl Display for dyn Expected + '_ { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { Expected::fmt(self, formatter) } diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 50ae6ed1..af5878bb 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -1065,7 +1065,7 @@ mod content { E: de::Error, { #[cold] - fn invalid_type(self, exp: &Expected) -> E { + fn invalid_type(self, exp: &dyn Expected) -> E { de::Error::invalid_type(self.content.unexpected(), exp) } @@ -1654,7 +1654,7 @@ mod content { E: de::Error, { #[cold] - fn invalid_type(self, exp: &Expected) -> E { + fn invalid_type(self, exp: &dyn Expected) -> E { de::Error::invalid_type(self.content.unexpected(), exp) } diff --git a/serde_derive/Cargo.toml b/serde_derive/Cargo.toml index 4242312a..bce32311 100644 --- a/serde_derive/Cargo.toml +++ b/serde_derive/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Erick Tryzelaar ", "David Tolnay ", "David Tolnay "] description = "AST representation used by Serde derive macros. Unstable." documentation = "https://docs.rs/serde_derive_internals" -edition = "2015" +edition = "2021" exclude = ["build.rs"] homepage = "https://serde.rs" keywords = ["serde", "serialization"]