Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30)

This commit is contained in:
Simon Sapin 2019-07-31 13:34:01 +02:00
parent 87e7e3d429
commit c38c964f1b
38 changed files with 118 additions and 109 deletions

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![feature(core_intrinsics)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
#[macro_use] #[macro_use]

View file

@ -116,7 +116,7 @@ macro_rules! impl_from_pref {
panic!( panic!(
format!("Cannot convert {:?} to {:?}", format!("Cannot convert {:?} to {:?}",
other, other,
unsafe { std::intrinsics::type_name::<$t>() } std::any::type_name::<$t>()
) )
); );
} }

View file

@ -60,5 +60,4 @@ mod energymon {
init(); init();
unsafe { EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32) } unsafe { EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32) }
} }
} }

View file

@ -194,7 +194,7 @@ impl Attr {
ScriptThread::enqueue_callback_reaction(owner, reaction, None); ScriptThread::enqueue_callback_reaction(owner, reaction, None);
} }
assert_eq!(Some(owner), self.owner().deref()); assert_eq!(Some(owner), self.owner().as_deref());
owner.will_mutate_attr(self); owner.will_mutate_attr(self);
self.swap_value(&mut value); self.swap_value(&mut value);
if self.identifier.namespace == ns!() { if self.identifier.namespace == ns!() {
@ -227,7 +227,11 @@ impl Attr {
match (self.owner(), owner) { match (self.owner(), owner) {
(Some(old), None) => { (Some(old), None) => {
// Already gone from the list of attributes of old owner. // Already gone from the list of attributes of old owner.
assert!(old.get_attribute(&ns, &self.identifier.local_name).deref() != Some(self)) assert!(
old.get_attribute(&ns, &self.identifier.local_name)
.as_deref() !=
Some(self)
)
}, },
(Some(old), Some(new)) => assert_eq!(&*old, new), (Some(old), Some(new)) => assert_eq!(&*old, new),
_ => {}, _ => {},

View file

@ -7301,9 +7301,9 @@ def process_arg(expr, arg):
if arg.variadic or arg.type.isSequence(): if arg.variadic or arg.type.isSequence():
expr += ".r()" expr += ".r()"
elif arg.type.nullable() and arg.optional and not arg.defaultValue: elif arg.type.nullable() and arg.optional and not arg.defaultValue:
expr += ".as_ref().map(Option::deref)" expr += ".as_ref().map(Option::as_deref)"
elif arg.type.nullable() or arg.optional and not arg.defaultValue: elif arg.type.nullable() or arg.optional and not arg.defaultValue:
expr += ".deref()" expr += ".as_deref()"
else: else:
expr = "&" + expr expr = "&" + expr
elif isinstance(arg.type, IDLPromiseType): elif isinstance(arg.type, IDLPromiseType):

View file

@ -332,7 +332,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
let trace_string; let trace_string;
let trace_info = if cfg!(debug_assertions) { let trace_info = if cfg!(debug_assertions) {
trace_string = format!("for {} on heap", ::std::intrinsics::type_name::<T>()); trace_string = format!("for {} on heap", ::std::any::type_name::<T>());
&trace_string[..] &trace_string[..]
} else { } else {
"for DOM object on heap" "for DOM object on heap"

View file

@ -53,7 +53,7 @@ impl CompositionEvent {
type_, type_,
init.parent.parent.bubbles, init.parent.parent.bubbles,
init.parent.parent.cancelable, init.parent.parent.cancelable,
init.parent.view.deref(), init.parent.view.as_deref(),
init.parent.detail, init.parent.detail,
init.data.clone(), init.data.clone(),
); );

View file

@ -612,7 +612,7 @@ impl Document {
.upcast::<Element>() .upcast::<Element>()
.has_attribute(&local_name!("href")) .has_attribute(&local_name!("href"))
}); });
self.base_element.set(base.deref()); self.base_element.set(base.as_deref());
} }
pub fn dom_count(&self) -> u32 { pub fn dom_count(&self) -> u32 {
@ -757,7 +757,7 @@ impl Document {
let target = self.find_fragment_node(fragment); let target = self.find_fragment_node(fragment);
// Step 1 // Step 1
self.set_target_element(target.deref()); self.set_target_element(target.as_deref());
let point = target let point = target
.as_ref() .as_ref()
@ -798,7 +798,7 @@ impl Document {
y, y,
global_scope.pipeline_id().root_scroll_id(), global_scope.pipeline_id().root_scroll_id(),
ScrollBehavior::Instant, ScrollBehavior::Instant,
target.deref(), target.as_deref(),
); );
} }
} }
@ -862,7 +862,7 @@ impl Document {
/// Reassign the focus context to the element that last requested focus during this /// Reassign the focus context to the element that last requested focus during this
/// transaction, or none if no elements requested it. /// transaction, or none if no elements requested it.
pub fn commit_focus_transaction(&self, focus_type: FocusType) { pub fn commit_focus_transaction(&self, focus_type: FocusType) {
if self.focused == self.possibly_focused.get().deref() { if self.focused == self.possibly_focused.get().as_deref() {
return; return;
} }
if let Some(ref elem) = self.focused.get() { if let Some(ref elem) = self.focused.get() {
@ -877,7 +877,7 @@ impl Document {
} }
} }
self.focused.set(self.possibly_focused.get().deref()); self.focused.set(self.possibly_focused.get().as_deref());
if let Some(ref elem) = self.focused.get() { if let Some(ref elem) = self.focused.get() {
elem.set_focus_state(true); elem.set_focus_state(true);
@ -1224,7 +1224,7 @@ impl Document {
} }
// Store the current mouse over target for next frame. // Store the current mouse over target for next frame.
prev_mouse_over_target.set(maybe_new_target.deref()); prev_mouse_over_target.set(maybe_new_target.as_deref());
self.window self.window
.reflow(ReflowGoal::Full, ReflowReason::MouseEvent); .reflow(ReflowGoal::Full, ReflowReason::MouseEvent);
@ -2892,7 +2892,7 @@ impl Document {
fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> { fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> {
let doc = self.GetDocumentElement(); let doc = self.GetDocumentElement();
let maybe_node = doc.deref().map(Castable::upcast::<Node>); let maybe_node = doc.as_deref().map(Castable::upcast::<Node>);
let iter = maybe_node let iter = maybe_node
.iter() .iter()
.flat_map(|node| node.traverse_preorder(ShadowIncluding::No)) .flat_map(|node| node.traverse_preorder(ShadowIncluding::No))
@ -3900,7 +3900,7 @@ impl DocumentMethods for Document {
let parent = root.upcast::<Node>(); let parent = root.upcast::<Node>();
let child = elem.upcast::<Node>(); let child = elem.upcast::<Node>();
parent parent
.InsertBefore(child, parent.GetFirstChild().deref()) .InsertBefore(child, parent.GetFirstChild().as_deref())
.unwrap() .unwrap()
}, },
} }
@ -3985,7 +3985,7 @@ impl DocumentMethods for Document {
// Step 2. // Step 2.
let old_body = self.GetBody(); let old_body = self.GetBody();
if old_body.deref() == Some(new_body) { if old_body.as_deref() == Some(new_body) {
return Ok(()); return Ok(());
} }

View file

@ -1365,7 +1365,7 @@ impl Element {
ScriptThread::enqueue_callback_reaction(self, reaction, None); ScriptThread::enqueue_callback_reaction(self, reaction, None);
} }
assert!(attr.GetOwnerElement().deref() == Some(self)); assert!(attr.GetOwnerElement().as_deref() == Some(self));
self.will_mutate_attr(attr); self.will_mutate_attr(attr);
self.attrs.borrow_mut().push(Dom::from_ref(attr)); self.attrs.borrow_mut().push(Dom::from_ref(attr));
if attr.namespace() == &ns!() { if attr.namespace() == &ns!() {
@ -1680,12 +1680,12 @@ impl Element {
} }
}, },
AdjacentPosition::AfterBegin => { AdjacentPosition::AfterBegin => {
Node::pre_insert(node, &self_node, self_node.GetFirstChild().deref()).map(Some) Node::pre_insert(node, &self_node, self_node.GetFirstChild().as_deref()).map(Some)
}, },
AdjacentPosition::BeforeEnd => Node::pre_insert(node, &self_node, None).map(Some), AdjacentPosition::BeforeEnd => Node::pre_insert(node, &self_node, None).map(Some),
AdjacentPosition::AfterEnd => { AdjacentPosition::AfterEnd => {
if let Some(parent) = self_node.GetParentNode() { if let Some(parent) = self_node.GetParentNode() {
Node::pre_insert(node, &parent, self_node.GetNextSibling().deref()).map(Some) Node::pre_insert(node, &parent, self_node.GetNextSibling().as_deref()).map(Some)
} else { } else {
Ok(None) Ok(None)
} }
@ -1725,7 +1725,7 @@ impl Element {
} }
// Step 9 // Step 9
if doc.GetBody().deref() == self.downcast::<HTMLElement>() && if doc.GetBody().as_deref() == self.downcast::<HTMLElement>() &&
doc.quirks_mode() == QuirksMode::Quirks && doc.quirks_mode() == QuirksMode::Quirks &&
!self.potentially_scrollable() !self.potentially_scrollable()
{ {
@ -2194,7 +2194,7 @@ impl ElementMethods for Element {
} }
// Step 7 // Step 7
if doc.GetBody().deref() == self.downcast::<HTMLElement>() && if doc.GetBody().as_deref() == self.downcast::<HTMLElement>() &&
doc.quirks_mode() == QuirksMode::Quirks && doc.quirks_mode() == QuirksMode::Quirks &&
!self.potentially_scrollable() !self.potentially_scrollable()
{ {
@ -2244,7 +2244,7 @@ impl ElementMethods for Element {
} }
// Step 9 // Step 9
if doc.GetBody().deref() == self.downcast::<HTMLElement>() && if doc.GetBody().as_deref() == self.downcast::<HTMLElement>() &&
doc.quirks_mode() == QuirksMode::Quirks && doc.quirks_mode() == QuirksMode::Quirks &&
!self.potentially_scrollable() !self.potentially_scrollable()
{ {
@ -2290,7 +2290,7 @@ impl ElementMethods for Element {
} }
// Step 7 // Step 7
if doc.GetBody().deref() == self.downcast::<HTMLElement>() && if doc.GetBody().as_deref() == self.downcast::<HTMLElement>() &&
doc.quirks_mode() == QuirksMode::Quirks && doc.quirks_mode() == QuirksMode::Quirks &&
!self.potentially_scrollable() !self.potentially_scrollable()
{ {
@ -2341,7 +2341,7 @@ impl ElementMethods for Element {
} }
// Step 9 // Step 9
if doc.GetBody().deref() == self.downcast::<HTMLElement>() && if doc.GetBody().as_deref() == self.downcast::<HTMLElement>() &&
doc.quirks_mode() == QuirksMode::Quirks && doc.quirks_mode() == QuirksMode::Quirks &&
!self.potentially_scrollable() !self.potentially_scrollable()
{ {
@ -2856,7 +2856,7 @@ impl VirtualMethods for Element {
} }
let fullscreen = doc.GetFullscreenElement(); let fullscreen = doc.GetFullscreenElement();
if fullscreen.deref() == Some(self) { if fullscreen.as_deref() == Some(self) {
doc.exit_fullscreen(); doc.exit_fullscreen();
} }
if let Some(ref value) = *self.id_attribute.borrow() { if let Some(ref value) = *self.id_attribute.borrow() {

View file

@ -485,7 +485,7 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
// Step 6. // Step 6.
for object in event_path.iter().rev() { for object in event_path.iter().rev() {
invoke( invoke(
window.deref(), window.as_deref(),
object, object,
event, event,
Some(ListenerPhase::Capturing), Some(ListenerPhase::Capturing),
@ -501,7 +501,7 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
event.phase.set(EventPhase::AtTarget); event.phase.set(EventPhase::AtTarget);
// Step 8. // Step 8.
invoke(window.deref(), target, event, None); invoke(window.as_deref(), target, event, None);
if event.stop_propagation.get() { if event.stop_propagation.get() {
return; return;
} }
@ -517,7 +517,12 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve
// Step 9.2. // Step 9.2.
for object in event_path { for object in event_path {
invoke(window.deref(), object, event, Some(ListenerPhase::Bubbling)); invoke(
window.as_deref(),
object,
event,
Some(ListenerPhase::Bubbling),
);
if event.stop_propagation.get() { if event.stop_propagation.get() {
return; return;
} }

View file

@ -72,9 +72,9 @@ impl FocusEvent {
type_, type_,
bubbles, bubbles,
cancelable, cancelable,
init.parent.view.deref(), init.parent.view.as_deref(),
init.parent.detail, init.parent.detail,
init.relatedTarget.deref(), init.relatedTarget.as_deref(),
); );
Ok(event) Ok(event)
} }

View file

@ -694,7 +694,7 @@ impl HTMLElement {
.take_while(|elem| !elem.is_labelable_element()) .take_while(|elem| !elem.is_labelable_element())
.filter_map(DomRoot::downcast::<HTMLLabelElement>) .filter_map(DomRoot::downcast::<HTMLLabelElement>)
.filter(|elem| !elem.upcast::<Element>().has_attribute(&local_name!("for"))) .filter(|elem| !elem.upcast::<Element>().has_attribute(&local_name!("for")))
.filter(|elem| elem.first_labelable_descendant().deref() == Some(self)) .filter(|elem| elem.first_labelable_descendant().as_deref() == Some(self))
.map(DomRoot::upcast::<Node>); .map(DomRoot::upcast::<Node>);
let id = element.Id(); let id = element.Id();

View file

@ -1094,7 +1094,7 @@ pub trait FormControl: DomObject {
if let Some(ref new_owner) = new_owner { if let Some(ref new_owner) = new_owner {
new_owner.add_control(self); new_owner.add_control(self);
} }
self.set_form_owner(new_owner.deref()); self.set_form_owner(new_owner.as_deref());
} }
} }

View file

@ -49,7 +49,7 @@ impl HTMLHeadElement {
pub fn set_document_referrer(&self) { pub fn set_document_referrer(&self) {
let doc = document_from_node(self); let doc = document_from_node(self);
if doc.GetHead().deref() != Some(self) { if doc.GetHead().as_deref() != Some(self) {
return; return;
} }

View file

@ -903,7 +903,7 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&Atom>)
} }
} }
do_broadcast(doc.upcast(), broadcaster, owner.deref(), group) do_broadcast(doc.upcast(), broadcaster, owner.as_deref(), group)
} }
// https://html.spec.whatwg.org/multipage/#radio-button-group // https://html.spec.whatwg.org/multipage/#radio-button-group
@ -914,7 +914,7 @@ fn in_same_group(
) -> bool { ) -> bool {
other.input_type() == InputType::Radio && other.input_type() == InputType::Radio &&
// TODO Both a and b are in the same home subtree. // TODO Both a and b are in the same home subtree.
other.form_owner().deref() == owner && other.form_owner().as_deref() == owner &&
match (other.radio_group_name(), group) { match (other.radio_group_name(), group) {
(Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""), (Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""),
_ => false _ => false
@ -1647,8 +1647,10 @@ impl Activatable for HTMLInputElement {
.query_selector_iter(DOMString::from("input[type=radio]")) .query_selector_iter(DOMString::from("input[type=radio]"))
.unwrap() .unwrap()
.filter_map(DomRoot::downcast::<HTMLInputElement>) .filter_map(DomRoot::downcast::<HTMLInputElement>)
.find(|r| in_same_group(&*r, owner.deref(), group.as_ref()) && r.Checked()); .find(|r| {
cache.checked_radio = checked_member.deref().map(Dom::from_ref); in_same_group(&*r, owner.as_deref(), group.as_ref()) && r.Checked()
});
cache.checked_radio = checked_member.as_deref().map(Dom::from_ref);
cache.checked_changed = self.checked_changed.get(); cache.checked_changed = self.checked_changed.get();
self.SetChecked(true); self.SetChecked(true);
}, },
@ -1689,7 +1691,7 @@ impl Activatable for HTMLInputElement {
// we can check if the conditions for radio group siblings apply // we can check if the conditions for radio group siblings apply
if in_same_group( if in_same_group(
&o, &o,
self.form_owner().deref(), self.form_owner().as_deref(),
self.radio_group_name().as_ref(), self.radio_group_name().as_ref(),
) { ) {
o.SetChecked(true); o.SetChecked(true);

View file

@ -192,7 +192,7 @@ impl HTMLOptionsCollectionMethods for HTMLOptionsCollection {
}; };
// Step 6 // Step 6
Node::pre_insert(node, &parent, reference_node.deref()).map(|_| ()) Node::pre_insert(node, &parent, reference_node.as_deref()).map(|_| ())
} }
// https://html.spec.whatwg.org/multipage/#dom-htmloptionscollection-remove // https://html.spec.whatwg.org/multipage/#dom-htmloptionscollection-remove

View file

@ -625,7 +625,7 @@ impl HTMLScriptElement {
self.run_a_classic_script(&script); self.run_a_classic_script(&script);
// Step 6. // Step 6.
document.set_current_script(old_script.deref()); document.set_current_script(old_script.as_deref());
// Step 7. // Step 7.
if let Some(doc) = neutralized_doc { if let Some(doc) = neutralized_doc {

View file

@ -190,7 +190,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
if let Some(caption) = new_caption { if let Some(caption) = new_caption {
let node = self.upcast::<Node>(); let node = self.upcast::<Node>();
node.InsertBefore(caption.upcast(), node.GetFirstChild().deref()) node.InsertBefore(caption.upcast(), node.GetFirstChild().as_deref())
.expect("Insertion failed"); .expect("Insertion failed");
} }
} }
@ -281,7 +281,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
fn filter(&self, elem: &Element, root: &Node) -> bool { fn filter(&self, elem: &Element, root: &Node) -> bool {
elem.is::<HTMLTableSectionElement>() && elem.is::<HTMLTableSectionElement>() &&
elem.local_name() == &local_name!("tbody") && elem.local_name() == &local_name!("tbody") &&
elem.upcast::<Node>().GetParentNode().deref() == Some(root) elem.upcast::<Node>().GetParentNode().as_deref() == Some(root)
} }
} }
@ -303,7 +303,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
.find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")); .find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody"));
let reference_element = last_tbody.and_then(|t| t.upcast::<Node>().GetNextSibling()); let reference_element = last_tbody.and_then(|t| t.upcast::<Node>().GetNextSibling());
node.InsertBefore(tbody.upcast(), reference_element.deref()) node.InsertBefore(tbody.upcast(), reference_element.as_deref())
.expect("Insertion failed"); .expect("Insertion failed");
tbody tbody
} }

View file

@ -31,7 +31,7 @@ struct CellsFilter;
impl CollectionFilter for CellsFilter { impl CollectionFilter for CellsFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool { fn filter(&self, elem: &Element, root: &Node) -> bool {
(elem.is::<HTMLTableCellElement>()) && (elem.is::<HTMLTableCellElement>()) &&
elem.upcast::<Node>().GetParentNode().deref() == Some(root) elem.upcast::<Node>().GetParentNode().as_deref() == Some(root)
} }
} }

View file

@ -59,7 +59,7 @@ struct RowsFilter;
impl CollectionFilter for RowsFilter { impl CollectionFilter for RowsFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool { fn filter(&self, elem: &Element, root: &Node) -> bool {
elem.is::<HTMLTableRowElement>() && elem.is::<HTMLTableRowElement>() &&
elem.upcast::<Node>().GetParentNode().deref() == Some(root) elem.upcast::<Node>().GetParentNode().as_deref() == Some(root)
} }
} }

View file

@ -54,7 +54,7 @@ impl InputEvent {
type_, type_,
init.parent.parent.bubbles, init.parent.parent.bubbles,
init.parent.parent.cancelable, init.parent.parent.cancelable,
init.parent.view.deref(), init.parent.view.as_deref(),
init.parent.detail, init.parent.detail,
init.data.clone(), init.data.clone(),
init.isComposing, init.isComposing,

View file

@ -111,7 +111,7 @@ impl KeyboardEvent {
type_, type_,
init.parent.parent.parent.bubbles, init.parent.parent.parent.bubbles,
init.parent.parent.parent.cancelable, init.parent.parent.parent.cancelable,
init.parent.parent.view.deref(), init.parent.parent.view.as_deref(),
init.parent.parent.detail, init.parent.parent.detail,
Key::Unidentified, Key::Unidentified,
init.code.clone(), init.code.clone(),

View file

@ -119,7 +119,7 @@ impl MouseEvent {
type_, type_,
bubbles, bubbles,
cancelable, cancelable,
init.parent.parent.view.deref(), init.parent.parent.view.as_deref(),
init.parent.parent.detail, init.parent.parent.detail,
init.screenX, init.screenX,
init.screenY, init.screenY,
@ -131,7 +131,7 @@ impl MouseEvent {
init.parent.metaKey, init.parent.metaKey,
init.button, init.button,
0, 0,
init.relatedTarget.deref(), init.relatedTarget.as_deref(),
None, None,
); );
Ok(event) Ok(event)

View file

@ -244,11 +244,11 @@ impl Node {
assert!(new_child.next_sibling.get().is_none()); assert!(new_child.next_sibling.get().is_none());
match before { match before {
Some(ref before) => { Some(ref before) => {
assert!(before.parent_node.get().deref() == Some(self)); assert!(before.parent_node.get().as_deref() == Some(self));
let prev_sibling = before.GetPreviousSibling(); let prev_sibling = before.GetPreviousSibling();
match prev_sibling { match prev_sibling {
None => { None => {
assert!(self.first_child.get().deref() == Some(*before)); assert!(self.first_child.get().as_deref() == Some(*before));
self.first_child.set(Some(new_child)); self.first_child.set(Some(new_child));
}, },
Some(ref prev_sibling) => { Some(ref prev_sibling) => {
@ -334,34 +334,34 @@ impl Node {
/// ///
/// Fails unless `child` is a child of this node. /// Fails unless `child` is a child of this node.
fn remove_child(&self, child: &Node, cached_index: Option<u32>) { fn remove_child(&self, child: &Node, cached_index: Option<u32>) {
assert!(child.parent_node.get().deref() == Some(self)); assert!(child.parent_node.get().as_deref() == Some(self));
let prev_sibling = child.GetPreviousSibling(); let prev_sibling = child.GetPreviousSibling();
match prev_sibling { match prev_sibling {
None => { None => {
self.first_child.set(child.next_sibling.get().deref()); self.first_child.set(child.next_sibling.get().as_deref());
}, },
Some(ref prev_sibling) => { Some(ref prev_sibling) => {
prev_sibling prev_sibling
.next_sibling .next_sibling
.set(child.next_sibling.get().deref()); .set(child.next_sibling.get().as_deref());
}, },
} }
let next_sibling = child.GetNextSibling(); let next_sibling = child.GetNextSibling();
match next_sibling { match next_sibling {
None => { None => {
self.last_child.set(child.prev_sibling.get().deref()); self.last_child.set(child.prev_sibling.get().as_deref());
}, },
Some(ref next_sibling) => { Some(ref next_sibling) => {
next_sibling next_sibling
.prev_sibling .prev_sibling
.set(child.prev_sibling.get().deref()); .set(child.prev_sibling.get().as_deref());
}, },
} }
let context = UnbindContext::new( let context = UnbindContext::new(
self, self,
prev_sibling.deref(), prev_sibling.as_deref(),
next_sibling.deref(), next_sibling.as_deref(),
cached_index, cached_index,
); );
@ -759,7 +759,7 @@ impl Node {
document != window.Document(), document != window.Document(),
is_body_element, is_body_element,
document.quirks_mode(), document.quirks_mode(),
html_element.deref() == self.downcast::<Element>(), html_element.as_deref() == self.downcast::<Element>(),
) { ) {
// Step 2 && Step 5 // Step 2 && Step 5
(true, _, _, _) | (_, false, QuirksMode::Quirks, true) => Rect::zero(), (true, _, _, _) | (_, false, QuirksMode::Quirks, true) => Rect::zero(),
@ -806,7 +806,7 @@ impl Node {
}; };
// Step 6. // Step 6.
Node::pre_insert(&node, &parent, viable_previous_sibling.deref())?; Node::pre_insert(&node, &parent, viable_previous_sibling.as_deref())?;
Ok(()) Ok(())
} }
@ -829,7 +829,7 @@ impl Node {
let node = self.owner_doc().node_from_nodes_and_strings(nodes)?; let node = self.owner_doc().node_from_nodes_and_strings(nodes)?;
// Step 5. // Step 5.
Node::pre_insert(&node, &parent, viable_next_sibling.deref())?; Node::pre_insert(&node, &parent, viable_next_sibling.as_deref())?;
Ok(()) Ok(())
} }
@ -852,7 +852,7 @@ impl Node {
parent.ReplaceChild(&node, self)?; parent.ReplaceChild(&node, self)?;
} else { } else {
// Step 6. // Step 6.
Node::pre_insert(&node, &parent, viable_next_sibling.deref())?; Node::pre_insert(&node, &parent, viable_next_sibling.as_deref())?;
} }
Ok(()) Ok(())
} }
@ -864,7 +864,7 @@ impl Node {
let node = doc.node_from_nodes_and_strings(nodes)?; let node = doc.node_from_nodes_and_strings(nodes)?;
// Step 2. // Step 2.
let first_child = self.first_child.get(); let first_child = self.first_child.get();
Node::pre_insert(&node, self, first_child.deref()).map(|_| ()) Node::pre_insert(&node, self, first_child.as_deref()).map(|_| ())
} }
// https://dom.spec.whatwg.org/#dom-parentnode-append // https://dom.spec.whatwg.org/#dom-parentnode-append
@ -1072,7 +1072,7 @@ impl Node {
None => return Err(Error::IndexSize), None => return Err(Error::IndexSize),
Some(node) => node, Some(node) => node,
}; };
self.InsertBefore(tr_node, node.deref())?; self.InsertBefore(tr_node, node.as_deref())?;
} }
} }
@ -1839,7 +1839,7 @@ impl Node {
let reference_child = match child { let reference_child = match child {
Some(child) if child == node => { Some(child) if child == node => {
reference_child_root = node.GetNextSibling(); reference_child_root = node.GetNextSibling();
reference_child_root.deref() reference_child_root.as_deref()
}, },
_ => child, _ => child,
}; };
@ -1869,7 +1869,8 @@ impl Node {
) { ) {
node.owner_doc().add_script_and_layout_blocker(); node.owner_doc().add_script_and_layout_blocker();
debug_assert!(&*node.owner_doc() == &*parent.owner_doc()); debug_assert!(&*node.owner_doc() == &*parent.owner_doc());
debug_assert!(child.map_or(true, |child| Some(parent) == child.GetParentNode().deref())); debug_assert!(child.map_or(true, |child| Some(parent) ==
child.GetParentNode().as_deref()));
// Step 1. // Step 1.
let count = if node.is::<DocumentFragment>() { let count = if node.is::<DocumentFragment>() {
@ -1944,7 +1945,7 @@ impl Node {
} }
if let SuppressObserver::Unsuppressed = suppress_observers { if let SuppressObserver::Unsuppressed = suppress_observers {
vtable_for(&parent).children_changed(&ChildrenMutation::insert( vtable_for(&parent).children_changed(&ChildrenMutation::insert(
previous_sibling.deref(), previous_sibling.as_deref(),
new_nodes, new_nodes,
child, child,
)); ));
@ -1952,7 +1953,7 @@ impl Node {
let mutation = Mutation::ChildList { let mutation = Mutation::ChildList {
added: Some(new_nodes), added: Some(new_nodes),
removed: None, removed: None,
prev: previous_sibling.deref(), prev: previous_sibling.as_deref(),
next: child, next: child,
}; };
MutationObserver::queue_a_mutation_record(&parent, mutation); MutationObserver::queue_a_mutation_record(&parent, mutation);
@ -2055,18 +2056,18 @@ impl Node {
// Step 12. // Step 12.
if let SuppressObserver::Unsuppressed = suppress_observers { if let SuppressObserver::Unsuppressed = suppress_observers {
vtable_for(&parent).children_changed(&ChildrenMutation::replace( vtable_for(&parent).children_changed(&ChildrenMutation::replace(
old_previous_sibling.deref(), old_previous_sibling.as_deref(),
&Some(&node), &Some(&node),
&[], &[],
old_next_sibling.deref(), old_next_sibling.as_deref(),
)); ));
let removed = [node]; let removed = [node];
let mutation = Mutation::ChildList { let mutation = Mutation::ChildList {
added: None, added: None,
removed: Some(&removed), removed: Some(&removed),
prev: old_previous_sibling.deref(), prev: old_previous_sibling.as_deref(),
next: old_next_sibling.deref(), next: old_next_sibling.as_deref(),
}; };
MutationObserver::queue_a_mutation_record(&parent, mutation); MutationObserver::queue_a_mutation_record(&parent, mutation);
} }
@ -2402,7 +2403,7 @@ impl NodeMethods for Node {
}; };
// Step 3. // Step 3.
Node::replace_all(node.deref(), self); Node::replace_all(node.as_deref(), self);
}, },
NodeTypeId::CharacterData(..) => { NodeTypeId::CharacterData(..) => {
let characterdata = self.downcast::<CharacterData>().unwrap(); let characterdata = self.downcast::<CharacterData>().unwrap();
@ -2508,10 +2509,10 @@ impl NodeMethods for Node {
// Step 7-8. // Step 7-8.
let child_next_sibling = child.GetNextSibling(); let child_next_sibling = child.GetNextSibling();
let node_next_sibling = node.GetNextSibling(); let node_next_sibling = node.GetNextSibling();
let reference_child = if child_next_sibling.deref() == Some(node) { let reference_child = if child_next_sibling.as_deref() == Some(node) {
node_next_sibling.deref() node_next_sibling.as_deref()
} else { } else {
child_next_sibling.deref() child_next_sibling.as_deref()
}; };
// Step 9. // Step 9.
@ -2546,7 +2547,7 @@ impl NodeMethods for Node {
// Step 14. // Step 14.
vtable_for(&self).children_changed(&ChildrenMutation::replace( vtable_for(&self).children_changed(&ChildrenMutation::replace(
previous_sibling.deref(), previous_sibling.as_deref(),
&removed_child, &removed_child,
nodes, nodes,
reference_child, reference_child,
@ -2555,7 +2556,7 @@ impl NodeMethods for Node {
let mutation = Mutation::ChildList { let mutation = Mutation::ChildList {
added: Some(nodes), added: Some(nodes),
removed: removed.as_ref().map(|r| &r[..]), removed: removed.as_ref().map(|r| &r[..]),
prev: previous_sibling.deref(), prev: previous_sibling.as_deref(),
next: reference_child, next: reference_child,
}; };
MutationObserver::queue_a_mutation_record(&self, mutation); MutationObserver::queue_a_mutation_record(&self, mutation);

View file

@ -132,7 +132,7 @@ impl ChildrenList {
let last_visited = node.GetFirstChild(); let last_visited = node.GetFirstChild();
ChildrenList { ChildrenList {
node: Dom::from_ref(node), node: Dom::from_ref(node),
last_visited: MutNullableDom::new(last_visited.deref()), last_visited: MutNullableDom::new(last_visited.as_deref()),
last_index: Cell::new(0u32), last_index: Cell::new(0u32),
} }
} }
@ -315,7 +315,7 @@ impl ChildrenList {
} }
fn reset(&self) { fn reset(&self) {
self.last_visited.set(self.node.GetFirstChild().deref()); self.last_visited.set(self.node.GetFirstChild().as_deref());
self.last_index.set(0u32); self.last_index.set(0u32);
} }
} }

View file

@ -756,7 +756,7 @@ impl RangeMethods for Range {
}; };
// Step 6. // Step 6.
Node::ensure_pre_insertion_validity(node, &parent, reference_node.deref())?; Node::ensure_pre_insertion_validity(node, &parent, reference_node.as_deref())?;
// Step 7. // Step 7.
let split_text; let split_text;
@ -764,14 +764,14 @@ impl RangeMethods for Range {
Some(text) => { Some(text) => {
split_text = text.SplitText(start_offset)?; split_text = text.SplitText(start_offset)?;
let new_reference = DomRoot::upcast::<Node>(split_text); let new_reference = DomRoot::upcast::<Node>(split_text);
assert!(new_reference.GetParentNode().deref() == Some(&parent)); assert!(new_reference.GetParentNode().as_deref() == Some(&parent));
Some(new_reference) Some(new_reference)
}, },
_ => reference_node, _ => reference_node,
}; };
// Step 8. // Step 8.
let reference_node = if Some(node) == reference_node.deref() { let reference_node = if Some(node) == reference_node.as_deref() {
node.GetNextSibling() node.GetNextSibling()
} else { } else {
reference_node reference_node
@ -794,7 +794,7 @@ impl RangeMethods for Range {
}; };
// Step 12. // Step 12.
Node::pre_insert(node, &parent, reference_node.deref())?; Node::pre_insert(node, &parent, reference_node.as_deref())?;
// Step 13. // Step 13.
if self.Collapsed() { if self.Collapsed() {
@ -989,7 +989,7 @@ impl RangeMethods for Range {
}; };
// Step 2. // Step 2.
let element = Element::fragment_parsing_context(&owner_doc, element.deref()); let element = Element::fragment_parsing_context(&owner_doc, element.as_deref());
// Step 3. // Step 3.
let fragment_node = element.parse_fragment(fragment)?; let fragment_node = element.parse_fragment(fragment)?;

View file

@ -199,7 +199,7 @@ impl ServoParser {
let fragment_context = FragmentContext { let fragment_context = FragmentContext {
context_elem: context_node, context_elem: context_node,
form_elem: form.deref(), form_elem: form.as_deref(),
}; };
let parser = ServoParser::new( let parser = ServoParser::new(

View file

@ -91,7 +91,7 @@ impl StorageEvent {
let oldValue = init.oldValue.clone(); let oldValue = init.oldValue.clone();
let newValue = init.newValue.clone(); let newValue = init.newValue.clone();
let url = init.url.clone(); let url = init.url.clone();
let storageArea = init.storageArea.deref(); let storageArea = init.storageArea.as_deref();
let bubbles = EventBubbles::from(init.parent.bubbles); let bubbles = EventBubbles::from(init.parent.bubbles);
let cancelable = EventCancelable::from(init.parent.cancelable); let cancelable = EventCancelable::from(init.parent.cancelable);
let event = StorageEvent::new( let event = StorageEvent::new(

View file

@ -68,7 +68,7 @@ impl TextMethods for Text {
if let Some(ref parent) = parent { if let Some(ref parent) = parent {
// Step 7.1. // Step 7.1.
parent parent
.InsertBefore(new_node.upcast(), node.GetNextSibling().deref()) .InsertBefore(new_node.upcast(), node.GetNextSibling().as_deref())
.unwrap(); .unwrap();
// Steps 7.2-3. // Steps 7.2-3.
node.ranges() node.ranges()

View file

@ -73,7 +73,7 @@ impl UIEvent {
type_, type_,
bubbles, bubbles,
cancelable, cancelable,
init.view.deref(), init.view.as_deref(),
init.detail, init.detail,
); );
Ok(event) Ok(event)

View file

@ -43,7 +43,6 @@ use ipc_channel::ipc::IpcSender;
use profile_traits::ipc; use profile_traits::ipc;
use std::cell::Cell; use std::cell::Cell;
use std::mem; use std::mem;
use std::ops::Deref;
use std::rc::Rc; use std::rc::Rc;
use std::thread; use std::thread;
use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRPoseInformation}; use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRPoseInformation};
@ -136,7 +135,7 @@ impl VRDisplay {
display.capabilities.clone(), display.capabilities.clone(),
&global, &global,
)), )),
stage_params: MutNullableDom::new(stage.as_ref().map(|v| v.deref())), stage_params: MutNullableDom::new(stage.as_deref()),
frame_data: DomRefCell::new(Default::default()), frame_data: DomRefCell::new(Default::default()),
layer: DomRefCell::new(Default::default()), layer: DomRefCell::new(Default::default()),
layer_ctx: MutNullableDom::default(), layer_ctx: MutNullableDom::default(),
@ -279,7 +278,7 @@ impl VRDisplayMethods for VRDisplay {
// https://w3c.github.io/webvr/#dom-vrdisplay-depthnear // https://w3c.github.io/webvr/#dom-vrdisplay-depthnear
fn SetDepthNear(&self, value: Finite<f64>) { fn SetDepthNear(&self, value: Finite<f64>) {
self.depth_near.set(*value.deref()); self.depth_near.set(*value);
} }
// https://w3c.github.io/webvr/#dom-vrdisplay-depthfar // https://w3c.github.io/webvr/#dom-vrdisplay-depthfar
@ -289,7 +288,7 @@ impl VRDisplayMethods for VRDisplay {
// https://w3c.github.io/webvr/#dom-vrdisplay-depthfar // https://w3c.github.io/webvr/#dom-vrdisplay-depthfar
fn SetDepthFar(&self, value: Finite<f64>) { fn SetDepthFar(&self, value: Finite<f64>) {
self.depth_far.set(*value.deref()); self.depth_far.set(*value);
} }
// https://w3c.github.io/webvr/#dom-vrdisplay-requestanimationframe // https://w3c.github.io/webvr/#dom-vrdisplay-requestanimationframe
@ -465,7 +464,7 @@ impl VRDisplay {
if let Some(ref stage) = display.stage_parameters { if let Some(ref stage) = display.stage_parameters {
if self.stage_params.get().is_none() { if self.stage_params.get().is_none() {
let params = Some(VRStageParameters::new(stage.clone(), &self.global())); let params = Some(VRStageParameters::new(stage.clone(), &self.global()));
self.stage_params.set(params.as_ref().map(|v| v.deref())); self.stage_params.set(params.as_deref());
} else { } else {
self.stage_params.get().unwrap().update(&stage); self.stage_params.get().unwrap().update(&stage);
} }
@ -510,7 +509,7 @@ impl VRDisplay {
match recv { match recv {
Ok(()) => { Ok(()) => {
*this.layer.borrow_mut() = layer_bounds; *this.layer.borrow_mut() = layer_bounds;
this.layer_ctx.set(ctx.as_ref().map(|c| &**c)); this.layer_ctx.set(ctx.as_deref());
this.init_present(); this.init_present();
promise.map(resolve); promise.map(resolve);
}, },
@ -808,7 +807,7 @@ fn parse_bounds(src: &Option<Vec<Finite<f32>>>, dst: &mut [f32; 4]) -> Result<()
); );
} }
for i in 0..4 { for i in 0..4 {
dst[i] = *values[i].deref(); dst[i] = *values[i];
} }
Ok(()) Ok(())
}, },

View file

@ -83,7 +83,7 @@ impl WheelEvent {
type_, type_,
EventBubbles::from(init.parent.parent.parent.parent.bubbles), EventBubbles::from(init.parent.parent.parent.parent.bubbles),
EventCancelable::from(init.parent.parent.parent.parent.cancelable), EventCancelable::from(init.parent.parent.parent.parent.cancelable),
init.parent.parent.parent.view.deref(), init.parent.parent.parent.view.as_deref(),
init.parent.parent.parent.detail, init.parent.parent.parent.detail,
init.deltaX, init.deltaX,
init.deltaY, init.deltaY,
@ -148,7 +148,7 @@ impl WheelEventMethods for WheelEvent {
self.mouseevent.ShiftKey(), self.mouseevent.ShiftKey(),
self.mouseevent.MetaKey(), self.mouseevent.MetaKey(),
self.mouseevent.Button(), self.mouseevent.Button(),
self.mouseevent.GetRelatedTarget().deref(), self.mouseevent.GetRelatedTarget().as_deref(),
); );
self.delta_x.set(delta_x_arg); self.delta_x.set(delta_x_arg);
self.delta_y.set(delta_y_arg); self.delta_y.set(delta_y_arg);

View file

@ -525,7 +525,7 @@ impl WindowProxy {
} }
pub fn frame_element(&self) -> Option<&Element> { pub fn frame_element(&self) -> Option<&Element> {
self.frame_element.deref() self.frame_element.as_deref()
} }
pub fn document(&self) -> Option<DomRoot<Document>> { pub fn document(&self) -> Option<DomRoot<Document>> {
@ -535,7 +535,7 @@ impl WindowProxy {
} }
pub fn parent(&self) -> Option<&WindowProxy> { pub fn parent(&self) -> Option<&WindowProxy> {
self.parent.deref() self.parent.as_deref()
} }
pub fn top(&self) -> &WindowProxy { pub fn top(&self) -> &WindowProxy {

View file

@ -2997,7 +2997,7 @@ impl ScriptThread {
global_to_clone, global_to_clone,
browsing_context_id, browsing_context_id,
top_level_browsing_context_id, top_level_browsing_context_id,
parent.deref(), parent.as_deref(),
opener, opener,
); );
self.window_proxies self.window_proxies
@ -3043,8 +3043,8 @@ impl ScriptThread {
&window, &window,
browsing_context_id, browsing_context_id,
top_level_browsing_context_id, top_level_browsing_context_id,
iframe.deref().map(Castable::upcast), iframe.as_deref().map(Castable::upcast),
parent.deref(), parent.as_deref(),
opener, opener,
); );
self.window_proxies self.window_proxies

View file

@ -32,7 +32,7 @@ macro_rules! task {
pub trait TaskOnce: Send { pub trait TaskOnce: Send {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn name(&self) -> &'static str { fn name(&self) -> &'static str {
unsafe { ::std::intrinsics::type_name::<Self>() } ::std::any::type_name::<Self>()
} }
fn run_once(self); fn run_once(self);

View file

@ -996,7 +996,8 @@ impl<T: ClipboardProvider> TextInput<T> {
self.lines self.lines
.iter() .iter()
.fold(UTF16CodeUnits::zero(), |m, l| { .fold(UTF16CodeUnits::zero(), |m, l| {
m + UTF16CodeUnits(l.chars().map(char::len_utf16).sum::<usize>() + 1) // + 1 for the '\n' m + UTF16CodeUnits(l.chars().map(char::len_utf16).sum::<usize>() + 1)
// + 1 for the '\n'
}) })
.saturating_sub(UTF16CodeUnits::one()) .saturating_sub(UTF16CodeUnits::one())
} }

View file

@ -971,7 +971,6 @@ mod gecko_leak_checking {
NS_LogDtor(ptr as *mut c_void, s, size_of::<RuleNode>() as u32); NS_LogDtor(ptr as *mut c_void, s, size_of::<RuleNode>() as u32);
} }
} }
} }
#[inline(always)] #[inline(always)]

View file

@ -1 +1 @@
nightly-2019-07-22 nightly-2019-07-31