- Fix incorrect deserialization of variants that doesn't contain flatten field when other contains
- Fix a panic when deriving `Deserialize` for an enum with tuple and struct with flatten field
Fixes (2):
regression::issue2565::simple_variant
regression::issue1904 (compilation)
error: found both `σ` and `o` as identifiers, which look alike
--> test_suite/tests/test_gen.rs:734:13
|
292 | σ: f64,
| - other identifier used here
...
734 | o: T,
| ^ this identifier can be confused with `σ`
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(confusable_idents)]` implied by `#[deny(warnings)]`
error: collection is never read
--> test_suite/tests/test_gen.rs:728:25
|
728 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: collection is never read
--> test_suite/tests/test_gen.rs:722:25
|
722 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:22:9
|
22 | #![deny(clippy::collection_is_never_read)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
The test suite's dependencies cannot be resolved by an old toolchain.
error: failed to select a version for the requirement `toml = "^0.8"`
candidate versions found which didn't match: 0.5.11, 0.5.10, 0.5.9, ...
location searched: crates.io index
required by package `trybuild v1.0.97`
... which satisfies dependency `trybuild = "^1.0.97"` of package `serde_test_suite v0.0.0`
This change enables the `#[diagnostic::on_unimplemented]` attribute for
the `Serialize` and `Deserialize` trait to point the user to the
relevant derives and point out that they might want to check crates
features for external types by adding the relevant hints an note.
warning: the feature `error_in_core` has been stable since 1.81.0-nightly and no longer requires an attribute to enable
--> serde/src/lib.rs:108:43
|
108 | #![cfg_attr(feature = "unstable", feature(error_in_core, never_type))]
| ^^^^^^^^^^^^^
|
= note: `#[warn(stable_features)]` on by default
warning: unexpected `cfg` condition name: `serde_build_from_git`
--> serde_derive_internals/lib.rs:45:12
|
45 | #[cfg_attr(serde_build_from_git, path = "../serde_derive/src/internals/mod.rs")]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(serde_build_from_git)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `serde_build_from_git`
--> serde_derive_internals/lib.rs:46:16
|
46 | #[cfg_attr(not(serde_build_from_git), path = "src/mod.rs")]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(serde_build_from_git)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `deserialize_in_place`
--> serde_derive_internals/src/attr.rs:276:11
|
276 | #[cfg(feature = "deserialize_in_place")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
|
= note: no expected values for `feature`
= help: consider adding `deserialize_in_place` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/attr.rs:1797:31
|
1797 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:110:35
|
110 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:181:47
|
181 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:210:35
|
210 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:231:43
|
231 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/lib.rs:62:23
|
62 | #![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]
| ^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/attr.rs:1797:31
|
1797 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:110:35
|
110 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:181:47
|
181 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:210:35
|
210 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:231:43
|
231 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:147:39
|
147 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:199:51
|
199 | ... #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:228:39
|
228 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `systemtime_checked_add`
--> test_suite/tests/test_de_error.rs:1527:7
|
1527 | #[cfg(systemtime_checked_add)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(systemtime_checked_add)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
bef110b92a changed the display for unexpected floats to always append a
".0" if there was no decimal point found in the formatting of the float.
However, this should only be relevant for finite (i.e., not NaN or inf)
values. The change introduced a test failure in the ordered-float
crate due to this:
---- impl_serde::test_fail_on_nan stdout ----
thread 'impl_serde::test_fail_on_nan' panicked at 'assertion failed: `(left == right)`
left: `Error { msg: "invalid value: floating point `NaN.0`, expected float (but not NaN)" }`,
right: `"invalid value: floating point `NaN`, expected float (but not NaN)"`', src/lib.rs:1554:9
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.70.0/library/std/src/panicking.rs:578:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:67:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:228:5
4: serde_test::assert::assert_de_tokens_error
at /usr/share/cargo/registry/serde_test-1.0.171/src/assert.rs:228:19
5: ordered_float::impl_serde::test_fail_on_nan
at ./src/lib.rs:1554:9
6: ordered_float::impl_serde::test_fail_on_nan::{{closure}}
at ./src/lib.rs:1553:27
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
457 | / impl_deserialize_num! {
458 | | f32, deserialize_f32
459 | | num_self!(f32:visit_f32);
460 | | num_as_copysign_self!(f64:visit_f64);
461 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
462 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
463 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: `-W clippy::cast-precision-loss` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_precision_loss)]`
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
457 | / impl_deserialize_num! {
458 | | f32, deserialize_f32
459 | | num_self!(f32:visit_f32);
460 | | num_as_copysign_self!(f64:visit_f64);
461 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
462 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
463 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: casting `u32` to `f32` causes a loss of precision (`u32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
457 | / impl_deserialize_num! {
458 | | f32, deserialize_f32
459 | | num_self!(f32:visit_f32);
460 | | num_as_copysign_self!(f64:visit_f64);
461 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
462 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
463 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: casting `u64` to `f32` causes a loss of precision (`u64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
457 | / impl_deserialize_num! {
458 | | f32, deserialize_f32
459 | | num_self!(f32:visit_f32);
460 | | num_as_copysign_self!(f64:visit_f64);
461 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
462 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
463 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: casting `i64` to `f64` causes a loss of precision (`i64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
465 | / impl_deserialize_num! {
466 | | f64, deserialize_f64
467 | | num_self!(f64:visit_f64);
468 | | num_as_copysign_self!(f32:visit_f32);
469 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
470 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
471 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: casting `u64` to `f64` causes a loss of precision (`u64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
--> serde/src/de/impls.rs:197:16
|
197 | Ok(v as Self::Value)
| ^^^^^^^^^^^^^^^^
...
465 | / impl_deserialize_num! {
466 | | f64, deserialize_f64
467 | | num_self!(f64:visit_f64);
468 | | num_as_copysign_self!(f32:visit_f32);
469 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
470 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
471 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_precision_loss
= note: this warning originates in the macro `num_as_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)