mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-19 09:51:05 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7af97c66b8 | |||
| 1f57084365 | |||
| 56bd369422 | |||
| ff259ec66b | |||
| 6c54aafeb9 | |||
| 5d41404e67 | |||
| 1eccb3c350 | |||
| 77ae1c3bf7 | |||
| b85e28166c | |||
| 0508cb50fc | |||
| 84fdc7df69 |
@@ -5,6 +5,9 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
schedule: [cron: "40 1 * * *"]
|
schedule: [cron: "40 1 * * *"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -Dwarnings
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test suite
|
name: Test suite
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.131" # remember to update html_root_url and serde_derive dependency
|
version = "1.0.133" # remember to update html_root_url and serde_derive dependency
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
rust-version = "1.15"
|
rust-version = "1.15"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
@@ -15,7 +15,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC
|
|||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_derive = { version = "=1.0.131", optional = true, path = "../serde_derive" }
|
serde_derive = { version = "=1.0.133", optional = true, path = "../serde_derive" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde_derive = { version = "1.0", path = "../serde_derive" }
|
serde_derive = { version = "1.0", path = "../serde_derive" }
|
||||||
|
|||||||
+3
-2
@@ -91,13 +91,14 @@ fn main() {
|
|||||||
|
|
||||||
// Whitelist of archs that support std::sync::atomic module. Ideally we
|
// Whitelist of archs that support std::sync::atomic module. Ideally we
|
||||||
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
|
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
|
||||||
// Instead this is based on rustc's src/librustc_target/spec/*.rs.
|
// Instead this is based on rustc's compiler/rustc_target/src/spec/*.rs.
|
||||||
let has_atomic64 = target.starts_with("x86_64")
|
let has_atomic64 = target.starts_with("x86_64")
|
||||||
|| target.starts_with("i686")
|
|| target.starts_with("i686")
|
||||||
|| target.starts_with("aarch64")
|
|| target.starts_with("aarch64")
|
||||||
|| target.starts_with("powerpc64")
|
|| target.starts_with("powerpc64")
|
||||||
|| target.starts_with("sparc64")
|
|| target.starts_with("sparc64")
|
||||||
|| target.starts_with("mips64el");
|
|| target.starts_with("mips64el")
|
||||||
|
|| target.starts_with("riscv64");
|
||||||
let has_atomic32 = has_atomic64 || emscripten;
|
let has_atomic32 = has_atomic64 || emscripten;
|
||||||
if has_atomic64 {
|
if has_atomic64 {
|
||||||
println!("cargo:rustc-cfg=std_atomic64");
|
println!("cargo:rustc-cfg=std_atomic64");
|
||||||
|
|||||||
@@ -1213,6 +1213,20 @@ pub trait Deserializer<'de>: Sized {
|
|||||||
fn is_human_readable(&self) -> bool {
|
fn is_human_readable(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not public API.
|
||||||
|
#[cfg(all(serde_derive, any(feature = "std", feature = "alloc")))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
fn __deserialize_content<V>(
|
||||||
|
self,
|
||||||
|
_: ::actually_private::T,
|
||||||
|
visitor: V,
|
||||||
|
) -> Result<::private::de::Content<'de>, Self::Error>
|
||||||
|
where
|
||||||
|
V: Visitor<'de, Value = ::private::de::Content<'de>>,
|
||||||
|
{
|
||||||
|
self.deserialize_any(visitor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
+6
-1
@@ -84,7 +84,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Serde types in rustdoc of other crates get linked to here.
|
// Serde types in rustdoc of other crates get linked to here.
|
||||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.131")]
|
#![doc(html_root_url = "https://docs.rs/serde/1.0.133")]
|
||||||
// Support using Serde without the standard library!
|
// Support using Serde without the standard library!
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// Unstable functionality only if the user asks for it. For tracking and
|
// Unstable functionality only if the user asks for it. For tracking and
|
||||||
@@ -295,3 +295,8 @@ extern crate serde_derive;
|
|||||||
#[cfg(feature = "serde_derive")]
|
#[cfg(feature = "serde_derive")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use serde_derive::*;
|
pub use serde_derive::*;
|
||||||
|
|
||||||
|
#[cfg(all(serde_derive, any(feature = "std", feature = "alloc")))]
|
||||||
|
mod actually_private {
|
||||||
|
pub struct T;
|
||||||
|
}
|
||||||
|
|||||||
+27
-2
@@ -206,6 +206,7 @@ mod content {
|
|||||||
use lib::*;
|
use lib::*;
|
||||||
|
|
||||||
use __private::size_hint;
|
use __private::size_hint;
|
||||||
|
use actually_private;
|
||||||
use de::{
|
use de::{
|
||||||
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny,
|
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny,
|
||||||
MapAccess, SeqAccess, Unexpected, Visitor,
|
MapAccess, SeqAccess, Unexpected, Visitor,
|
||||||
@@ -215,7 +216,7 @@ mod content {
|
|||||||
/// deserializing untagged enums and internally tagged enums.
|
/// deserializing untagged enums and internally tagged enums.
|
||||||
///
|
///
|
||||||
/// Not public API. Use serde-value instead.
|
/// Not public API. Use serde-value instead.
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Content<'de> {
|
pub enum Content<'de> {
|
||||||
Bool(bool),
|
Bool(bool),
|
||||||
|
|
||||||
@@ -294,7 +295,7 @@ mod content {
|
|||||||
// Untagged and internally tagged enums are only supported in
|
// Untagged and internally tagged enums are only supported in
|
||||||
// self-describing formats.
|
// self-describing formats.
|
||||||
let visitor = ContentVisitor { value: PhantomData };
|
let visitor = ContentVisitor { value: PhantomData };
|
||||||
deserializer.deserialize_any(visitor)
|
deserializer.__deserialize_content(actually_private::T, visitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,6 +1428,18 @@ mod content {
|
|||||||
drop(self);
|
drop(self);
|
||||||
visitor.visit_unit()
|
visitor.visit_unit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn __deserialize_content<V>(
|
||||||
|
self,
|
||||||
|
_: actually_private::T,
|
||||||
|
visitor: V,
|
||||||
|
) -> Result<Content<'de>, Self::Error>
|
||||||
|
where
|
||||||
|
V: Visitor<'de, Value = Content<'de>>,
|
||||||
|
{
|
||||||
|
let _ = visitor;
|
||||||
|
Ok(self.content)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de, E> ContentDeserializer<'de, E> {
|
impl<'de, E> ContentDeserializer<'de, E> {
|
||||||
@@ -2138,6 +2151,18 @@ mod content {
|
|||||||
{
|
{
|
||||||
visitor.visit_unit()
|
visitor.visit_unit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn __deserialize_content<V>(
|
||||||
|
self,
|
||||||
|
_: actually_private::T,
|
||||||
|
visitor: V,
|
||||||
|
) -> Result<Content<'de>, Self::Error>
|
||||||
|
where
|
||||||
|
V: Visitor<'de, Value = Content<'de>>,
|
||||||
|
{
|
||||||
|
let _ = visitor;
|
||||||
|
Ok(self.content.clone())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E> {
|
impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E> {
|
||||||
|
|||||||
@@ -915,6 +915,7 @@ macro_rules! atomic_impl {
|
|||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
|
// Matches the atomic ordering used in libcore for the Debug impl
|
||||||
self.load(Ordering::SeqCst).serialize(serializer)
|
self.load(Ordering::SeqCst).serialize(serializer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.131" # remember to update html_root_url
|
version = "1.0.133" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
rust-version = "1.31"
|
rust-version = "1.31"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.131")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.133")]
|
||||||
#![allow(unknown_lints, bare_trait_objects)]
|
#![allow(unknown_lints, bare_trait_objects)]
|
||||||
// Ignored clippy lints
|
// Ignored clippy lints
|
||||||
#![allow(
|
#![allow(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_test"
|
name = "serde_test"
|
||||||
version = "1.0.131" # remember to update html_root_url
|
version = "1.0.133" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
rust-version = "1.15"
|
rust-version = "1.15"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.131")]
|
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.133")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
|
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
|
||||||
// Ignored clippy lints
|
// Ignored clippy lints
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
|
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ fn assert_de_tokens_ignore(ignorable_tokens: &[Token]) {
|
|||||||
Token::Str("ignored"),
|
Token::Str("ignored"),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(ignorable_tokens.to_vec().into_iter())
|
.chain(ignorable_tokens.iter().copied())
|
||||||
.chain(vec![Token::MapEnd].into_iter())
|
.chain(vec![Token::MapEnd].into_iter())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -1347,7 +1347,7 @@ fn test_atomics() {
|
|||||||
let mut de = serde_test::Deserializer::new(tokens);
|
let mut de = serde_test::Deserializer::new(tokens);
|
||||||
match A::deserialize(&mut de) {
|
match A::deserialize(&mut de) {
|
||||||
Ok(v) => {
|
Ok(v) => {
|
||||||
let loaded = load(&v, Ordering::SeqCst);
|
let loaded = load(&v, Ordering::Relaxed);
|
||||||
assert_eq!(val, loaded);
|
assert_eq!(val, loaded);
|
||||||
}
|
}
|
||||||
Err(e) => panic!("tokens failed to deserialize: {}", e),
|
Err(e) => panic!("tokens failed to deserialize: {}", e),
|
||||||
|
|||||||
Reference in New Issue
Block a user