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

6
Cargo.lock generated
View file

@ -1671,7 +1671,7 @@ dependencies = [
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -3199,7 +3199,7 @@ dependencies = [
[[package]] [[package]]
name = "tendril" name = "tendril"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3873,7 +3873,7 @@ dependencies = [
"checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047" "checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047"
"checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791" "checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum tendril 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01576be96a211e017bf90b1603b1272baf9fe93a1bf9b4845257c4ba09c9b25f" "checksum tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1b72f8e2f5b73b65c315b1a70c730f24b9d7a25f39e98de8acbe2bb795caea"
"checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989" "checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989"
"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a" "checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a"
"checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773" "checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773"

View file

@ -421,7 +421,7 @@ lazy_static! {
hb_font_funcs_set_glyph_h_kerning_func( hb_font_funcs_set_glyph_h_kerning_func(
hb_funcs, Some(glyph_h_kerning_func), ptr::null_mut(), None); hb_funcs, Some(glyph_h_kerning_func), ptr::null_mut(), None);
ptr::Unique::new(hb_funcs) ptr::Unique::new_unchecked(hb_funcs)
}; };
} }

View file

@ -256,7 +256,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(ptr as *mut StyleData), ptr: NonZero::new_unchecked(ptr as *mut StyleData),
}; };
self.init_style_and_layout_data(opaque); self.init_style_and_layout_data(opaque);
}; };

View file

@ -35,7 +35,7 @@ impl ThreadId {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn new() -> ThreadId { fn new() -> ThreadId {
let number = THREAD_COUNT.fetch_add(1, Ordering::SeqCst); let number = THREAD_COUNT.fetch_add(1, Ordering::SeqCst);
ThreadId(unsafe { NonZero::new(number) }) ThreadId(NonZero::new(number).unwrap())
} }
pub fn current() -> ThreadId { pub fn current() -> ThreadId {
THREAD_ID.with(|tls| tls.clone()) THREAD_ID.with(|tls| tls.clone())
@ -59,13 +59,13 @@ impl AtomicOptThreadId {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn load(&self, ordering: Ordering) -> Option<ThreadId> { pub fn load(&self, ordering: Ordering) -> Option<ThreadId> {
let number = self.0.load(ordering); let number = self.0.load(ordering);
if number == 0 { None } else { Some(ThreadId(unsafe { NonZero::new(number) })) } NonZero::new(number).map(ThreadId)
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn swap(&self, value: Option<ThreadId>, ordering: Ordering) -> Option<ThreadId> { pub fn swap(&self, value: Option<ThreadId>, ordering: Ordering) -> Option<ThreadId> {
let number = value.map(|id| id.0.get()).unwrap_or(0); let number = value.map(|id| id.0.get()).unwrap_or(0);
let number = self.0.swap(number, ordering); let number = self.0.swap(number, ordering);
if number == 0 { None } else { Some(ThreadId(unsafe { NonZero::new(number) })) } NonZero::new(number).map(ThreadId)
} }
} }

View file

@ -106,7 +106,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
self.index.set(index + 1); self.index.set(index + 1);
result.map(|_| { result.map(|_| {
assert!(!rval.is_null()); 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> { pub fn from_ref(obj: &T) -> JS<T> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
JS { 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()); debug_assert!(thread_state::get().is_layout());
let ptr: *const T = self.ptr.get(); let ptr: *const T = self.ptr.get();
LayoutJS { 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>() { if (*self.unsafe_get()).is::<U>() {
let ptr: *const T = self.ptr.get(); let ptr: *const T = self.ptr.get();
Some(LayoutJS { Some(LayoutJS {
ptr: NonZero::new(ptr as *const U), ptr: NonZero::new_unchecked(ptr as *const U),
}) })
} else { } else {
None None
@ -223,7 +223,7 @@ impl LayoutJS<Node> {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
let TrustedNodeAddress(addr) = inner; let TrustedNodeAddress(addr) = inner;
LayoutJS { 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 /// Generate a new root from a reference
pub fn from_ref(unrooted: &T) -> Root<T> { 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 self.owner_thread == (&*live_references) as *const _ as *const libc::c_void
})); }));
unsafe { 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); trace!("Creating new WeakBox holder for {:p}.", self);
ptr = Box::into_raw(box WeakBox { ptr = Box::into_raw(box WeakBox {
count: Cell::new(1), 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)); JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void));
} }
@ -70,7 +70,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(ptr), ptr: NonZero::new_unchecked(ptr),
} }
} }
} }

View file

@ -65,7 +65,7 @@ impl CryptoMethods for Crypto {
self.rng.borrow_mut().fill_bytes(&mut data); self.rng.borrow_mut().fill_bytes(&mut data);
Ok(NonZero::new(input)) Ok(NonZero::new_unchecked(input))
} }
} }

View file

@ -3498,7 +3498,7 @@ impl DocumentMethods for Document {
if elements.peek().is_none() { if elements.peek().is_none() {
// TODO: Step 2. // TODO: Step 2.
// Step 3. // Step 3.
return Some(NonZero::new(first.reflector().get_jsobject().get())); return Some(NonZero::new_unchecked(first.reflector().get_jsobject().get()));
} }
} else { } else {
return None; return None;
@ -3509,7 +3509,7 @@ impl DocumentMethods for Document {
name: name, name: name,
}; };
let collection = HTMLCollection::create(self.window(), root, box filter); let collection = HTMLCollection::create(self.window(), root, box filter);
Some(NonZero::new(collection.reflector().get_jsobject().get())) Some(NonZero::new_unchecked(collection.reflector().get_jsobject().get()))
} }
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names // https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names

View file

@ -128,7 +128,7 @@ impl GamepadMethods for Gamepad {
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/gamepad/#dom-gamepad-axes // https://w3c.github.io/gamepad/#dom-gamepad-axes
unsafe fn Axes(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn Axes(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.axes.get()) NonZero::new_unchecked(self.axes.get())
} }
// https://w3c.github.io/gamepad/#dom-gamepad-buttons // https://w3c.github.io/gamepad/#dom-gamepad-buttons

View file

@ -161,6 +161,6 @@ impl ImageDataMethods for ImageData {
// https://html.spec.whatwg.org/multipage/#dom-imagedata-data // https://html.spec.whatwg.org/multipage/#dom-imagedata-data
unsafe fn Data(&self, _: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn Data(&self, _: *mut JSContext) -> NonZero<*mut JSObject> {
assert!(!self.data.get().is_null()); assert!(!self.data.get().is_null());
NonZero::new(self.data.get()) NonZero::new_unchecked(self.data.get())
} }
} }

View file

@ -154,7 +154,7 @@ impl TestBindingMethods for TestBinding {
unsafe fn ArrayAttribute(&self, cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn ArrayAttribute(&self, cx: *mut JSContext) -> NonZero<*mut JSObject> {
rooted!(in(cx) let array = JS_NewUint8ClampedArray(cx, 16)); rooted!(in(cx) let array = JS_NewUint8ClampedArray(cx, 16));
assert!(!array.is_null()); assert!(!array.is_null());
NonZero::new(array.get()) NonZero::new_unchecked(array.get())
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() } unsafe fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
@ -164,7 +164,7 @@ impl TestBindingMethods for TestBinding {
unsafe fn ObjectAttribute(&self, cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn ObjectAttribute(&self, cx: *mut JSContext) -> NonZero<*mut JSObject> {
rooted!(in(cx) let obj = JS_NewPlainObject(cx)); rooted!(in(cx) let obj = JS_NewPlainObject(cx));
assert!(!obj.is_null()); assert!(!obj.is_null());
NonZero::new(obj.get()) NonZero::new_unchecked(obj.get())
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn SetObjectAttribute(&self, _: *mut JSContext, _: *mut JSObject) {} unsafe fn SetObjectAttribute(&self, _: *mut JSContext, _: *mut JSObject) {}

View file

@ -53,6 +53,6 @@ impl TextEncoderMethods for TextEncoder {
rooted!(in(cx) let mut js_object = ptr::null_mut()); rooted!(in(cx) let mut js_object = ptr::null_mut());
assert!(Uint8Array::create(cx, CreateWith::Slice(&encoded), js_object.handle_mut()).is_ok()); assert!(Uint8Array::create(cx, CreateWith::Slice(&encoded), js_object.handle_mut()).is_ok());
NonZero::new(js_object.get()) NonZero::new_unchecked(js_object.get())
} }
} }

View file

@ -61,7 +61,7 @@ impl VREyeParametersMethods for VREyeParameters {
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vreyeparameters-offset // https://w3c.github.io/webvr/#dom-vreyeparameters-offset
unsafe fn Offset(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn Offset(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.offset.get()) NonZero::new_unchecked(self.offset.get())
} }
// https://w3c.github.io/webvr/#dom-vreyeparameters-fieldofview // https://w3c.github.io/webvr/#dom-vreyeparameters-fieldofview

View file

@ -119,25 +119,25 @@ impl VRFrameDataMethods for VRFrameData {
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-leftprojectionmatrix // https://w3c.github.io/webvr/#dom-vrframedata-leftprojectionmatrix
unsafe fn LeftProjectionMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn LeftProjectionMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.left_proj.get()) NonZero::new_unchecked(self.left_proj.get())
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-leftviewmatrix // https://w3c.github.io/webvr/#dom-vrframedata-leftviewmatrix
unsafe fn LeftViewMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn LeftViewMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.left_view.get()) NonZero::new_unchecked(self.left_view.get())
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-rightprojectionmatrix // https://w3c.github.io/webvr/#dom-vrframedata-rightprojectionmatrix
unsafe fn RightProjectionMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn RightProjectionMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.right_proj.get()) NonZero::new_unchecked(self.right_proj.get())
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-rightviewmatrix // https://w3c.github.io/webvr/#dom-vrframedata-rightviewmatrix
unsafe fn RightViewMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn RightViewMatrix(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.right_view.get()) NonZero::new_unchecked(self.right_view.get())
} }
// https://w3c.github.io/webvr/#dom-vrframedata-pose // https://w3c.github.io/webvr/#dom-vrframedata-pose

View file

@ -58,7 +58,7 @@ fn heap_to_option(heap: &Heap<*mut JSObject>) -> Option<NonZero<*mut JSObject>>
None None
} else { } else {
unsafe { unsafe {
Some(NonZero::new(js_object)) Some(NonZero::new_unchecked(js_object))
} }
} }
} }

View file

@ -70,7 +70,7 @@ impl VRStageParametersMethods for VRStageParameters {
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrstageparameters-sittingtostandingtransform // https://w3c.github.io/webvr/#dom-vrstageparameters-sittingtostandingtransform
unsafe fn SittingToStandingTransform(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> { unsafe fn SittingToStandingTransform(&self, _cx: *mut JSContext) -> NonZero<*mut JSObject> {
NonZero::new(self.transform.get()) NonZero::new_unchecked(self.transform.get())
} }
// https://w3c.github.io/webvr/#dom-vrstageparameters-sizex // https://w3c.github.io/webvr/#dom-vrstageparameters-sizex

View file

@ -57,7 +57,7 @@ impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
self.enable(ext); self.enable(ext);
} }
unsafe { unsafe {
NonZero::new(extension.reflector().get_jsobject().get()) NonZero::new_unchecked(extension.reflector().get_jsobject().get())
} }
} }

View file

@ -1 +1 @@
504328a31a211814f9cac6de84c5a7ed154f58eb 599be0d18f4c6ddf36366d2a5a2ca6dc65886896