From a8adac6b938fa63060f4cf7770a085f662a8bc59 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 19 Apr 2017 14:55:28 -0700 Subject: [PATCH] Document misuse of SerializeMap --- serde/src/ser/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index 54dac04e..6472909b 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -1639,6 +1639,11 @@ pub trait SerializeMap { T: Serialize; /// Serialize a map value. + /// + /// # Panics + /// + /// Calling `serialize_value` before `serialize_key` is incorrect and is + /// allowed to panic or produce bogus results. fn serialize_value(&mut self, value: &T) -> Result<(), Self::Error> where T: Serialize;