From 8fa21e5e2752d9d396580cbac100dae27c579452 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 25 Oct 2023 20:20:07 -0700 Subject: [PATCH 1/2] Add test of NaN sign when deserializing to primitive --- tests/test_de.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_de.rs b/tests/test_de.rs index 44d10476..7c760872 100644 --- a/tests/test_de.rs +++ b/tests/test_de.rs @@ -450,6 +450,13 @@ fn test_numbers() { } } +#[test] +fn test_nan() { + // There is no negative NaN in YAML. + assert!(serde_yaml::from_str::(".nan").unwrap().is_sign_positive()); + assert!(serde_yaml::from_str::(".nan").unwrap().is_sign_positive()); +} + #[test] fn test_stateful() { struct Seed(i64); From 13e26103605bcc9a787f835b0b1b88ca58a5fb9f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 25 Oct 2023 20:20:14 -0700 Subject: [PATCH 2/2] Pull in serde NaN fix --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bf4fbfb9..b208d3ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.64" indexmap = "2" itoa = "1.0" ryu = "1.0" -serde = "1.0.139" +serde = "1.0.190" unsafe-libyaml = "0.2.7" [dev-dependencies]