Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Update bindgen to 0.31.2. #19072

Merged
merged 4 commits into from Oct 31, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

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
  • Loading branch information
emilio committed Oct 31, 2017
commit b5f8edc4aeba818ecf74ceedc145d3d81c121184
@@ -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<T: RefCounted> {
ptr: *mut T,
_marker: PhantomData<T>,
}

impl<T: RefCounted> fmt::Debug for RefPtr<T> {
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<T>, with the additional guarantee that the box can be
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.