diff options
Diffstat (limited to 'vendor/serde/src/ser')
-rw-r--r-- | vendor/serde/src/ser/impls.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/vendor/serde/src/ser/impls.rs b/vendor/serde/src/ser/impls.rs index 7219f51b7..8e8655582 100644 --- a/vendor/serde/src/ser/impls.rs +++ b/vendor/serde/src/ser/impls.rs @@ -522,7 +522,7 @@ where } } -impl<T> Serialize for RefCell<T> +impl<T: ?Sized> Serialize for RefCell<T> where T: Serialize, { @@ -538,7 +538,7 @@ where } #[cfg(feature = "std")] -impl<T> Serialize for Mutex<T> +impl<T: ?Sized> Serialize for Mutex<T> where T: Serialize, { @@ -554,7 +554,7 @@ where } #[cfg(feature = "std")] -impl<T> Serialize for RwLock<T> +impl<T: ?Sized> Serialize for RwLock<T> where T: Serialize, { @@ -614,9 +614,10 @@ impl Serialize for SystemTime { S: Serializer, { use super::SerializeStruct; - let duration_since_epoch = self - .duration_since(UNIX_EPOCH) - .map_err(|_| S::Error::custom("SystemTime must be later than UNIX_EPOCH"))?; + let duration_since_epoch = match self.duration_since(UNIX_EPOCH) { + Ok(duration_since_epoch) => duration_since_epoch, + Err(_) => return Err(S::Error::custom("SystemTime must be later than UNIX_EPOCH")), + }; let mut state = try!(serializer.serialize_struct("SystemTime", 2)); try!(state.serialize_field("secs_since_epoch", &duration_since_epoch.as_secs())); try!(state.serialize_field("nanos_since_epoch", &duration_since_epoch.subsec_nanos())); @@ -916,7 +917,7 @@ macro_rules! atomic_impl { S: Serializer, { // Matches the atomic ordering used in libcore for the Debug impl - self.load(Ordering::SeqCst).serialize(serializer) + self.load(Ordering::Relaxed).serialize(serializer) } } )* |