mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 00:38:00 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0bdb88b70 | |||
| 5d546231a1 | |||
| 0a75fdd839 | |||
| c03215db8d | |||
| 877abfe00e | |||
| a155b33847 | |||
| 10dc33548a | |||
| ee2259c972 | |||
| 0084743f82 | |||
| 679af0fb4b | |||
| d99c876120 | |||
| 7ce49dc38b | |||
| d17902059e | |||
| a27948e209 | |||
| 576e2ef9d8 | |||
| dd0eb0f2ca | |||
| f7fc3e0d67 | |||
| 1c396d223b | |||
| e42684f9a7 | |||
| 56c29b3c5d | |||
| 5a44519a9a | |||
| fae23fea97 | |||
| d656b4dd6a | |||
| b517ec9fd7 | |||
| 086353c581 | |||
| 4e278703c6 | |||
| 9f9a1ea35e | |||
| a866b336f1 | |||
| 5adc9e816c | |||
| ab581789f4 |
+14
-14
@@ -18,10 +18,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- run: cd test_suite && cargo test --features unstable
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: always()
|
||||
with:
|
||||
name: Cargo.lock
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact
|
||||
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
rust: [stable, beta]
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{matrix.rust}}
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
os: [ubuntu, windows]
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- run: cd serde && cargo build
|
||||
- run: cd serde && cargo build --no-default-features
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
rust: [1.56.0, 1.60.0]
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{matrix.rust}}
|
||||
@@ -98,12 +98,12 @@ jobs:
|
||||
- run: cd serde && cargo build
|
||||
|
||||
derive:
|
||||
name: Rust 1.61.0
|
||||
name: Rust 1.68.0
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@1.61.0
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@1.68.0
|
||||
- run: |
|
||||
sed -i 's/proc-macro2 = { workspace = true/proc-macro2 = { version = "1"/' serde_derive*/Cargo.toml
|
||||
sed -i 's/quote = { workspace = true/quote = { version = "1"/' serde_derive*/Cargo.toml
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- run: cargo generate-lockfile -Z minimal-versions
|
||||
- run: cargo check --locked --workspace
|
||||
@@ -129,7 +129,7 @@ jobs:
|
||||
env:
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: dtolnay/install@cargo-docs-rs
|
||||
- run: cargo docs-rs -p serde
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@clippy
|
||||
- run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
|
||||
- run: cd serde_core && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@miri
|
||||
with:
|
||||
toolchain: nightly-2025-05-16 # https://github.com/rust-lang/miri/issues/4323
|
||||
@@ -175,7 +175,7 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/install@cargo-outdated
|
||||
- run: cargo outdated --workspace --exit-code 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.56] [![serde_derive msrv]][Rust 1.61]
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.56] [![serde_derive msrv]][Rust 1.68]
|
||||
|
||||
[Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master
|
||||
[actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
|
||||
@@ -6,8 +6,8 @@
|
||||
[crates.io]: https://crates.io/crates/serde
|
||||
[serde msrv]: https://img.shields.io/crates/msrv/serde.svg?label=serde%20msrv&color=lightgray
|
||||
[serde_derive msrv]: https://img.shields.io/crates/msrv/serde_derive.svg?label=serde_derive%20msrv&color=lightgray
|
||||
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
|
||||
[Rust 1.61]: https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html
|
||||
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0/
|
||||
[Rust 1.68]: https://blog.rust-lang.org/2023/03/09/Rust-1.68.0/
|
||||
|
||||
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.227"
|
||||
version = "1.0.228"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
build = "build.rs"
|
||||
categories = ["encoding", "no-std", "no-std::no-alloc"]
|
||||
@@ -15,7 +15,7 @@ repository = "https://github.com/serde-rs/serde"
|
||||
rust-version = "1.56"
|
||||
|
||||
[dependencies]
|
||||
serde_core = { version = "=1.0.227", path = "../serde_core", default-features = false, features = ["result"] }
|
||||
serde_core = { version = "=1.0.228", path = "../serde_core", default-features = false, features = ["result"] }
|
||||
serde_derive = { version = "1", optional = true, path = "../serde_derive" }
|
||||
|
||||
[package.metadata.playground]
|
||||
|
||||
+4
-6
@@ -19,9 +19,7 @@ use serde_core::__private$$ as serde_core_private;
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
if env::var_os("DOCS_RS").is_some() {
|
||||
println!("cargo:rustc-cfg=no_serde_core");
|
||||
}
|
||||
println!("cargo:rustc-cfg=if_docsrs_then_no_serde_core");
|
||||
|
||||
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
let patch_version = env::var("CARGO_PKG_VERSION_PATCH").unwrap();
|
||||
@@ -35,20 +33,20 @@ fn main() {
|
||||
|
||||
if minor >= 77 {
|
||||
println!("cargo:rustc-check-cfg=cfg(feature, values(\"result\"))");
|
||||
println!("cargo:rustc-check-cfg=cfg(if_docsrs_then_no_serde_core)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_cstr)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_error)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_net)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_diagnostic_namespace)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_serde_core)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_serde_derive)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_std_atomic)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_std_atomic64)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_target_has_atomic)");
|
||||
}
|
||||
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.61.
|
||||
if minor < 61 {
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.68.
|
||||
if minor < 68 {
|
||||
println!("cargo:rustc-cfg=no_serde_derive");
|
||||
}
|
||||
|
||||
|
||||
+41
-15
@@ -95,9 +95,11 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.227")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.228")]
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// Also force no_std on target_os = "none" (wasm32v1-none) even if std feature is enabled
|
||||
// This handles Cargo feature unification where std gets enabled for no_std targets
|
||||
#![cfg_attr(any(not(feature = "std"), target_os = "none"), no_std)]
|
||||
// Show which crate feature enables conditionally compiled APIs in documentation.
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, rustdoc_internals))]
|
||||
#![cfg_attr(docsrs, allow(internal_features))]
|
||||
@@ -119,7 +121,7 @@
|
||||
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
// not available in our oldest supported compiler
|
||||
clippy::empty_enum,
|
||||
clippy::empty_enums,
|
||||
clippy::type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
|
||||
// integer and float ser/de requires these sorts of casts
|
||||
clippy::cast_possible_truncation,
|
||||
@@ -168,6 +170,10 @@
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
|
||||
// Explicitly import core crate for no_std targets (especially wasm32v1-none)
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
extern crate core;
|
||||
|
||||
// Rustdoc has a lot of shortcomings related to cross-crate re-exports that make
|
||||
// the rendered documentation of serde_core traits in serde more challenging to
|
||||
// understand than the equivalent documentation of the same items in serde_core.
|
||||
@@ -190,14 +196,34 @@ macro_rules! crate_root {
|
||||
/// A facade around all the types we need from the `std`, `core`, and `alloc`
|
||||
/// crates. This avoids elaborate import wrangling having to happen in every
|
||||
/// module.
|
||||
///
|
||||
/// NOTE: On targets where std is not available (target_os = "none", e.g. wasm32v1-none),
|
||||
/// we always use core/alloc even if the "std" feature is enabled due to Cargo feature
|
||||
/// unification.
|
||||
mod lib {
|
||||
mod core {
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub use core::*;
|
||||
#[cfg(feature = "std")]
|
||||
pub use std::*;
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::*;
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::*;
|
||||
}
|
||||
|
||||
// Re-export the full prelude for wasm32v1-none and other no_std targets
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::prelude::rust_2021::*;
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::prelude::rust_2021::*;
|
||||
|
||||
// Prelude items that may not be re-exported by glob import
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::option::Option::{self, None, Some};
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::result::Result::{self, Err, Ok};
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::option::Option::{self, None, Some};
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::result::Result::{self, Err, Ok};
|
||||
|
||||
pub use self::core::{f32, f64};
|
||||
pub use self::core::{ptr, str};
|
||||
|
||||
@@ -212,24 +238,24 @@ macro_rules! crate_root {
|
||||
pub use self::core::option;
|
||||
pub use self::core::result;
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::borrow::{Cow, ToOwned};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::borrow::{Cow, ToOwned};
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::string::{String, ToString};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::string::{String, ToString};
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::vec::Vec;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::vec::Vec;
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::boxed::Box;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::boxed::Box;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
use crate::lib::*;
|
||||
|
||||
// Explicit prelude import for wasm32v1-none and other no_std targets
|
||||
#[allow(unused_imports)]
|
||||
use ::core::prelude::rust_2021::*;
|
||||
#[allow(unused_imports)]
|
||||
use ::core::write;
|
||||
|
||||
use crate::de::value::{BorrowedBytesDeserializer, BytesDeserializer};
|
||||
use crate::de::{
|
||||
Deserialize, DeserializeSeed, Deserializer, EnumAccess, Error, IntoDeserializer, VariantAccess,
|
||||
@@ -212,6 +218,12 @@ mod content {
|
||||
|
||||
use crate::lib::*;
|
||||
|
||||
// Explicit prelude import for wasm32v1-none and other no_std targets
|
||||
#[allow(unused_imports)]
|
||||
use ::core::prelude::rust_2021::*;
|
||||
#[allow(unused_imports)]
|
||||
use ::core::write;
|
||||
|
||||
use crate::de::{
|
||||
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny,
|
||||
MapAccess, SeqAccess, Unexpected, Visitor,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
use crate::lib::*;
|
||||
|
||||
// Explicit prelude import for wasm32v1-none and other no_std targets
|
||||
#[allow(unused_imports)]
|
||||
use ::core::prelude::rust_2021::*;
|
||||
#[allow(unused_imports)]
|
||||
use ::core::write;
|
||||
|
||||
use crate::ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer};
|
||||
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
@@ -339,6 +345,10 @@ where
|
||||
mod content {
|
||||
use crate::lib::*;
|
||||
|
||||
// Explicit prelude import for wasm32v1-none and other no_std targets
|
||||
#[allow(unused_imports)]
|
||||
use ::core::prelude::rust_2021::*;
|
||||
|
||||
use crate::ser::{self, Serialize, Serializer};
|
||||
|
||||
pub struct SerializeTupleVariantAsMapValue<M> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_core"
|
||||
version = "1.0.227"
|
||||
version = "1.0.228"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
build = "build.rs"
|
||||
categories = ["encoding", "no-std", "no-std::no-alloc"]
|
||||
@@ -37,7 +37,7 @@ rustdoc-args = [
|
||||
# is compatible with exactly one serde release because the generated code
|
||||
# involves nonpublic APIs which are not bound by semver.
|
||||
[target.'cfg(any())'.dependencies]
|
||||
serde_derive = { version = "=1.0.227", path = "../serde_derive" }
|
||||
serde_derive = { version = "=1.0.228", path = "../serde_derive" }
|
||||
|
||||
|
||||
### FEATURES #################################################################
|
||||
|
||||
+6
-6
@@ -29,12 +29,12 @@ fn main() {
|
||||
};
|
||||
|
||||
if minor >= 77 {
|
||||
println!("cargo:rustc-check-cfg=cfg(if_docsrs_then_no_serde_core)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_cstr)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_error)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_net)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_diagnostic_namespace)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_serde_core)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_serde_derive)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_std_atomic)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_std_atomic64)");
|
||||
@@ -65,17 +65,17 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.61.
|
||||
if minor < 61 {
|
||||
println!("cargo:rustc-cfg=no_serde_derive");
|
||||
}
|
||||
|
||||
// Support for core::ffi::CStr and alloc::ffi::CString stabilized in Rust 1.64.
|
||||
// https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#c-compatible-ffi-types-in-core-and-alloc
|
||||
if minor < 64 {
|
||||
println!("cargo:rustc-cfg=no_core_cstr");
|
||||
}
|
||||
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.68.
|
||||
if minor < 68 {
|
||||
println!("cargo:rustc-cfg=no_serde_derive");
|
||||
}
|
||||
|
||||
// Support for core::num::Saturating and std::num::Saturating stabilized in Rust 1.74
|
||||
// https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#stabilized-apis
|
||||
if minor < 74 {
|
||||
|
||||
@@ -3,14 +3,37 @@ macro_rules! crate_root {
|
||||
/// A facade around all the types we need from the `std`, `core`, and `alloc`
|
||||
/// crates. This avoids elaborate import wrangling having to happen in every
|
||||
/// module.
|
||||
///
|
||||
/// NOTE: On targets where std is not available (target_os = "none", e.g. wasm32v1-none),
|
||||
/// we always use core/alloc even if the "std" feature is enabled due to Cargo feature
|
||||
/// unification. This is handled by checking `target_os = "none"` in all cfg conditions.
|
||||
mod lib {
|
||||
mod core {
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub use core::*;
|
||||
#[cfg(feature = "std")]
|
||||
pub use std::*;
|
||||
// On wasm32v1-none (target_os = "none"), always use ::core even if std feature is enabled
|
||||
// This handles Cargo feature unification where std gets enabled for no_std targets
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::*;
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::*;
|
||||
}
|
||||
|
||||
// Re-export the full prelude for wasm32v1-none and other no_std targets
|
||||
// On target_os = "none", always use ::core::prelude even with std feature
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::prelude::rust_2021::*;
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::prelude::rust_2021::*;
|
||||
|
||||
// Prelude items that may not be re-exported by glob import
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::option::Option::{self, None, Some};
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
pub use ::core::result::Result::{self, Err, Ok};
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::option::Option::{self, None, Some};
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use ::std::result::Result::{self, Err, Ok};
|
||||
|
||||
pub use self::core::{f32, f64};
|
||||
pub use self::core::{iter, num, str};
|
||||
|
||||
@@ -20,99 +43,110 @@ macro_rules! crate_root {
|
||||
pub use self::core::cell::{Cell, RefCell};
|
||||
pub use self::core::cmp::Reverse;
|
||||
pub use self::core::fmt::{self, Debug, Display, Write as FmtWrite};
|
||||
pub use self::core::marker::PhantomData;
|
||||
pub use self::core::marker::{PhantomData, Sized};
|
||||
pub use self::core::clone::Clone;
|
||||
pub use self::core::marker::{Copy, Send, Sync, Unpin};
|
||||
pub use self::core::default::Default;
|
||||
pub use self::core::cmp::{Eq, Ord, PartialEq, PartialOrd};
|
||||
pub use self::core::convert::{AsMut, AsRef, From, Into};
|
||||
pub use self::core::iter::{
|
||||
DoubleEndedIterator, ExactSizeIterator, Extend, IntoIterator, Iterator,
|
||||
};
|
||||
pub use self::core::ops::{Drop, Fn, FnMut, FnOnce};
|
||||
pub use self::core::num::Wrapping;
|
||||
pub use self::core::ops::{Bound, Range, RangeFrom, RangeInclusive, RangeTo};
|
||||
pub use self::core::result;
|
||||
pub use self::core::time::Duration;
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
// For alloc types: use alloc when std is not available OR on target_os = "none"
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::borrow::{Cow, ToOwned};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::borrow::{Cow, ToOwned};
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::string::{String, ToString};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::string::{String, ToString};
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::vec::Vec;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::vec::Vec;
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::boxed::Box;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::boxed::Box;
|
||||
|
||||
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "rc", feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::rc::{Rc, Weak as RcWeak};
|
||||
#[cfg(all(feature = "rc", feature = "std"))]
|
||||
#[cfg(all(feature = "rc", feature = "std", not(target_os = "none")))]
|
||||
pub use std::rc::{Rc, Weak as RcWeak};
|
||||
|
||||
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "rc", feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::sync::{Arc, Weak as ArcWeak};
|
||||
#[cfg(all(feature = "rc", feature = "std"))]
|
||||
#[cfg(all(feature = "rc", feature = "std", not(target_os = "none")))]
|
||||
pub use std::sync::{Arc, Weak as ArcWeak};
|
||||
|
||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
|
||||
|
||||
#[cfg(all(not(no_core_cstr), not(feature = "std")))]
|
||||
#[cfg(all(not(no_core_cstr), any(not(feature = "std"), target_os = "none")))]
|
||||
pub use self::core::ffi::CStr;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::ffi::CStr;
|
||||
|
||||
#[cfg(all(not(no_core_cstr), feature = "alloc", not(feature = "std")))]
|
||||
#[cfg(all(not(no_core_cstr), feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
pub use alloc::ffi::CString;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::ffi::CString;
|
||||
|
||||
#[cfg(all(not(no_core_net), not(feature = "std")))]
|
||||
#[cfg(all(not(no_core_net), any(not(feature = "std"), target_os = "none")))]
|
||||
pub use self::core::net;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::net;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
// std-only types - not available on target_os = "none"
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::error;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::collections::{HashMap, HashSet};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::ffi::{OsStr, OsString};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::hash::{BuildHasher, Hash};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::io::Write;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::path::{Path, PathBuf};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::sync::{Mutex, RwLock};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
pub use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), no_target_has_atomic, not(no_std_atomic)))]
|
||||
pub use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32,
|
||||
AtomicU8, AtomicUsize, Ordering,
|
||||
};
|
||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), no_target_has_atomic, not(no_std_atomic64)))]
|
||||
pub use std::sync::atomic::{AtomicI64, AtomicU64};
|
||||
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic)))]
|
||||
pub use std::sync::atomic::Ordering;
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "8"))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic), target_has_atomic = "8"))]
|
||||
pub use std::sync::atomic::{AtomicBool, AtomicI8, AtomicU8};
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "16"))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic), target_has_atomic = "16"))]
|
||||
pub use std::sync::atomic::{AtomicI16, AtomicU16};
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "32"))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic), target_has_atomic = "32"))]
|
||||
pub use std::sync::atomic::{AtomicI32, AtomicU32};
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "64"))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic), target_has_atomic = "64"))]
|
||||
pub use std::sync::atomic::{AtomicI64, AtomicU64};
|
||||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "ptr"))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_target_has_atomic), target_has_atomic = "ptr"))]
|
||||
pub use std::sync::atomic::{AtomicIsize, AtomicUsize};
|
||||
|
||||
#[cfg(not(no_core_num_saturating))]
|
||||
@@ -132,12 +166,12 @@ macro_rules! crate_root {
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg_attr(no_serde_core, path = "core/de/mod.rs")]
|
||||
#[cfg_attr(all(docsrs, if_docsrs_then_no_serde_core), path = "core/de/mod.rs")]
|
||||
pub mod de;
|
||||
#[cfg_attr(no_serde_core, path = "core/ser/mod.rs")]
|
||||
#[cfg_attr(all(docsrs, if_docsrs_then_no_serde_core), path = "core/ser/mod.rs")]
|
||||
pub mod ser;
|
||||
|
||||
#[cfg_attr(no_serde_core, path = "core/format.rs")]
|
||||
#[cfg_attr(all(docsrs, if_docsrs_then_no_serde_core), path = "core/format.rs")]
|
||||
mod format;
|
||||
|
||||
#[doc(inline)]
|
||||
@@ -147,7 +181,10 @@ macro_rules! crate_root {
|
||||
|
||||
// Used by generated code. Not public API.
|
||||
#[doc(hidden)]
|
||||
#[cfg_attr(no_serde_core, path = "core/private/mod.rs")]
|
||||
#[cfg_attr(
|
||||
all(docsrs, if_docsrs_then_no_serde_core),
|
||||
path = "core/private/mod.rs"
|
||||
)]
|
||||
mod private;
|
||||
|
||||
// Used by declarative macro generated code. Not public API.
|
||||
@@ -161,8 +198,8 @@ macro_rules! crate_root {
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/private.rs"));
|
||||
|
||||
#[cfg(all(not(feature = "std"), no_core_error))]
|
||||
#[cfg_attr(no_serde_core, path = "core/std_error.rs")]
|
||||
#[cfg(all(any(not(feature = "std"), target_os = "none"), no_core_error))]
|
||||
#[cfg_attr(all(docsrs, if_docsrs_then_no_serde_core), path = "core/std_error.rs")]
|
||||
mod std_error;
|
||||
};
|
||||
}
|
||||
|
||||
+23
-22
@@ -226,12 +226,13 @@ macro_rules! num_as_copysign_self {
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
#[cfg(not(feature = "std"))]
|
||||
// On no_std or wasm32v1-none (target_os = "none"), use simple cast
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
{
|
||||
Ok(v as Self::Value)
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
{
|
||||
// Preserve sign of NaN. The `as` produces a nondeterministic sign.
|
||||
let sign = if v.is_sign_positive() { 1.0 } else { -1.0 };
|
||||
@@ -1107,7 +1108,7 @@ seq_impl!(
|
||||
);
|
||||
|
||||
seq_impl!(
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
HashSet<T: Eq + Hash, S: BuildHasher + Default>,
|
||||
seq,
|
||||
@@ -1563,7 +1564,7 @@ map_impl! {
|
||||
}
|
||||
|
||||
map_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
|
||||
map,
|
||||
@@ -1781,10 +1782,10 @@ parse_socket_impl! {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
struct PathVisitor;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
impl<'a> Visitor<'a> for PathVisitor {
|
||||
type Value = &'a Path;
|
||||
|
||||
@@ -1809,7 +1810,7 @@ impl<'a> Visitor<'a> for PathVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<'de: 'a, 'a> Deserialize<'de> for &'a Path {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
@@ -1820,10 +1821,10 @@ impl<'de: 'a, 'a> Deserialize<'de> for &'a Path {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
struct PathBufVisitor;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
impl<'de> Visitor<'de> for PathBufVisitor {
|
||||
type Value = PathBuf;
|
||||
|
||||
@@ -1864,7 +1865,7 @@ impl<'de> Visitor<'de> for PathBufVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<'de> Deserialize<'de> for PathBuf {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
@@ -1876,7 +1877,7 @@ impl<'de> Deserialize<'de> for PathBuf {
|
||||
}
|
||||
|
||||
forwarded_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
(), Box<Path>, PathBuf::into_boxed_path
|
||||
}
|
||||
@@ -1887,17 +1888,17 @@ forwarded_impl! {
|
||||
//
|
||||
// #[derive(Deserialize)]
|
||||
// #[serde(variant_identifier)]
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
variant_identifier! {
|
||||
OsStringKind (Unix; b"Unix"; 0, Windows; b"Windows"; 1)
|
||||
"`Unix` or `Windows`",
|
||||
OSSTR_VARIANTS
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
struct OsStringVisitor;
|
||||
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
impl<'de> Visitor<'de> for OsStringVisitor {
|
||||
type Value = OsString;
|
||||
|
||||
@@ -1938,7 +1939,7 @@ impl<'de> Visitor<'de> for OsStringVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))]
|
||||
impl<'de> Deserialize<'de> for OsString {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
@@ -1970,7 +1971,7 @@ forwarded_impl! {
|
||||
}
|
||||
|
||||
forwarded_impl! {
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))]
|
||||
(), Box<OsStr>, OsString::into_boxed_os_str
|
||||
}
|
||||
@@ -2105,13 +2106,13 @@ forwarded_impl! {
|
||||
}
|
||||
|
||||
forwarded_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
(T), Mutex<T>, Mutex::new
|
||||
}
|
||||
|
||||
forwarded_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
(T), RwLock<T>, RwLock::new
|
||||
}
|
||||
@@ -2266,7 +2267,7 @@ impl<'de> Deserialize<'de> for Duration {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<'de> Deserialize<'de> for SystemTime {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
@@ -3099,7 +3100,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic)))]
|
||||
macro_rules! atomic_impl {
|
||||
($($ty:ident $size:expr)*) => {
|
||||
$(
|
||||
@@ -3117,7 +3118,7 @@ macro_rules! atomic_impl {
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic)))]
|
||||
atomic_impl! {
|
||||
AtomicBool "8"
|
||||
AtomicI8 "8"
|
||||
@@ -3130,7 +3131,7 @@ atomic_impl! {
|
||||
AtomicUsize "ptr"
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic64)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic64)))]
|
||||
atomic_impl! {
|
||||
AtomicI64 "64"
|
||||
AtomicU64 "64"
|
||||
|
||||
@@ -122,13 +122,13 @@ mod ignored_any;
|
||||
mod impls;
|
||||
|
||||
pub use self::ignored_any::IgnoredAny;
|
||||
#[cfg(all(not(feature = "std"), no_core_error))]
|
||||
#[cfg(all(any(not(feature = "std"), target_os = "none"), no_core_error))]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::std_error::Error as StdError;
|
||||
#[cfg(not(any(feature = "std", no_core_error)))]
|
||||
#[cfg(all(any(not(feature = "std"), target_os = "none"), not(no_core_error)))]
|
||||
#[doc(no_inline)]
|
||||
pub use core::error::Error as StdError;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[doc(no_inline)]
|
||||
pub use std::error::Error as StdError;
|
||||
|
||||
@@ -300,10 +300,10 @@ macro_rules! declare_error_trait {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
declare_error_trait!(Error: Sized + StdError);
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
declare_error_trait!(Error: Sized + Debug + Display);
|
||||
|
||||
/// `Unexpected` represents an unexpected invocation of any one of the `Visitor`
|
||||
|
||||
@@ -112,7 +112,7 @@ impl Debug for Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
@@ -1160,7 +1160,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet<T, S>
|
||||
where
|
||||
@@ -1588,7 +1588,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>
|
||||
where
|
||||
|
||||
+10
-4
@@ -35,9 +35,11 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde_core/1.0.227")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_core/1.0.228")]
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// Also force no_std on target_os = "none" (wasm32v1-none) even if std feature is enabled
|
||||
// This handles Cargo feature unification where std gets enabled for no_std targets
|
||||
#![cfg_attr(any(not(feature = "std"), target_os = "none"), no_std)]
|
||||
// Show which crate feature enables conditionally compiled APIs in documentation.
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, rustdoc_internals))]
|
||||
#![cfg_attr(docsrs, allow(internal_features))]
|
||||
@@ -54,7 +56,7 @@
|
||||
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
// not available in our oldest supported compiler
|
||||
clippy::empty_enum,
|
||||
clippy::empty_enums,
|
||||
clippy::type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
|
||||
// integer and float ser/de requires these sorts of casts
|
||||
clippy::cast_possible_truncation,
|
||||
@@ -100,9 +102,13 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
#[cfg(all(feature = "alloc", any(not(feature = "std"), target_os = "none")))]
|
||||
extern crate alloc;
|
||||
|
||||
// Explicitly import core crate for no_std targets (especially wasm32v1-none)
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate core;
|
||||
|
||||
#[macro_use]
|
||||
mod crate_root;
|
||||
#[macro_use]
|
||||
|
||||
@@ -18,7 +18,7 @@ impl ser::Error for Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(not(no_diagnostic_namespace), diagnostic::do_not_recommend)]
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::lib::*;
|
||||
|
||||
use crate::ser::{Error, Impossible, Serialize, Serializer};
|
||||
|
||||
impl Error for fmt::Error {
|
||||
|
||||
+12
-12
@@ -219,7 +219,7 @@ seq_impl! {
|
||||
}
|
||||
|
||||
seq_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
HashSet<T, H: BuildHasher>
|
||||
}
|
||||
@@ -450,7 +450,7 @@ map_impl! {
|
||||
}
|
||||
|
||||
map_impl! {
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
HashMap<K: Eq + Hash, V, H: BuildHasher>
|
||||
}
|
||||
@@ -624,7 +624,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<T> Serialize for Mutex<T>
|
||||
where
|
||||
@@ -641,7 +641,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl<T> Serialize for RwLock<T>
|
||||
where
|
||||
@@ -697,7 +697,7 @@ impl Serialize for Duration {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl Serialize for SystemTime {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
@@ -903,7 +903,7 @@ impl Serialize for net::SocketAddrV6 {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl Serialize for Path {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
@@ -917,7 +917,7 @@ impl Serialize for Path {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
impl Serialize for PathBuf {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
@@ -928,7 +928,7 @@ impl Serialize for PathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))]
|
||||
impl Serialize for OsStr {
|
||||
#[cfg(unix)]
|
||||
@@ -951,7 +951,7 @@ impl Serialize for OsStr {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", any(unix, windows)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), any(unix, windows)))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))]
|
||||
impl Serialize for OsString {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
@@ -1006,7 +1006,7 @@ where
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic)))]
|
||||
macro_rules! atomic_impl {
|
||||
($($ty:ident $size:expr)*) => {
|
||||
$(
|
||||
@@ -1025,7 +1025,7 @@ macro_rules! atomic_impl {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic)))]
|
||||
atomic_impl! {
|
||||
AtomicBool "8"
|
||||
AtomicI8 "8"
|
||||
@@ -1038,7 +1038,7 @@ atomic_impl! {
|
||||
AtomicUsize "ptr"
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", not(no_std_atomic64)))]
|
||||
#[cfg(all(feature = "std", not(target_os = "none"), not(no_std_atomic64)))]
|
||||
atomic_impl! {
|
||||
AtomicI64 "64"
|
||||
AtomicU64 "64"
|
||||
|
||||
@@ -115,13 +115,13 @@ mod impossible;
|
||||
|
||||
pub use self::impossible::Impossible;
|
||||
|
||||
#[cfg(all(not(feature = "std"), no_core_error))]
|
||||
#[cfg(all(any(not(feature = "std"), target_os = "none"), no_core_error))]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::std_error::Error as StdError;
|
||||
#[cfg(not(any(feature = "std", no_core_error)))]
|
||||
#[cfg(all(any(not(feature = "std"), target_os = "none"), not(no_core_error)))]
|
||||
#[doc(no_inline)]
|
||||
pub use core::error::Error as StdError;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
#[doc(no_inline)]
|
||||
pub use std::error::Error as StdError;
|
||||
|
||||
@@ -188,10 +188,10 @@ macro_rules! declare_error_trait {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", not(target_os = "none")))]
|
||||
declare_error_trait!(Error: Sized + StdError);
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[cfg(any(not(feature = "std"), target_os = "none"))]
|
||||
declare_error_trait!(Error: Sized + Debug + Display);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.227"
|
||||
version = "1.0.228"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
categories = ["no-std", "no-std::no-alloc"]
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
@@ -12,7 +12,7 @@ keywords = ["serde", "serialization", "no_std", "derive"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "crates-io.md"
|
||||
repository = "https://github.com/serde-rs/serde"
|
||||
rust-version = "1.61"
|
||||
rust-version = "1.68"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -26,9 +26,9 @@ pub fn expand_derive_deserialize(input: &mut syn::DeriveInput) -> syn::Result<To
|
||||
replace_receiver(input);
|
||||
|
||||
let ctxt = Ctxt::new();
|
||||
let cont = match Container::from_ast(&ctxt, input, Derive::Deserialize, &private.ident()) {
|
||||
Some(cont) => cont,
|
||||
None => return Err(ctxt.check().unwrap_err()),
|
||||
let Some(cont) = Container::from_ast(&ctxt, input, Derive::Deserialize, &private.ident())
|
||||
else {
|
||||
return Err(ctxt.check().unwrap_err());
|
||||
};
|
||||
precondition(&ctxt, &cont);
|
||||
ctxt.check()?;
|
||||
@@ -594,13 +594,16 @@ fn deserialize_seq_in_place(
|
||||
let (wrapper, wrapper_ty) = wrap_deserialize_field_with(params, field.ty, path);
|
||||
quote!({
|
||||
#wrapper
|
||||
match _serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut __seq)? {
|
||||
_serde::#private::Some(__wrap) => {
|
||||
match _serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut __seq) {
|
||||
_serde::#private::Ok(_serde::#private::Some(__wrap)) => {
|
||||
self.place.#member = __wrap.value;
|
||||
}
|
||||
_serde::#private::None => {
|
||||
_serde::#private::Ok(_serde::#private::None) => {
|
||||
#value_if_none;
|
||||
}
|
||||
_serde::#private::Err(__err) => {
|
||||
return _serde::#private::Err(__err);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -282,8 +282,8 @@ pub(super) fn deserialize(
|
||||
__A: _serde::de::SeqAccess<#delife>,
|
||||
{
|
||||
// Visit the first element - the tag.
|
||||
match _serde::de::SeqAccess::next_element(&mut __seq)? {
|
||||
_serde::#private::Some(__variant) => {
|
||||
match _serde::de::SeqAccess::next_element(&mut __seq) {
|
||||
_serde::#private::Ok(_serde::#private::Some(__variant)) => {
|
||||
// Visit the second element - the content.
|
||||
match _serde::de::SeqAccess::next_element_seed(
|
||||
&mut __seq,
|
||||
@@ -292,18 +292,20 @@ pub(super) fn deserialize(
|
||||
marker: _serde::#private::PhantomData,
|
||||
lifetime: _serde::#private::PhantomData,
|
||||
},
|
||||
)? {
|
||||
_serde::#private::Some(__ret) => _serde::#private::Ok(__ret),
|
||||
) {
|
||||
_serde::#private::Ok(_serde::#private::Some(__ret)) => _serde::#private::Ok(__ret),
|
||||
// There is no second element.
|
||||
_serde::#private::None => {
|
||||
_serde::#private::Ok(_serde::#private::None) => {
|
||||
_serde::#private::Err(_serde::de::Error::invalid_length(1, &self))
|
||||
}
|
||||
_serde::#private::Err(__err) => _serde::#private::Err(__err),
|
||||
}
|
||||
}
|
||||
// There is no first element.
|
||||
_serde::#private::None => {
|
||||
_serde::#private::Ok(_serde::#private::None) => {
|
||||
_serde::#private::Err(_serde::de::Error::invalid_length(0, &self))
|
||||
}
|
||||
_serde::#private::Err(__err) => _serde::#private::Err(__err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ pub(super) fn deserialize(
|
||||
));
|
||||
|
||||
quote! {
|
||||
(__Field::#variant_name, __variant) => #block
|
||||
_serde::#private::Ok((__Field::#variant_name, __variant)) => #block
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,8 +69,9 @@ pub(super) fn deserialize(
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
match _serde::de::EnumAccess::variant(__data)? {
|
||||
match _serde::de::EnumAccess::variant(__data) {
|
||||
#(#variant_arms)*
|
||||
_serde::#private::Err(__err) => _serde::#private::Err(__err),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1185,13 +1185,11 @@ impl Field {
|
||||
}
|
||||
}
|
||||
|
||||
// Is skip_deserializing, initialize the field to Default::default() unless a
|
||||
// If skip_deserializing, initialize the field to Default::default() unless a
|
||||
// different default is specified by `#[serde(default = "...")]` on
|
||||
// ourselves or our container (e.g. the struct we are in).
|
||||
if let Default::None = *container_default {
|
||||
if skip_deserializing.0.value.is_some() {
|
||||
default.set_if_none(Default::Default);
|
||||
}
|
||||
if container_default.is_none() && skip_deserializing.0.value.is_some() {
|
||||
default.set_if_none(Default::Default);
|
||||
}
|
||||
|
||||
let mut borrowed_lifetimes = borrowed_lifetimes.get().unwrap_or_default();
|
||||
@@ -1459,9 +1457,8 @@ fn parse_lit_into_path(
|
||||
attr_name: Symbol,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<Option<syn::Path>> {
|
||||
let string = match get_lit_str(cx, attr_name, meta)? {
|
||||
Some(string) => string,
|
||||
None => return Ok(None),
|
||||
let Some(string) = get_lit_str(cx, attr_name, meta)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(match string.parse() {
|
||||
@@ -1481,9 +1478,8 @@ fn parse_lit_into_expr_path(
|
||||
attr_name: Symbol,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<Option<syn::ExprPath>> {
|
||||
let string = match get_lit_str(cx, attr_name, meta)? {
|
||||
Some(string) => string,
|
||||
None => return Ok(None),
|
||||
let Some(string) = get_lit_str(cx, attr_name, meta)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(match string.parse() {
|
||||
@@ -1504,9 +1500,8 @@ fn parse_lit_into_where(
|
||||
meta_item_name: Symbol,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<Vec<syn::WherePredicate>> {
|
||||
let string = match get_lit_str2(cx, attr_name, meta_item_name, meta)? {
|
||||
Some(string) => string,
|
||||
None => return Ok(Vec::new()),
|
||||
let Some(string) = get_lit_str2(cx, attr_name, meta_item_name, meta)? else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
|
||||
Ok(
|
||||
@@ -1525,9 +1520,8 @@ fn parse_lit_into_ty(
|
||||
attr_name: Symbol,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<Option<syn::Type>> {
|
||||
let string = match get_lit_str(cx, attr_name, meta)? {
|
||||
Some(string) => string,
|
||||
None => return Ok(None),
|
||||
let Some(string) = get_lit_str(cx, attr_name, meta)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(match string.parse() {
|
||||
@@ -1548,9 +1542,8 @@ fn parse_lit_into_lifetimes(
|
||||
cx: &Ctxt,
|
||||
meta: &ParseNestedMeta,
|
||||
) -> syn::Result<BTreeSet<syn::Lifetime>> {
|
||||
let string = match get_lit_str(cx, BORROW, meta)? {
|
||||
Some(string) => string,
|
||||
None => return Ok(BTreeSet::new()),
|
||||
let Some(string) = get_lit_str(cx, BORROW, meta)? else {
|
||||
return Ok(BTreeSet::new());
|
||||
};
|
||||
|
||||
if let Ok(lifetimes) = string.parse_with(|input: ParseStream| {
|
||||
@@ -1620,11 +1613,8 @@ fn is_cow(ty: &syn::Type, elem: fn(&syn::Type) -> bool) -> bool {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let seg = match path.segments.last() {
|
||||
Some(seg) => seg,
|
||||
None => {
|
||||
return false;
|
||||
}
|
||||
let Some(seg) = path.segments.last() else {
|
||||
return false;
|
||||
};
|
||||
let args = match &seg.arguments {
|
||||
syn::PathArguments::AngleBracketed(bracketed) => &bracketed.args,
|
||||
@@ -1647,11 +1637,8 @@ fn is_option(ty: &syn::Type, elem: fn(&syn::Type) -> bool) -> bool {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let seg = match path.segments.last() {
|
||||
Some(seg) => seg,
|
||||
None => {
|
||||
return false;
|
||||
}
|
||||
let Some(seg) = path.segments.last() else {
|
||||
return false;
|
||||
};
|
||||
let args = match &seg.arguments {
|
||||
syn::PathArguments::AngleBracketed(bracketed) => &bracketed.args,
|
||||
|
||||
@@ -46,9 +46,8 @@ impl Ctxt {
|
||||
pub fn check(self) -> syn::Result<()> {
|
||||
let mut errors = self.errors.borrow_mut().take().unwrap().into_iter();
|
||||
|
||||
let mut combined = match errors.next() {
|
||||
Some(first) => first,
|
||||
None => return Ok(()),
|
||||
let Some(mut combined) = errors.next() else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
for rest in errors {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.227")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.228")]
|
||||
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
|
||||
// Ignored clippy lints
|
||||
#![allow(
|
||||
|
||||
@@ -13,9 +13,8 @@ pub fn expand_derive_serialize(input: &mut syn::DeriveInput) -> syn::Result<Toke
|
||||
replace_receiver(input);
|
||||
|
||||
let ctxt = Ctxt::new();
|
||||
let cont = match Container::from_ast(&ctxt, input, Derive::Serialize, &private.ident()) {
|
||||
Some(cont) => cont,
|
||||
None => return Err(ctxt.check().unwrap_err()),
|
||||
let Some(cont) = Container::from_ast(&ctxt, input, Derive::Serialize, &private.ident()) else {
|
||||
return Err(ctxt.check().unwrap_err());
|
||||
};
|
||||
precondition(&ctxt, &cont);
|
||||
ctxt.check()?;
|
||||
|
||||
@@ -10,7 +10,7 @@ homepage = "https://serde.rs"
|
||||
keywords = ["serde", "serialization"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/serde-rs/serde"
|
||||
rust-version = "1.61"
|
||||
rust-version = "1.68"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
clippy::cast_lossless,
|
||||
clippy::decimal_literal_representation,
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::empty_enum,
|
||||
clippy::empty_enums,
|
||||
clippy::manual_assert,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::uninlined_format_args,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::empty_enum,
|
||||
clippy::empty_enums,
|
||||
clippy::unreadable_literal
|
||||
)]
|
||||
#![cfg_attr(feature = "unstable", feature(never_type))]
|
||||
|
||||
@@ -11,7 +11,7 @@ struct T0(u8, u8);
|
||||
struct T1(u8, #[serde(default)] u8);
|
||||
|
||||
// ERROR: The first field can get default value only if sequence is empty, but
|
||||
// that mean that all other fields cannot be deserialized without errors.
|
||||
// that means that all other fields cannot be deserialized without errors.
|
||||
#[derive(Deserialize)]
|
||||
struct T2(#[serde(default)] u8, u8, u8);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ fn d<T>() -> T {
|
||||
struct T1(u8, #[serde(default = "d")] u8);
|
||||
|
||||
// ERROR: The first field can get default value only if sequence is empty, but
|
||||
// that mean that all other fields cannot be deserialized without errors.
|
||||
// that means that all other fields cannot be deserialized without errors.
|
||||
#[derive(Deserialize)]
|
||||
struct T2(#[serde(default = "d")] u8, u8, u8);
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ error[E0277]: the trait bound `&u8: serde::Serializer` is not satisfied
|
||||
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||
| --- required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
--> $WORKSPACE/serde_core/src/ser/fmt.rs
|
||||
|
|
||||
| impl<'a> Serializer for &mut fmt::Formatter<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `w::serialize`
|
||||
--> tests/ui/with/incorrect_type.rs:9:28
|
||||
|
|
||||
@@ -33,7 +37,11 @@ error[E0277]: the trait bound `&u8: serde::Serializer` is not satisfied
|
||||
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||
| ^^^ the trait `Serializer` is not implemented for `&u8`
|
||||
|
|
||||
= help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
--> $WORKSPACE/serde_core/src/ser/fmt.rs
|
||||
|
|
||||
| impl<'a> Serializer for &mut fmt::Formatter<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: `?` operator has incompatible types
|
||||
--> tests/ui/with/incorrect_type.rs:15:25
|
||||
@@ -51,7 +59,11 @@ error[E0277]: the trait bound `&u8: serde::Serializer` is not satisfied
|
||||
18 | struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||
| -------------- required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
--> $WORKSPACE/serde_core/src/ser/fmt.rs
|
||||
|
|
||||
| impl<'a> Serializer for &mut fmt::Formatter<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `w::serialize`
|
||||
--> tests/ui/with/incorrect_type.rs:9:28
|
||||
|
|
||||
@@ -78,7 +90,11 @@ error[E0277]: the trait bound `&u8: serde::Serializer` is not satisfied
|
||||
18 | struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||
| ^^^^^^^^^^^^^^ the trait `Serializer` is not implemented for `&u8`
|
||||
|
|
||||
= help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
help: the trait `Serializer` is implemented for `&mut Formatter<'a>`
|
||||
--> $WORKSPACE/serde_core/src/ser/fmt.rs
|
||||
|
|
||||
| impl<'a> Serializer for &mut fmt::Formatter<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: `?` operator has incompatible types
|
||||
--> tests/ui/with/incorrect_type.rs:21:37
|
||||
|
||||
Reference in New Issue
Block a user