Replace NonZero<*{const,mut} _> with std::ptr::NonNull

This commit is contained in:
Simon Sapin 2018-01-22 13:05:38 +01:00
parent 52eda6082f
commit 10ec5a2bb0
11 changed files with 42 additions and 50 deletions

3
Cargo.lock generated
View file

@ -1455,7 +1455,6 @@ dependencies = [
"metrics 0.0.1", "metrics 0.0.1",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
"nonzero 0.0.1",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"profile_traits 0.0.1", "profile_traits 0.0.1",
"range 0.0.1", "range 0.0.1",
@ -2437,7 +2436,6 @@ dependencies = [
"mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
"nonzero 0.0.1",
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)",
"open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2496,7 +2494,6 @@ dependencies = [
"metrics 0.0.1", "metrics 0.0.1",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
"nonzero 0.0.1",
"profile_traits 0.0.1", "profile_traits 0.0.1",
"range 0.0.1", "range 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",

View file

@ -67,7 +67,7 @@ pub trait GetRawData {
impl<T: GetLayoutData> GetRawData for T { impl<T: GetLayoutData> GetRawData for T {
fn get_raw_data(&self) -> Option<&StyleAndLayoutData> { fn get_raw_data(&self) -> Option<&StyleAndLayoutData> {
self.get_style_and_layout_data().map(|opaque| { self.get_style_and_layout_data().map(|opaque| {
let container = opaque.ptr.get() as *mut StyleAndLayoutData; let container = opaque.ptr.as_ptr() as *mut StyleAndLayoutData;
unsafe { &*container } unsafe { &*container }
}) })
} }

View file

@ -10,7 +10,7 @@ name = "layout_thread"
path = "lib.rs" path = "lib.rs"
[features] [features]
unstable = ["parking_lot/nightly", "nonzero/unstable"] unstable = ["parking_lot/nightly"]
[dependencies] [dependencies]
app_units = "0.6" app_units = "0.6"
@ -30,7 +30,6 @@ malloc_size_of = { path = "../malloc_size_of" }
metrics = {path = "../metrics"} metrics = {path = "../metrics"}
msg = {path = "../msg"} msg = {path = "../msg"}
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
nonzero = {path = "../nonzero"}
parking_lot = "0.4" parking_lot = "0.4"
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
range = {path = "../range"} range = {path = "../range"}

View file

@ -36,7 +36,6 @@ use html5ever::{LocalName, Namespace};
use layout::data::StyleAndLayoutData; use layout::data::StyleAndLayoutData;
use layout::wrapper::GetRawData; use layout::wrapper::GetRawData;
use msg::constellation_msg::{BrowsingContextId, PipelineId}; use msg::constellation_msg::{BrowsingContextId, PipelineId};
use nonzero::NonZero;
use range::Range; use range::Range;
use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use script::layout_exports::{Document, Element, Node, Text}; use script::layout_exports::{Document, Element, Node, Text};
@ -59,6 +58,7 @@ use std::fmt;
use std::fmt::Debug; use std::fmt::Debug;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::ptr::NonNull;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use style::CaseSensitivityExt; use style::CaseSensitivityExt;
use style::applicable_declarations::ApplicableDeclarationBlock; use style::applicable_declarations::ApplicableDeclarationBlock;
@ -76,7 +76,7 @@ use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocke
use style::str::is_whitespace; use style::str::is_whitespace;
pub unsafe fn drop_style_and_layout_data(data: OpaqueStyleAndLayoutData) { pub unsafe fn drop_style_and_layout_data(data: OpaqueStyleAndLayoutData) {
let ptr = data.ptr.get() as *mut StyleData; let ptr = data.ptr.as_ptr() as *mut StyleData;
let non_opaque: *mut StyleAndLayoutData = ptr as *mut _; let non_opaque: *mut StyleAndLayoutData = ptr as *mut _;
let _ = Box::from_raw(non_opaque); let _ = Box::from_raw(non_opaque);
} }
@ -229,7 +229,7 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
let ptr: *mut StyleAndLayoutData = let ptr: *mut StyleAndLayoutData =
Box::into_raw(Box::new(StyleAndLayoutData::new())); Box::into_raw(Box::new(StyleAndLayoutData::new()));
let opaque = OpaqueStyleAndLayoutData { let opaque = OpaqueStyleAndLayoutData {
ptr: NonZero::new_unchecked(ptr as *mut StyleData), ptr: NonNull::new_unchecked(ptr as *mut StyleData),
}; };
self.init_style_and_layout_data(opaque); self.init_style_and_layout_data(opaque);
}; };
@ -450,7 +450,7 @@ impl<'le> TElement for ServoLayoutElement<'le> {
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>> { fn get_data(&self) -> Option<&AtomicRefCell<ElementData>> {
unsafe { unsafe {
self.get_style_and_layout_data().map(|d| { self.get_style_and_layout_data().map(|d| {
&(*(d.ptr.get() as *mut StyleData)).element_data &(*(d.ptr.as_ptr() as *mut StyleData)).element_data
}) })
} }
} }
@ -575,7 +575,7 @@ impl<'le> ServoLayoutElement<'le> {
fn get_style_data(&self) -> Option<&StyleData> { fn get_style_data(&self) -> Option<&StyleData> {
unsafe { unsafe {
self.get_style_and_layout_data().map(|d| &*(d.ptr.get() as *mut StyleData)) self.get_style_and_layout_data().map(|d| &*(d.ptr.as_ptr() as *mut StyleData))
} }
} }

View file

@ -28,7 +28,6 @@ extern crate malloc_size_of;
extern crate metrics; extern crate metrics;
extern crate msg; extern crate msg;
extern crate net_traits; extern crate net_traits;
extern crate nonzero;
extern crate parking_lot; extern crate parking_lot;
#[macro_use] #[macro_use]
extern crate profile_traits; extern crate profile_traits;

View file

@ -65,7 +65,6 @@ mime_guess = "1.8.0"
mozjs = { version = "0.1.10", features = ["promises"]} mozjs = { version = "0.1.10", features = ["promises"]}
msg = {path = "../msg"} msg = {path = "../msg"}
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
nonzero = {path = "../nonzero"}
num-traits = "0.1.32" num-traits = "0.1.32"
offscreen_gl_context = { version = "0.14", features = ["serde"] } offscreen_gl_context = { version = "0.14", features = ["serde"] }
open = "1.1.1" open = "1.1.1"

View file

@ -34,7 +34,6 @@ use js::jsapi::{JSObject, JSTracer, Heap};
use js::rust::GCMethods; use js::rust::GCMethods;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use mitochondria::OnceCell; use mitochondria::OnceCell;
use nonzero::NonZero;
use script_layout_interface::TrustedNodeAddress; use script_layout_interface::TrustedNodeAddress;
use std::cell::{Cell, UnsafeCell}; use std::cell::{Cell, UnsafeCell};
use std::default::Default; use std::default::Default;
@ -312,7 +311,7 @@ impl<'root, T: RootedReference<'root> + 'root> RootedReference<'root> for Option
/// This should only be used as a field in other DOM objects. /// This should only be used as a field in other DOM objects.
#[must_root] #[must_root]
pub struct Dom<T> { pub struct Dom<T> {
ptr: NonZero<*const T>, ptr: ptr::NonNull<T>,
} }
// Dom<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting. // Dom<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting.
@ -339,7 +338,7 @@ impl<T: DomObject> Dom<T> {
pub fn from_ref(obj: &T) -> Dom<T> { pub fn from_ref(obj: &T) -> Dom<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
Dom { Dom {
ptr: unsafe { NonZero::new_unchecked(&*obj) }, ptr: ptr::NonNull::from(obj),
} }
} }
} }
@ -351,7 +350,7 @@ impl<T: DomObject> Deref for Dom<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
// We can only have &Dom<T> from a rooted thing, so it's safe to deref // We can only have &Dom<T> from a rooted thing, so it's safe to deref
// it to &T. // it to &T.
unsafe { &*self.ptr.get() } unsafe { &*self.ptr.as_ptr() }
} }
} }
@ -366,7 +365,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
trace_reflector(trc, trace_reflector(trc,
trace_info, trace_info,
(*self.ptr.get()).reflector()); (*self.ptr.as_ptr()).reflector());
} }
} }
@ -374,7 +373,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
/// traits must be implemented on this. /// traits must be implemented on this.
#[allow_unrooted_interior] #[allow_unrooted_interior]
pub struct LayoutDom<T> { pub struct LayoutDom<T> {
ptr: NonZero<*const T>, ptr: ptr::NonNull<T>,
} }
impl<T: Castable> LayoutDom<T> { impl<T: Castable> LayoutDom<T> {
@ -384,9 +383,9 @@ impl<T: Castable> LayoutDom<T> {
T: DerivedFrom<U> T: DerivedFrom<U>
{ {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
let ptr: *const T = self.ptr.get(); let ptr: *mut T = self.ptr.as_ptr();
LayoutDom { LayoutDom {
ptr: unsafe { NonZero::new_unchecked(ptr as *const U) }, ptr: unsafe { ptr::NonNull::new_unchecked(ptr as *mut U) },
} }
} }
@ -397,9 +396,9 @@ impl<T: Castable> LayoutDom<T> {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
unsafe { unsafe {
if (*self.unsafe_get()).is::<U>() { if (*self.unsafe_get()).is::<U>() {
let ptr: *const T = self.ptr.get(); let ptr: *mut T = self.ptr.as_ptr();
Some(LayoutDom { Some(LayoutDom {
ptr: NonZero::new_unchecked(ptr as *const U), ptr: ptr::NonNull::new_unchecked(ptr as *mut U),
}) })
} else { } else {
None None
@ -412,7 +411,7 @@ impl<T: DomObject> LayoutDom<T> {
/// Get the reflector. /// Get the reflector.
pub unsafe fn get_jsobject(&self) -> *mut JSObject { pub unsafe fn get_jsobject(&self) -> *mut JSObject {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
(*self.ptr.get()).reflector().get_jsobject().get() (*self.ptr.as_ptr()).reflector().get_jsobject().get()
} }
} }
@ -420,7 +419,7 @@ impl<T> Copy for LayoutDom<T> {}
impl<T> PartialEq for Dom<T> { impl<T> PartialEq for Dom<T> {
fn eq(&self, other: &Dom<T>) -> bool { fn eq(&self, other: &Dom<T>) -> bool {
self.ptr == other.ptr self.ptr.as_ptr() == other.ptr.as_ptr()
} }
} }
@ -428,7 +427,7 @@ impl<T> Eq for Dom<T> {}
impl<T> PartialEq for LayoutDom<T> { impl<T> PartialEq for LayoutDom<T> {
fn eq(&self, other: &LayoutDom<T>) -> bool { fn eq(&self, other: &LayoutDom<T>) -> bool {
self.ptr == other.ptr self.ptr.as_ptr() == other.ptr.as_ptr()
} }
} }
@ -436,13 +435,13 @@ impl<T> Eq for LayoutDom<T> {}
impl<T> Hash for Dom<T> { impl<T> Hash for Dom<T> {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
self.ptr.hash(state) self.ptr.as_ptr().hash(state)
} }
} }
impl<T> Hash for LayoutDom<T> { impl<T> Hash for LayoutDom<T> {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
self.ptr.hash(state) self.ptr.as_ptr().hash(state)
} }
} }
@ -474,7 +473,7 @@ impl LayoutDom<Node> {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
let TrustedNodeAddress(addr) = inner; let TrustedNodeAddress(addr) = inner;
LayoutDom { LayoutDom {
ptr: NonZero::new_unchecked(addr as *const Node), ptr: ptr::NonNull::new_unchecked(addr as *const Node as *mut Node),
} }
} }
} }
@ -700,7 +699,7 @@ impl<T: DomObject> LayoutDom<T> {
/// this is unsafe is what necessitates the layout wrappers.) /// this is unsafe is what necessitates the layout wrappers.)
pub unsafe fn unsafe_get(&self) -> *const T { pub unsafe fn unsafe_get(&self) -> *const T {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
self.ptr.get() self.ptr.as_ptr()
} }
/// Returns a reference to the interior of this JS object. This method is /// Returns a reference to the interior of this JS object. This method is
@ -708,7 +707,7 @@ impl<T: DomObject> LayoutDom<T> {
/// mutate DOM nodes. /// mutate DOM nodes.
pub fn get_for_script(&self) -> &T { pub fn get_for_script(&self) -> &T {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
unsafe { &*self.ptr.get() } unsafe { &*self.ptr.as_ptr() }
} }
} }

View file

@ -18,10 +18,10 @@ use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
use js::jsval::PrivateValue; use js::jsval::PrivateValue;
use libc::c_void; use libc::c_void;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use nonzero::NonZero;
use std::cell::{Cell, UnsafeCell}; use std::cell::{Cell, UnsafeCell};
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut, Drop}; use std::ops::{Deref, DerefMut, Drop};
use std::ptr;
/// The index of the slot wherein a pointer to the weak holder cell is /// The index of the slot wherein a pointer to the weak holder cell is
/// stored for weak-referenceable bindings. We use slot 1 for holding it, /// stored for weak-referenceable bindings. We use slot 1 for holding it,
@ -30,9 +30,10 @@ use std::ops::{Deref, DerefMut, Drop};
pub const DOM_WEAK_SLOT: u32 = 1; pub const DOM_WEAK_SLOT: u32 = 1;
/// A weak reference to a JS-managed DOM object. /// A weak reference to a JS-managed DOM object.
#[allow(unrooted_must_root)]
#[allow_unrooted_interior] #[allow_unrooted_interior]
pub struct WeakRef<T: WeakReferenceable> { pub struct WeakRef<T: WeakReferenceable> {
ptr: NonZero<*mut WeakBox<T>>, ptr: ptr::NonNull<WeakBox<T>>,
} }
/// The inner box of weak references, public for the finalization in codegen. /// The inner box of weak references, public for the finalization in codegen.
@ -42,7 +43,7 @@ pub struct WeakBox<T: WeakReferenceable> {
/// have already been set to `None`. The pointee contributes one to the count. /// have already been set to `None`. The pointee contributes one to the count.
pub count: Cell<usize>, pub count: Cell<usize>,
/// The pointer to the JS-managed object, set to None when it is collected. /// The pointer to the JS-managed object, set to None when it is collected.
pub value: Cell<Option<NonZero<*const T>>>, pub value: Cell<Option<ptr::NonNull<T>>>,
} }
/// Trait implemented by weak-referenceable interfaces. /// Trait implemented by weak-referenceable interfaces.
@ -58,7 +59,7 @@ pub trait WeakReferenceable: DomObject + Sized {
trace!("Creating new WeakBox holder for {:p}.", self); trace!("Creating new WeakBox holder for {:p}.", self);
ptr = Box::into_raw(Box::new(WeakBox { ptr = Box::into_raw(Box::new(WeakBox {
count: Cell::new(1), count: Cell::new(1),
value: Cell::new(Some(NonZero::new_unchecked(self))), value: Cell::new(Some(ptr::NonNull::from(self))),
})); }));
JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void)); JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void));
} }
@ -70,7 +71,7 @@ pub trait WeakReferenceable: DomObject + Sized {
new_count); new_count);
box_.count.set(new_count); box_.count.set(new_count);
WeakRef { WeakRef {
ptr: NonZero::new_unchecked(ptr), ptr: ptr::NonNull::new_unchecked(ptr),
} }
} }
} }
@ -86,21 +87,21 @@ impl<T: WeakReferenceable> WeakRef<T> {
/// DomRoot a weak reference. Returns `None` if the object was already collected. /// DomRoot a weak reference. Returns `None` if the object was already collected.
pub fn root(&self) -> Option<DomRoot<T>> { pub fn root(&self) -> Option<DomRoot<T>> {
unsafe { &*self.ptr.get() }.value.get().map(|ptr| unsafe { unsafe { &*self.ptr.as_ptr() }.value.get().map(|ptr| unsafe {
DomRoot::from_ref(&*ptr.get()) DomRoot::from_ref(&*ptr.as_ptr())
}) })
} }
/// Return whether the weakly-referenced object is still alive. /// Return whether the weakly-referenced object is still alive.
pub fn is_alive(&self) -> bool { pub fn is_alive(&self) -> bool {
unsafe { &*self.ptr.get() }.value.get().is_some() unsafe { &*self.ptr.as_ptr() }.value.get().is_some()
} }
} }
impl<T: WeakReferenceable> Clone for WeakRef<T> { impl<T: WeakReferenceable> Clone for WeakRef<T> {
fn clone(&self) -> WeakRef<T> { fn clone(&self) -> WeakRef<T> {
unsafe { unsafe {
let box_ = &*self.ptr.get(); let box_ = &*self.ptr.as_ptr();
let new_count = box_.count.get() + 1; let new_count = box_.count.get() + 1;
box_.count.set(new_count); box_.count.set(new_count);
WeakRef { WeakRef {
@ -119,7 +120,8 @@ impl<T: WeakReferenceable> MallocSizeOf for WeakRef<T> {
impl<T: WeakReferenceable> PartialEq for WeakRef<T> { impl<T: WeakReferenceable> PartialEq for WeakRef<T> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
unsafe { unsafe {
(*self.ptr.get()).value.get() == (*other.ptr.get()).value.get() (*self.ptr.as_ptr()).value.get().map(ptr::NonNull::as_ptr) ==
(*other.ptr.as_ptr()).value.get().map(ptr::NonNull::as_ptr)
} }
} }
} }
@ -127,8 +129,8 @@ impl<T: WeakReferenceable> PartialEq for WeakRef<T> {
impl<T: WeakReferenceable> PartialEq<T> for WeakRef<T> { impl<T: WeakReferenceable> PartialEq<T> for WeakRef<T> {
fn eq(&self, other: &T) -> bool { fn eq(&self, other: &T) -> bool {
unsafe { unsafe {
match (*self.ptr.get()).value.get() { match self.ptr.as_ref().value.get() {
Some(ptr) => ptr.get() == other, Some(ptr) => ptr::eq(ptr.as_ptr(), other),
None => false, None => false,
} }
} }
@ -145,7 +147,7 @@ impl<T: WeakReferenceable> Drop for WeakRef<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
let (count, value) = { let (count, value) = {
let weak_box = &*self.ptr.get(); let weak_box = &*self.ptr.as_ptr();
assert!(weak_box.count.get() > 0); assert!(weak_box.count.get() > 0);
let count = weak_box.count.get() - 1; let count = weak_box.count.get() - 1;
weak_box.count.set(count); weak_box.count.set(count);
@ -153,7 +155,7 @@ impl<T: WeakReferenceable> Drop for WeakRef<T> {
}; };
if count == 0 { if count == 0 {
assert!(value.is_none()); assert!(value.is_none());
mem::drop(Box::from_raw(self.ptr.get())); mem::drop(Box::from_raw(self.ptr.as_ptr()));
} }
} }
} }

View file

@ -68,7 +68,6 @@ extern crate mitochondria;
extern crate mozjs as js; extern crate mozjs as js;
extern crate msg; extern crate msg;
extern crate net_traits; extern crate net_traits;
extern crate nonzero;
extern crate num_traits; extern crate num_traits;
extern crate offscreen_gl_context; extern crate offscreen_gl_context;
extern crate open; extern crate open;

View file

@ -25,7 +25,6 @@ malloc_size_of_derive = { path = "../malloc_size_of_derive" }
metrics = {path = "../metrics"} metrics = {path = "../metrics"}
msg = {path = "../msg"} msg = {path = "../msg"}
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
nonzero = {path = "../nonzero"}
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
range = {path = "../range"} range = {path = "../range"}
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}

View file

@ -24,7 +24,6 @@ extern crate malloc_size_of;
extern crate metrics; extern crate metrics;
extern crate msg; extern crate msg;
extern crate net_traits; extern crate net_traits;
extern crate nonzero;
extern crate profile_traits; extern crate profile_traits;
extern crate range; extern crate range;
extern crate script_traits; extern crate script_traits;
@ -45,9 +44,9 @@ use canvas_traits::canvas::CanvasMsg;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use libc::c_void; use libc::c_void;
use net_traits::image_cache::PendingImageId; use net_traits::image_cache::PendingImageId;
use nonzero::NonZero;
use script_traits::UntrustedNodeAddress; use script_traits::UntrustedNodeAddress;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::ptr::NonNull;
use std::sync::atomic::AtomicIsize; use std::sync::atomic::AtomicIsize;
use style::data::ElementData; use style::data::ElementData;
@ -77,7 +76,7 @@ pub struct OpaqueStyleAndLayoutData {
// NB: We really store a `StyleAndLayoutData` here, so be careful! // NB: We really store a `StyleAndLayoutData` here, so be careful!
#[ignore_malloc_size_of = "TODO(#6910) Box value that should be counted but \ #[ignore_malloc_size_of = "TODO(#6910) Box value that should be counted but \
the type lives in layout"] the type lives in layout"]
pub ptr: NonZero<*mut StyleData>, pub ptr: NonNull<StyleData>,
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]