aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/root.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-26 15:38:10 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-26 16:10:30 +0200
commit1ff6c4f9aa52fa9dca5a370e30e92ad45549217b (patch)
tree0b704c57ce22008539ea28feae1accd74f5ee0fb /components/script/dom/bindings/root.rs
parent3dbb97922d75f7ba4c542cb67e9c30c28c7a0699 (diff)
downloadservo-1ff6c4f9aa52fa9dca5a370e30e92ad45549217b.tar.gz
servo-1ff6c4f9aa52fa9dca5a370e30e92ad45549217b.zip
Make DomRoot::new unsafe
Diffstat (limited to 'components/script/dom/bindings/root.rs')
-rw-r--r--components/script/dom/bindings/root.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index 1a81965fef9..3a6a3521132 100644
--- a/components/script/dom/bindings/root.rs
+++ b/components/script/dom/bindings/root.rs
@@ -591,11 +591,11 @@ impl<T: DomObject> DomRoot<T> {
/// Create a new stack-bounded root for the provided JS-owned value.
/// It cannot outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`.
- pub fn new(unrooted: NonZero<*const T>) -> DomRoot<T> {
+ pub unsafe fn new(unrooted: NonZero<*const T>) -> DomRoot<T> {
debug_assert!(thread_state::get().is_script());
STACK_ROOTS.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
- unsafe { (*collection).root(&*(*unrooted.get()).reflector()) }
+ (*collection).root(&*(*unrooted.get()).reflector())
DomRoot {
ptr: unrooted,
root_list: collection,
@@ -605,7 +605,7 @@ impl<T: DomObject> DomRoot<T> {
/// Generate a new root from a reference
pub fn from_ref(unrooted: &T) -> DomRoot<T> {
- DomRoot::new(unsafe { NonZero::new_unchecked(unrooted) })
+ unsafe { DomRoot::new(NonZero::new_unchecked(unrooted)) }
}
}