From 98f1a247de77176f605c39e225f81c6e80d93727 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 7 May 2024 16:38:34 -0700 Subject: [PATCH 1/4] Resolve unexpected_cfgs warning warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/mod.rs:31:7 | 31 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = 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(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/mod.rs:34:7 | 34 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/large_powers.rs:5:7 | 5 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/large_powers.rs:8:7 | 8 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/math.rs:40:7 | 40 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/math.rs:43:7 | 43 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/math.rs:46:7 | 46 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/math.rs:49:7 | 49 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/math.rs:53:7 | 53 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/math.rs:56:7 | 56 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/math.rs:59:7 | 59 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/math.rs:62:7 | 62 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/math.rs:82:7 | 82 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/math.rs:89:7 | 89 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/small_powers.rs:6:7 | 6 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> src/lexical/small_powers.rs:12:7 | 12 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> src/lexical/small_powers.rs:18:7 | 18 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/mod.rs:31:7 | 31 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = 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(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/mod.rs:34:7 | 34 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/large_powers.rs:5:7 | 5 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/large_powers.rs:8:7 | 8 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/math.rs:40:7 | 40 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/math.rs:43:7 | 43 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/math.rs:46:7 | 46 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/math.rs:49:7 | 49 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/math.rs:53:7 | 53 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/math.rs:56:7 | 56 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/math.rs:59:7 | 59 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/math.rs:62:7 | 62 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/math.rs:82:7 | 82 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/math.rs:89:7 | 89 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/small_powers.rs:6:7 | 6 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/../src/lexical/small_powers.rs:12:7 | 12 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/../src/lexical/small_powers.rs:18:7 | 18 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_32` --> tests/lexical/math.rs:21:7 | 21 | #[cfg(limb_width_32)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_32)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `limb_width_64` --> tests/lexical/math.rs:26:7 | 26 | #[cfg(limb_width_64)] | ^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(limb_width_64)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration --- build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.rs b/build.rs index dd09e62a3..433ce12c1 100644 --- a/build.rs +++ b/build.rs @@ -3,6 +3,10 @@ use std::env; fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(integer128)"); + println!("cargo:rustc-check-cfg=cfg(limb_width_32)"); + println!("cargo:rustc-check-cfg=cfg(limb_width_64)"); + // Decide ideal limb width for arithmetic in the float parser. Refer to // src/lexical/math.rs for where this has an effect. let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); From fdf99c7c38c1ee48554eaea66b701f470544d037 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 7 May 2024 16:51:35 -0700 Subject: [PATCH 2/4] Combine number PartialEq tests --- build.rs | 1 - tests/test.rs | 32 ++++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/build.rs b/build.rs index 433ce12c1..f2124b43f 100644 --- a/build.rs +++ b/build.rs @@ -3,7 +3,6 @@ use std::env; fn main() { println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rustc-check-cfg=cfg(integer128)"); println!("cargo:rustc-check-cfg=cfg(limb_width_32)"); println!("cargo:rustc-check-cfg=cfg(limb_width_64)"); diff --git a/tests/test.rs b/tests/test.rs index 7e6adad76..16840660e 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2100,20 +2100,20 @@ fn issue_220() { assert_eq!(from_str::(r#"{"V": 0}"#).unwrap(), E::V(0)); } -macro_rules! number_partialeq_ok { - ($($n:expr)*) => { - $( - let value = to_value($n).unwrap(); - let s = $n.to_string(); - assert_eq!(value, $n); - assert_eq!($n, value); - assert_ne!(value, s); - )* - } -} - #[test] fn test_partialeq_number() { + macro_rules! number_partialeq_ok { + ($($n:expr)*) => { + $( + let value = to_value($n).unwrap(); + let s = $n.to_string(); + assert_eq!(value, $n); + assert_eq!($n, value); + assert_ne!(value, s); + )* + }; + } + number_partialeq_ok!(0 1 100 i8::MIN i8::MAX i16::MIN i16::MAX i32::MIN i32::MAX i64::MIN i64::MAX u8::MIN u8::MAX u16::MIN u16::MAX u32::MIN u32::MAX u64::MIN u64::MAX @@ -2122,13 +2122,9 @@ fn test_partialeq_number() { f32::consts::E f32::consts::PI f32::consts::LN_2 f32::consts::LOG2_E f64::consts::E f64::consts::PI f64::consts::LN_2 f64::consts::LOG2_E ); -} -#[test] -#[cfg(integer128)] -#[cfg(feature = "arbitrary_precision")] -fn test_partialeq_integer128() { - number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX) + #[cfg(feature = "arbitrary_precision")] + number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX); } #[test] From 4517c7a2d983a56aa403c651cabe2caf41136570 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 7 May 2024 17:00:26 -0700 Subject: [PATCH 3/4] PartialEq is not implemented between Value and 128-bit ints --- tests/test.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test.rs b/tests/test.rs index 16840660e..8c9af6b32 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2122,9 +2122,6 @@ fn test_partialeq_number() { f32::consts::E f32::consts::PI f32::consts::LN_2 f32::consts::LOG2_E f64::consts::E f64::consts::PI f64::consts::LN_2 f64::consts::LOG2_E ); - - #[cfg(feature = "arbitrary_precision")] - number_partialeq_ok!(i128::MIN i128::MAX u128::MIN u128::MAX); } #[test] From 0ae247ca63be75e6c7e6e0e9cd8916e618cf8f24 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 7 May 2024 17:05:54 -0700 Subject: [PATCH 4/4] Release 1.0.117 --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 61e6335da..4817ac7a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.116" +version = "1.0.117" authors = ["Erick Tryzelaar ", "David Tolnay "] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff --git a/src/lib.rs b/src/lib.rs index eabd169f5..475cd4475 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,7 +299,7 @@ //! [macro]: crate::json //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.116")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.117")] // Ignored clippy lints #![allow( clippy::collapsible_else_if,