Upgrade to rustc 1.21.0-nightly (599be0d18 2017-07-26)

This commit is contained in:
Simon Sapin 2017-07-27 02:21:01 +02:00
parent 27031b996b
commit a205c82264
20 changed files with 34 additions and 34 deletions

View file

@ -106,7 +106,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
self.index.set(index + 1);
result.map(|_| {
assert!(!rval.is_null());
unsafe { NonZero::new(rval.get()) }
unsafe { NonZero::new_unchecked(rval.get()) }
})
}
}

View file

@ -81,7 +81,7 @@ impl<T: DomObject> JS<T> {
pub fn from_ref(obj: &T) -> JS<T> {
debug_assert!(thread_state::get().is_script());
JS {
ptr: unsafe { NonZero::new(&*obj) },
ptr: unsafe { NonZero::new_unchecked(&*obj) },
}
}
}
@ -135,7 +135,7 @@ impl<T: Castable> LayoutJS<T> {
debug_assert!(thread_state::get().is_layout());
let ptr: *const T = self.ptr.get();
LayoutJS {
ptr: unsafe { NonZero::new(ptr as *const U) },
ptr: unsafe { NonZero::new_unchecked(ptr as *const U) },
}
}
@ -148,7 +148,7 @@ impl<T: Castable> LayoutJS<T> {
if (*self.unsafe_get()).is::<U>() {
let ptr: *const T = self.ptr.get();
Some(LayoutJS {
ptr: NonZero::new(ptr as *const U),
ptr: NonZero::new_unchecked(ptr as *const U),
})
} else {
None
@ -223,7 +223,7 @@ impl LayoutJS<Node> {
debug_assert!(thread_state::get().is_layout());
let TrustedNodeAddress(addr) = inner;
LayoutJS {
ptr: NonZero::new(addr as *const Node),
ptr: NonZero::new_unchecked(addr as *const Node),
}
}
}
@ -554,7 +554,7 @@ impl<T: DomObject> Root<T> {
/// Generate a new root from a reference
pub fn from_ref(unrooted: &T) -> Root<T> {
Root::new(unsafe { NonZero::new(unrooted) })
Root::new(unsafe { NonZero::new_unchecked(unrooted) })
}
}

View file

@ -200,7 +200,7 @@ impl<T: DomObject> Trusted<T> {
self.owner_thread == (&*live_references) as *const _ as *const libc::c_void
}));
unsafe {
Root::new(NonZero::new(self.refcount.0 as *const T))
Root::new(NonZero::new_unchecked(self.refcount.0 as *const T))
}
}
}

View file

@ -58,7 +58,7 @@ pub trait WeakReferenceable: DomObject + Sized {
trace!("Creating new WeakBox holder for {:p}.", self);
ptr = Box::into_raw(box WeakBox {
count: Cell::new(1),
value: Cell::new(Some(NonZero::new(self))),
value: Cell::new(Some(NonZero::new_unchecked(self))),
});
JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void));
}
@ -70,7 +70,7 @@ pub trait WeakReferenceable: DomObject + Sized {
new_count);
box_.count.set(new_count);
WeakRef {
ptr: NonZero::new(ptr),
ptr: NonZero::new_unchecked(ptr),
}
}
}