Implement Debug for Map and RawMap.

This commit is contained in:
Chris Morgan 2015-04-25 19:28:12 +10:00
parent 7606e75aa4
commit ecb4c45060
2 changed files with 11 additions and 8 deletions

View file

@ -116,15 +116,9 @@ pub trait IntoBox<A: ?Sized + UncheckedAnyExt>: Any {
macro_rules! implement {
($base:ident, $(+ $bounds:ident)*) => {
impl<'a> fmt::Debug for &'a ($base $(+ $bounds)*) {
impl fmt::Debug for $base $(+ $bounds)* {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad(stringify!(&($base $(+ $bounds)*)))
}
}
impl<'a> fmt::Debug for Box<$base $(+ $bounds)*> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad(stringify!(Box<$base $(+ $bounds)*>))
f.pad(stringify!($base $(+ $bounds)*))
}
}

View file

@ -427,10 +427,15 @@ mod tests {
fn assert_send<T: Send>() { }
fn assert_sync<T: Sync>() { }
fn assert_clone<T: Clone>() { }
fn assert_debug<T: ::std::fmt::Debug>() { }
assert_send::<Map<Any + Send>>();
assert_send::<Map<Any + Send + Sync>>();
assert_sync::<Map<Any + Sync>>();
assert_sync::<Map<Any + Send + Sync>>();
assert_debug::<Map<Any>>();
assert_debug::<Map<Any + Send>>();
assert_debug::<Map<Any + Sync>>();
assert_debug::<Map<Any + Send + Sync>>();
assert_send::<Map<CloneAny + Send>>();
assert_send::<Map<CloneAny + Send + Sync>>();
assert_sync::<Map<CloneAny + Sync>>();
@ -439,5 +444,9 @@ mod tests {
assert_clone::<Map<CloneAny + Send + Sync>>();
assert_clone::<Map<CloneAny + Sync>>();
assert_clone::<Map<CloneAny + Send + Sync>>();
assert_debug::<Map<CloneAny>>();
assert_debug::<Map<CloneAny + Send>>();
assert_debug::<Map<CloneAny + Sync>>();
assert_debug::<Map<CloneAny + Send + Sync>>();
}
}