From b5f8edc4aeba818ecf74ceedc145d3d81c121184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 30 Oct 2017 12:02:50 +0100 Subject: [PATCH] style: Unconditionally implement Debug for RefPtr. Bindgen doesn't know how to derive debug for a Gecko font family list. Hopefully it doesn't need to. Bug: 1412486 Reviewed-by: xidorn MozReview-Commit-ID: 4iZKzjad6K9 --- components/style/gecko_bindings/sugar/refptr.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/style/gecko_bindings/sugar/refptr.rs b/components/style/gecko_bindings/sugar/refptr.rs index adee2e8ea57..e8adc551768 100644 --- a/components/style/gecko_bindings/sugar/refptr.rs +++ b/components/style/gecko_bindings/sugar/refptr.rs @@ -7,7 +7,7 @@ use gecko_bindings::structs; use gecko_bindings::sugar::ownership::HasArcFFI; use servo_arc::Arc; -use std::{mem, ptr}; +use std::{fmt, mem, ptr}; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; @@ -25,12 +25,19 @@ pub unsafe trait ThreadSafeRefCounted: RefCounted {} /// A custom RefPtr implementation to take into account Drop semantics and /// a bit less-painful memory management. -#[derive(Debug)] pub struct RefPtr { ptr: *mut T, _marker: PhantomData, } +impl fmt::Debug for RefPtr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("RefPtr { ")?; + self.ptr.fmt(f)?; + f.write_str("}") + } +} + /// A RefPtr that we know is uniquely owned. /// /// This is basically Box, with the additional guarantee that the box can be