mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Replace NonZero<*{const,mut} _> with std::ptr::NonNull
This commit is contained in:
parent
52eda6082f
commit
10ec5a2bb0
11 changed files with 42 additions and 50 deletions
|
@ -10,7 +10,7 @@ name = "layout_thread"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
unstable = ["parking_lot/nightly", "nonzero/unstable"]
|
||||
unstable = ["parking_lot/nightly"]
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.6"
|
||||
|
@ -30,7 +30,6 @@ malloc_size_of = { path = "../malloc_size_of" }
|
|||
metrics = {path = "../metrics"}
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
nonzero = {path = "../nonzero"}
|
||||
parking_lot = "0.4"
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
range = {path = "../range"}
|
||||
|
|
|
@ -36,7 +36,6 @@ use html5ever::{LocalName, Namespace};
|
|||
use layout::data::StyleAndLayoutData;
|
||||
use layout::wrapper::GetRawData;
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use nonzero::NonZero;
|
||||
use range::Range;
|
||||
use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||
use script::layout_exports::{Document, Element, Node, Text};
|
||||
|
@ -59,6 +58,7 @@ use std::fmt;
|
|||
use std::fmt::Debug;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style::CaseSensitivityExt;
|
||||
use style::applicable_declarations::ApplicableDeclarationBlock;
|
||||
|
@ -76,7 +76,7 @@ use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocke
|
|||
use style::str::is_whitespace;
|
||||
|
||||
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 _ = Box::from_raw(non_opaque);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
|
|||
let ptr: *mut StyleAndLayoutData =
|
||||
Box::into_raw(Box::new(StyleAndLayoutData::new()));
|
||||
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);
|
||||
};
|
||||
|
@ -450,7 +450,7 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>> {
|
||||
unsafe {
|
||||
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> {
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ extern crate malloc_size_of;
|
|||
extern crate metrics;
|
||||
extern crate msg;
|
||||
extern crate net_traits;
|
||||
extern crate nonzero;
|
||||
extern crate parking_lot;
|
||||
#[macro_use]
|
||||
extern crate profile_traits;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue