diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-06-18 20:49:03 +0530 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-06-27 18:50:32 -0600 |
commit | f5b5b337d3fd5eb6632e3133486e16eeea7566a5 (patch) | |
tree | 2c0f5a6ebc85a487a6f72976f021b555ce593da8 /src | |
parent | 56dd5b943eb9652e160d6701c67eb1ff44eeee2a (diff) | |
download | servo-f5b5b337d3fd5eb6632e3133486e16eeea7566a5.tar.gz servo-f5b5b337d3fd5eb6632e3133486e16eeea7566a5.zip |
Upgrade to latest Rust.
Diffstat (limited to 'src')
99 files changed, 253 insertions, 237 deletions
diff --git a/src/compiler/rust b/src/compiler/rust -Subproject 0935beba717bf6d3b54ad1b2eace359dea5dfca +Subproject 9f8d2205f0518389993a9b5de6646ba8b14e5a1 diff --git a/src/compiler/rust-snapshot-hash b/src/compiler/rust-snapshot-hash index 76aadf38dd4..7be9e769eb3 100644 --- a/src/compiler/rust-snapshot-hash +++ b/src/compiler/rust-snapshot-hash @@ -1 +1 @@ -0935beba717bf6d3b54ad1b2eace359dea5dfca0/rust-0.11.0-pre +9f8d2205f0518389993a9b5de6646ba8b14e5a12/rust-0.11.0-pre diff --git a/src/components/gfx/buffer_map.rs b/src/components/gfx/buffer_map.rs index 9b3a6f60988..2d052b09553 100644 --- a/src/components/gfx/buffer_map.rs +++ b/src/components/gfx/buffer_map.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use geom::size::Size2D; use layers::platform::surface::NativePaintingGraphicsContext; use servo_msg::compositor_msg::Tile; @@ -26,7 +26,7 @@ pub struct BufferMap<T> { } /// A key with which to store buffers. It is based on the size of the buffer. -#[deriving(TotalEq)] +#[deriving(Eq)] struct BufferKey([uint, ..2]); impl Hash for BufferKey { @@ -36,7 +36,7 @@ impl Hash for BufferKey { } } -impl Eq for BufferKey { +impl PartialEq for BufferKey { fn eq(&self, other: &BufferKey) -> bool { let BufferKey(s) = *self; let BufferKey(o) = *other; diff --git a/src/components/gfx/display_list/mod.rs b/src/components/gfx/display_list/mod.rs index a0695e98d3a..15d39896051 100644 --- a/src/components/gfx/display_list/mod.rs +++ b/src/components/gfx/display_list/mod.rs @@ -19,7 +19,7 @@ use render_context::RenderContext; use text::glyph::CharIndex; use text::TextRun; -use collections::deque::Deque; +use std::collections::Deque; use collections::dlist::DList; use collections::dlist; use geom::{Point2D, Rect, SideOffsets2D, Size2D}; @@ -41,7 +41,7 @@ pub mod optimizer; /// Because the script task's GC does not trace layout, node data cannot be safely stored in layout /// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for /// locality reasons. Using `OpaqueNode` enforces this invariant. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct OpaqueNode(pub uintptr_t); impl OpaqueNode { @@ -53,7 +53,7 @@ impl OpaqueNode { } /// "Steps" as defined by CSS 2.1 § E.2. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum StackingLevel { /// The border and backgrounds for the root of this stacking context: steps 1 and 2. BackgroundAndBordersStackingLevel, diff --git a/src/components/gfx/display_list/optimizer.rs b/src/components/gfx/display_list/optimizer.rs index 82484bb5738..54ea4227ce8 100644 --- a/src/components/gfx/display_list/optimizer.rs +++ b/src/components/gfx/display_list/optimizer.rs @@ -6,7 +6,7 @@ use display_list::{BorderDisplayItemClass, ClipDisplayItem, ClipDisplayItemClass use display_list::{DisplayList, ImageDisplayItemClass, LineDisplayItemClass}; use display_list::{PseudoDisplayItemClass, SolidColorDisplayItemClass, TextDisplayItemClass}; -use collections::deque::Deque; +use std::collections::Deque; use collections::dlist::DList; use geom::rect::Rect; use servo_util::geometry::Au; diff --git a/src/components/gfx/font.rs b/src/components/gfx/font.rs index 36503e33960..9548237d49b 100644 --- a/src/components/gfx/font.rs +++ b/src/components/gfx/font.rs @@ -94,7 +94,7 @@ pub struct FontMetrics { // the instance's properties. // // For now, the cases are differentiated with a typedef -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct FontStyle { pub pt_size: f64, pub weight: font_weight::T, @@ -112,7 +112,7 @@ pub type UsedFontStyle = FontStyle; // It's used to swizzle/unswizzle gfx::Font instances when // communicating across tasks, such as the display list between layout // and render tasks. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct FontDescriptor { pub style: UsedFontStyle, pub selector: FontSelector, @@ -128,7 +128,7 @@ impl FontDescriptor { } // A FontSelector is a platform-specific strategy for serializing face names. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum FontSelector { SelectorPlatformIdentifier(String), } diff --git a/src/components/gfx/font_context.rs b/src/components/gfx/font_context.rs index aca8b1b1a44..9e8766bd3d0 100644 --- a/src/components/gfx/font_context.rs +++ b/src/components/gfx/font_context.rs @@ -9,7 +9,7 @@ use platform::font::FontHandle; use platform::font_context::FontContextHandle; use azure::azure_hl::BackendType; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use servo_util::cache::{Cache, LRUCache}; use servo_util::time::TimeProfilerChan; diff --git a/src/components/gfx/font_list.rs b/src/components/gfx/font_list.rs index 9b0ee93ffe0..6a208107c07 100644 --- a/src/components/gfx/font_list.rs +++ b/src/components/gfx/font_list.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use font::SpecifiedFontStyle; use gfx_font::FontHandleMethods; use platform::font::FontHandle; diff --git a/src/components/gfx/gfx.rs b/src/components/gfx/gfx.rs index f5b2229ce00..fcdb44f4815 100644 --- a/src/components/gfx/gfx.rs +++ b/src/components/gfx/gfx.rs @@ -10,7 +10,7 @@ #![feature(globs, macro_rules, phase)] #![feature(phase)] -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate log; extern crate debug; @@ -21,10 +21,10 @@ extern crate layers; extern crate libc; extern crate stb_image; extern crate png; -#[phase(syntax)] +#[phase(plugin)] extern crate servo_macros = "macros"; extern crate servo_net = "net"; -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate servo_util = "util"; extern crate servo_msg = "msg"; extern crate style; diff --git a/src/components/gfx/platform/android/font_list.rs b/src/components/gfx/platform/android/font_list.rs index 150646c9840..db990e55af2 100644 --- a/src/components/gfx/platform/android/font_list.rs +++ b/src/components/gfx/platform/android/font_list.rs @@ -25,7 +25,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap}; use platform::font::FontHandle; use platform::font_context::FontContextHandle; -use collections::HashMap; +use std::collections::hashmap::HashMap; use libc; use libc::{c_int, c_char}; use std::ptr; diff --git a/src/components/gfx/platform/linux/font_list.rs b/src/components/gfx/platform/linux/font_list.rs index cbec136d20d..6f7c0b4bc78 100644 --- a/src/components/gfx/platform/linux/font_list.rs +++ b/src/components/gfx/platform/linux/font_list.rs @@ -27,7 +27,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap}; use platform::font::FontHandle; use platform::font_context::FontContextHandle; -use collections::HashMap; +use std::collections::hashmap::HashMap; use libc; use libc::{c_int, c_char}; use std::ptr; diff --git a/src/components/gfx/platform/macos/font_list.rs b/src/components/gfx/platform/macos/font_list.rs index 824e59df3cb..8f332bd24f4 100644 --- a/src/components/gfx/platform/macos/font_list.rs +++ b/src/components/gfx/platform/macos/font_list.rs @@ -7,7 +7,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap}; use platform::macos::font::FontHandle; use platform::macos::font_context::FontContextHandle; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use core_foundation::base::TCFType; use core_foundation::string::{CFString, CFStringRef}; use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef}; diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index 67091548fac..53479482a00 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -7,7 +7,7 @@ use servo_util::range; use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex}; use servo_util::geometry::Au; -use std::cmp::{Ord, Eq}; +use std::cmp::{PartialOrd, PartialEq}; use std::num::{NumCast, Zero}; use std::mem; use std::u16; @@ -87,7 +87,7 @@ impl GlyphEntry { pub type GlyphId = u32; // TODO: unify with bit flags? -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum BreakType { BreakTypeNone, BreakTypeNormal, @@ -270,7 +270,7 @@ impl DetailedGlyph { } } -#[deriving(Eq, Clone, TotalEq)] +#[deriving(PartialEq, Clone, Eq)] struct DetailedGlyphRecord { // source string offset/GlyphEntry offset in the TextRun entry_offset: CharIndex, @@ -278,13 +278,13 @@ struct DetailedGlyphRecord { detail_offset: int, } -impl Ord for DetailedGlyphRecord { +impl PartialOrd for DetailedGlyphRecord { fn lt(&self, other: &DetailedGlyphRecord) -> bool { self.entry_offset < other.entry_offset } } -impl TotalOrd for DetailedGlyphRecord { +impl Ord for DetailedGlyphRecord { fn cmp(&self, other: &DetailedGlyphRecord) -> Ordering { self.entry_offset.cmp(&other.entry_offset) } diff --git a/src/components/gfx/text/util.rs b/src/components/gfx/text/util.rs index f3102e0189a..03787dcc564 100644 --- a/src/components/gfx/text/util.rs +++ b/src/components/gfx/text/util.rs @@ -4,7 +4,7 @@ use text::glyph::CharIndex; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum CompressionMode { CompressNone, CompressWhitespace, @@ -82,7 +82,7 @@ pub fn transform_text(text: &str, mode: CompressionMode, } }; - return (out_str.into_owned(), out_whitespace); + return (out_str.into_string(), out_whitespace); fn is_in_whitespace(ch: char, mode: CompressionMode) -> bool { match (ch, mode) { diff --git a/src/components/macros/macros.rs b/src/components/macros/macros.rs index 30cf4baf9fe..a2d9a797303 100644 --- a/src/components/macros/macros.rs +++ b/src/components/macros/macros.rs @@ -61,14 +61,13 @@ macro_rules! lazy_init( #[cfg(test)] mod tests { - extern crate collections; - + use std::collections::hashmap::HashMap; lazy_init! { static ref NUMBER: uint = times_two(3); static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3]; static ref OWNED_STRING: String = "hello".to_string(); - static ref HASHMAP: collections::HashMap<uint, &'static str> = { - let mut m = collections::HashMap::new(); + static ref HASHMAP: HashMap<uint, &'static str> = { + let mut m = HashMap::new(); m.insert(0u, "abc"); m.insert(1, "def"); m.insert(2, "ghi"); diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index c3292946988..6272a688b5b 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -386,9 +386,10 @@ impl IOCompositor { self.root_layer.remove_all_children(); + let new_layer_id = new_layer.id; assert!(new_layer.add_child_if_necessary(self.root_layer.clone(), root_pipeline_id, - new_layer.id, + new_layer_id, layer_id, Rect(Point2D(0f32, 0f32), size), size, @@ -414,13 +415,14 @@ impl IOCompositor { scroll_policy: ScrollPolicy) { match self.compositor_layer { Some(ref mut compositor_layer) => { + let compositor_layer_id = compositor_layer.id; + let page_size = compositor_layer.page_size.unwrap(); assert!(compositor_layer.add_child_if_necessary(self.root_layer.clone(), pipeline_id, - compositor_layer.id, + compositor_layer_id, layer_id, rect, - compositor_layer.page_size - .unwrap(), + page_size, scroll_policy)) } None => fail!("Compositor: Received new layer without initialized pipeline"), diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index 91a6b7126bb..268236efdce 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -122,7 +122,7 @@ impl MaybeQuadtree { } } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum WantsScrollEventsFlag { WantsScrollEvents, DoesntWantScrollEvents, @@ -345,8 +345,8 @@ impl CompositorLayer { if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) { return false } - - self.scroll(self.scroll_offset) + let offset = self.scroll_offset; + self.scroll(offset) } #[allow(dead_code)] @@ -616,8 +616,8 @@ impl CompositorLayer { if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) { return false; } - - self.scroll(self.scroll_offset) + let offset = self.scroll_offset; + self.scroll(offset) } // Returns whether the layer should be vertically flipped. diff --git a/src/components/main/compositing/quadtree.rs b/src/components/main/compositing/quadtree.rs index a26c69deaae..f3b4e44e301 100644 --- a/src/components/main/compositing/quadtree.rs +++ b/src/components/main/compositing/quadtree.rs @@ -52,7 +52,7 @@ struct QuadtreeNode<T> { /// The status of a QuadtreeNode. This determines the behavior of the node /// when querying for tile requests. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum NodeStatus { /// If we have no valid tile, request one; otherwise, don't send a request. Normal, diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index e185d90aa99..c70bc948b5a 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -4,7 +4,7 @@ use compositing::{CompositorChan, LoadComplete, SetIds, SetLayerClipRect, ShutdownComplete}; -use collections::hashmap::{HashMap, HashSet}; +use std::collections::hashmap::{HashMap, HashSet}; use geom::rect::{Rect, TypedRect}; use geom::scale_factor::ScaleFactor; use geom::size::TypedSize2D; diff --git a/src/components/main/css/matching.rs b/src/components/main/css/matching.rs index 73c9ef1d2a6..94dacb79cbd 100644 --- a/src/components/main/css/matching.rs +++ b/src/components/main/css/matching.rs @@ -66,7 +66,7 @@ impl ApplicableDeclarationsCacheEntry { } } -impl Eq for ApplicableDeclarationsCacheEntry { +impl PartialEq for ApplicableDeclarationsCacheEntry { fn eq(&self, other: &ApplicableDeclarationsCacheEntry) -> bool { let this_as_query = ApplicableDeclarationsCacheQuery::new(self.declarations.as_slice()); this_as_query.equiv(other) @@ -169,7 +169,7 @@ pub struct StyleSharingCandidate { pub class: Option<DOMString>, } -impl Eq for StyleSharingCandidate { +impl PartialEq for StyleSharingCandidate { fn eq(&self, other: &StyleSharingCandidate) -> bool { arc_ptr_eq(&self.style, &other.style) && arc_ptr_eq(&self.parent_style, &other.parent_style) && diff --git a/src/components/main/layout/block.rs b/src/components/main/layout/block.rs index 5568b9553b0..0d033934f4f 100644 --- a/src/components/main/layout/block.rs +++ b/src/components/main/layout/block.rs @@ -449,13 +449,13 @@ enum BlockType { FloatNonReplacedType, } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum MarginsMayCollapseFlag { MarginsMayCollapse, MarginsMayNotCollapse, } -#[deriving(Eq)] +#[deriving(PartialEq)] enum FormattingContextType { NonformattingContext, BlockFormattingContext, diff --git a/src/components/main/layout/flow.rs b/src/components/main/layout/flow.rs index dc8145d314c..20c8d2db965 100644 --- a/src/components/main/layout/flow.rs +++ b/src/components/main/layout/flow.rs @@ -380,7 +380,7 @@ pub trait MutableOwnedFlowUtils { fn set_abs_descendants(&mut self, abs_descendants: AbsDescendants); } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum FlowClass { BlockFlowClass, InlineFlowClass, diff --git a/src/components/main/layout/flow_list.rs b/src/components/main/layout/flow_list.rs index a68193a32aa..3d1cccbdce1 100644 --- a/src/components/main/layout/flow_list.rs +++ b/src/components/main/layout/flow_list.rs @@ -82,7 +82,7 @@ unsafe fn link_with_prev(mut next: FlowRef, prev: Option<FlowRef>) -> Link { Some(next) } -impl Container for FlowList { +impl Collection for FlowList { /// O(1) #[inline] fn is_empty(&self) -> bool { diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 92992e01446..e3080340c59 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -151,7 +151,7 @@ int_range_index! { /// A line index consists of two indices: a fragment index that refers to the /// index of a DOM fragment within a flattened inline element; and a glyph index /// where the 0th glyph refers to the first glyph of that fragment. -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Zero)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Zero)] pub struct LineIndices { /// The index of a fragment into the flattened vector of DOM elements. /// @@ -1109,9 +1109,10 @@ impl Flow for InlineFlow { debug!("InlineFlow::assign_widths: floats in: {:?}", self.base.floats); { + let width = self.base.position.size.width; let this = &mut *self; for (fragment, context) in this.fragments.mut_iter() { - fragment.assign_replaced_width_if_necessary(self.base.position.size.width, + fragment.assign_replaced_width_if_necessary(width, Some(context)) } } diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index f096fd97ddc..cb86cf92020 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -895,7 +895,7 @@ impl LayoutTask { // to the script task, and ultimately cause the image to be // re-requested. We probably don't need to go all the way back to // the script task for this. - fn make_on_image_available_cb(&self) -> Box<ImageResponder:Send> { + fn make_on_image_available_cb(&self) -> Box<ImageResponder+Send> { // This has a crazy signature because the image cache needs to // make multiple copies of the callback, and the dom event // channel is not a copyable type, so this is actually a @@ -903,7 +903,7 @@ impl LayoutTask { box LayoutImageResponder { id: self.id.clone(), script_chan: self.script_chan.clone(), - } as Box<ImageResponder:Send> + } as Box<ImageResponder+Send> } /// Handles a message to destroy layout data. Layout data must be destroyed on *this* task diff --git a/src/components/main/layout/text.rs b/src/components/main/layout/text.rs index 41082b8ed6e..54fef44714f 100644 --- a/src/components/main/layout/text.rs +++ b/src/components/main/layout/text.rs @@ -219,7 +219,7 @@ impl TextRunScanner { let run = if clump.length() != CharIndex(0) && run_str.len() > 0 { Some(Arc::new(box TextRun::new( &mut *fontgroup.borrow().fonts.get(0).borrow_mut(), - run_str.into_owned(), decoration))) + run_str.to_string(), decoration))) } else { None }; diff --git a/src/components/main/layout/wrapper.rs b/src/components/main/layout/wrapper.rs index 73dd2483a71..71b6b2b6d6b 100644 --- a/src/components/main/layout/wrapper.rs +++ b/src/components/main/layout/wrapper.rs @@ -150,7 +150,7 @@ impl<'ln> Clone for LayoutNode<'ln> { } } -impl<'a> Eq for LayoutNode<'a> { +impl<'a> PartialEq for LayoutNode<'a> { #[inline] fn eq(&self, other: &LayoutNode) -> bool { self.node == other.node @@ -407,7 +407,7 @@ fn get_content(content_list: &content::T) -> String { } } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum PseudoElementType { Normal, Before, diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index 18588521a8b..c32060852b2 100644 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -8,7 +8,7 @@ #![feature(globs, macro_rules, phase, thread_local)] -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate log; extern crate debug; @@ -27,11 +27,11 @@ extern crate opengles; extern crate png; extern crate rustuv; extern crate script; -#[phase(syntax)] +#[phase(plugin)] extern crate servo_macros = "macros"; extern crate servo_net = "net"; extern crate servo_msg = "msg"; -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate servo_util = "util"; extern crate style; extern crate sharegl; @@ -41,6 +41,7 @@ extern crate collections; extern crate green; extern crate libc; extern crate native; +extern crate rustrt; extern crate serialize; extern crate sync; extern crate time; @@ -78,7 +79,7 @@ use std::os; #[cfg(not(test), target_os="android")] use std::str; #[cfg(not(test))] -use std::task::TaskOpts; +use rustrt::task::TaskOpts; #[cfg(not(test))] use url::Url; diff --git a/src/components/msg/compositor_msg.rs b/src/components/msg/compositor_msg.rs index d96798b3184..8955e746efa 100644 --- a/src/components/msg/compositor_msg.rs +++ b/src/components/msg/compositor_msg.rs @@ -48,13 +48,13 @@ impl LayerBufferSet { } /// The status of the renderer. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum RenderState { IdleRenderState, RenderingRenderState, } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum ReadyState { /// Informs the compositor that nothing has been done yet. Used for setting status Blank, @@ -67,7 +67,7 @@ pub enum ReadyState { } /// A newtype struct for denoting the age of messages; prevents race conditions. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct Epoch(pub uint); impl Epoch { @@ -77,7 +77,7 @@ impl Epoch { } } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct LayerId(pub uint, pub uint); impl Show for LayerId { @@ -95,7 +95,7 @@ impl LayerId { } /// The scrolling policy of a layer. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum ScrollPolicy { /// These layers scroll when the parent receives a scrolling message. Scrollable, diff --git a/src/components/msg/constellation_msg.rs b/src/components/msg/constellation_msg.rs index f287398302a..84207ee7f7e 100644 --- a/src/components/msg/constellation_msg.rs +++ b/src/components/msg/constellation_msg.rs @@ -22,7 +22,7 @@ impl ConstellationChan { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum IFrameSandboxState { IFrameSandboxed, IFrameUnsandboxed @@ -62,20 +62,20 @@ pub enum Msg { } /// Represents the two different ways to which a page can be navigated -#[deriving(Clone, Eq, Hash)] +#[deriving(Clone, PartialEq, Hash)] pub enum NavigationType { Load, // entered or clicked on a url Navigate, // browser forward/back buttons } -#[deriving(Clone, Eq, Hash)] +#[deriving(Clone, PartialEq, Hash)] pub enum NavigationDirection { Forward, Back, } -#[deriving(Clone, Eq, TotalEq, Hash, Encodable)] +#[deriving(Clone, PartialEq, Eq, Hash, Encodable)] pub struct PipelineId(pub uint); -#[deriving(Clone, Eq, TotalEq, Hash, Encodable)] +#[deriving(Clone, PartialEq, Eq, Hash, Encodable)] pub struct SubpageId(pub uint); diff --git a/src/components/net/http_loader.rs b/src/components/net/http_loader.rs index 5174ebcdd73..1d6e95a60b2 100644 --- a/src/components/net/http_loader.rs +++ b/src/components/net/http_loader.rs @@ -4,7 +4,7 @@ use resource_task::{Metadata, Payload, Done, LoadResponse, LoadData, LoaderTask, start_sending_opt}; -use collections::hashmap::HashSet; +use std::collections::hashmap::HashSet; use http::client::{RequestWriter, NetworkStream}; use http::headers::HeaderEnum; use std::io::Reader; diff --git a/src/components/net/image_cache_task.rs b/src/components/net/image_cache_task.rs index 80c9497b475..f4c067ada18 100644 --- a/src/components/net/image_cache_task.rs +++ b/src/components/net/image_cache_task.rs @@ -55,7 +55,7 @@ pub enum ImageResponseMsg { ImageFailed } -impl Eq for ImageResponseMsg { +impl PartialEq for ImageResponseMsg { fn eq(&self, other: &ImageResponseMsg) -> bool { match (self, other) { (&ImageReady(..), &ImageReady(..)) => fail!("unimplemented comparison"), diff --git a/src/components/net/local_image_cache.rs b/src/components/net/local_image_cache.rs index 2e0cb871ae5..546a3d1dc6c 100644 --- a/src/components/net/local_image_cache.rs +++ b/src/components/net/local_image_cache.rs @@ -32,7 +32,7 @@ pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache { pub struct LocalImageCache { image_cache_task: ImageCacheTask, round_number: uint, - on_image_available: Option<Box<ImageResponder:Send>>, + on_image_available: Option<Box<ImageResponder+Send>>, state_map: UrlMap<ImageState> } @@ -47,7 +47,7 @@ struct ImageState { impl LocalImageCache { /// The local cache will only do a single remote request for a given /// URL in each 'round'. Layout should call this each time it begins - pub fn next_round(&mut self, on_image_available: Box<ImageResponder:Send>) { + pub fn next_round(&mut self, on_image_available: Box<ImageResponder+Send>) { self.round_number += 1; self.on_image_available = Some(on_image_available); } @@ -80,12 +80,13 @@ impl LocalImageCache { // FIXME: Should return a Future pub fn get_image(&mut self, url: &Url) -> Receiver<ImageResponseMsg> { { + let round_number = self.round_number; let state = self.get_state(url); // Save the previous round number for comparison let last_round = state.last_request_round; // Set the current round number for this image - state.last_request_round = self.round_number; + state.last_request_round = round_number; match state.last_response { ImageReady(ref image) => { @@ -94,7 +95,7 @@ impl LocalImageCache { return port; } ImageNotReady => { - if last_round == self.round_number { + if last_round == round_number { let (chan, port) = channel(); chan.send(ImageNotReady); return port; diff --git a/src/components/net/net.rs b/src/components/net/net.rs index 3ea211292ce..d29abb2c248 100644 --- a/src/components/net/net.rs +++ b/src/components/net/net.rs @@ -14,7 +14,7 @@ extern crate collections; extern crate geom; extern crate http; extern crate png; -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate log; extern crate serialize; extern crate servo_util = "util"; diff --git a/src/components/net/resource_task.rs b/src/components/net/resource_task.rs index ac609c14491..4eb46ae20b3 100644 --- a/src/components/net/resource_task.rs +++ b/src/components/net/resource_task.rs @@ -108,7 +108,7 @@ pub struct LoadResponse { } /// Messages sent in response to a `Load` message -#[deriving(Eq,Show)] +#[deriving(PartialEq,Show)] pub enum ProgressMsg { /// Binary data - there may be multiple of these Payload(Vec<u8>), diff --git a/src/components/script/dom/attr.rs b/src/components/script/dom/attr.rs index e9acd46356a..53a54f4e16c 100644 --- a/src/components/script/dom/attr.rs +++ b/src/components/script/dom/attr.rs @@ -22,7 +22,7 @@ pub enum AttrSettingType { ReplacedAttr, } -#[deriving(Eq, Clone, Encodable)] +#[deriving(PartialEq, Clone, Encodable)] pub enum AttrValue { StringAttrValue(DOMString), TokenListAttrValue(DOMString, Vec<(uint, uint)>), diff --git a/src/components/script/dom/bindings/callback.rs b/src/components/script/dom/bindings/callback.rs index 97df62193d8..709d7056c27 100644 --- a/src/components/script/dom/bindings/callback.rs +++ b/src/components/script/dom/bindings/callback.rs @@ -24,7 +24,7 @@ pub enum ExceptionHandling { RethrowExceptions } -#[deriving(Clone,Eq,Encodable)] +#[deriving(Clone,PartialEq,Encodable)] pub struct CallbackFunction { object: CallbackObject } @@ -39,13 +39,13 @@ impl CallbackFunction { } } -#[deriving(Clone,Eq,Encodable)] +#[deriving(Clone,PartialEq,Encodable)] pub struct CallbackInterface { object: CallbackObject } #[allow(raw_pointer_deriving)] -#[deriving(Clone,Eq,Encodable)] +#[deriving(Clone,PartialEq,Encodable)] struct CallbackObject { callback: Traceable<*mut JSObject>, } diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index cca52e8e2ce..58e805a0c19 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -2707,7 +2707,7 @@ use js::jsapi::JSContext; use js::jsval::JSVal; #[repr(uint)] -#[deriving(Encodable, Eq)] +#[deriving(Encodable, PartialEq)] pub enum valuelist { %s } @@ -4756,7 +4756,7 @@ class CGCallback(CGClass): bases=[ClassBase(baseName)], constructors=self.getConstructors(), methods=realMethods+getters+setters, - decorators="#[deriving(Eq,Clone,Encodable)]") + decorators="#[deriving(PartialEq,Clone,Encodable)]") def getConstructors(self): return [ClassConstructor( @@ -5262,7 +5262,7 @@ class GlobalGenRoots(): return CGList([ CGGeneric(AUTOGENERATED_WARNING_COMMENT), CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength), - CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq"), + CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"), ]) diff --git a/src/components/script/dom/bindings/conversions.rs b/src/components/script/dom/bindings/conversions.rs index 96dc946a3d2..ddbbcf433a4 100644 --- a/src/components/script/dom/bindings/conversions.rs +++ b/src/components/script/dom/bindings/conversions.rs @@ -228,7 +228,7 @@ impl ToJSValConvertible for DOMString { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum StringificationBehavior { Default, Empty, diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs index 4cc5539e666..e273dfc7bad 100644 --- a/src/components/script/dom/bindings/js.rs +++ b/src/components/script/dom/bindings/js.rs @@ -63,7 +63,7 @@ pub struct Temporary<T> { js_ptr: *mut JSObject, } -impl<T> Eq for Temporary<T> { +impl<T> PartialEq for Temporary<T> { fn eq(&self, other: &Temporary<T>) -> bool { self.inner == other.inner } @@ -106,7 +106,7 @@ pub struct JS<T> { ptr: *T } -impl<T> Eq for JS<T> { +impl<T> PartialEq for JS<T> { fn eq(&self, other: &JS<T>) -> bool { self.ptr == other.ptr } @@ -455,7 +455,7 @@ impl<'a, T> Clone for JSRef<'a, T> { } } -impl<'a, T> Eq for JSRef<'a, T> { +impl<'a, T> PartialEq for JSRef<'a, T> { fn eq(&self, other: &JSRef<T>) -> bool { self.ptr == other.ptr } diff --git a/src/components/script/dom/bindings/str.rs b/src/components/script/dom/bindings/str.rs index 6db3f6c1f97..09b327dafa1 100644 --- a/src/components/script/dom/bindings/str.rs +++ b/src/components/script/dom/bindings/str.rs @@ -7,7 +7,7 @@ use std::hash::{Hash, sip}; use std::path::BytesContainer; use std::str; -#[deriving(Encodable,Clone,TotalEq,Eq)] +#[deriving(Encodable,Clone,Eq,PartialEq)] pub struct ByteString(Vec<u8>); impl ByteString { @@ -66,7 +66,7 @@ impl ByteString { pub fn is_field_value(&self) -> bool { // Classifications of characters necessary for the [CRLF] (SP|HT) rule - #[deriving(Eq)] + #[deriving(PartialEq)] enum PreviousCharacter { Other, CR, diff --git a/src/components/script/dom/bindings/trace.rs b/src/components/script/dom/bindings/trace.rs index 5a1910ed30c..1c3655bbde3 100644 --- a/src/components/script/dom/bindings/trace.rs +++ b/src/components/script/dom/bindings/trace.rs @@ -116,7 +116,7 @@ impl<T> DerefMut<T> for Untraceable<T> { /// /// We always prefer this, in case the contained type ever changes to something that should be traced. /// See more details: mozilla#2662. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct Traceable<T> { inner: T } diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 370b34f048a..d2c1a43ccf8 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -11,12 +11,12 @@ use dom::browsercontext; use dom::window; use servo_util::str::DOMString; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use libc; use libc::c_uint; use std::cell::Cell; -use std::cmp::Eq; use std::mem; +use std::cmp::PartialEq; use std::ptr; use std::ptr::null; use std::slice; @@ -383,7 +383,7 @@ pub fn reflect_dom_object<T: Reflectable> } #[allow(raw_pointer_deriving)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct Reflector { object: Cell<*mut JSObject>, } @@ -608,7 +608,7 @@ pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext { /// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name /// for details. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum XMLName { QName, Name, diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index e384780d553..e7b36d78b21 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -46,13 +46,13 @@ use servo_util::namespace; use servo_util::namespace::{Namespace, Null}; use servo_util::str::{DOMString, null_str_as_empty_ref}; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use js::jsapi::JSContext; use std::ascii::StrAsciiExt; use std::cell::{Cell, RefCell}; use url::{Url, from_str}; -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum IsHTMLDocument { HTMLDocument, NonHTMLDocument, diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 3d6248e070b..e384ed02c1f 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -64,7 +64,7 @@ impl Reflectable for Element { } } -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum ElementTypeId { HTMLElementTypeId, HTMLAnchorElementTypeId, @@ -773,9 +773,9 @@ pub fn get_attribute_parts(name: DOMString) -> (Option<String>, String) { } impl<'a> VirtualMethods for JSRef<'a, Element> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let node: &JSRef<Node> = NodeCast::from_ref(self); - Some(node as &VirtualMethods:) + Some(node as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/event.rs b/src/components/script/dom/event.rs index e3406fb1013..2082d4f2e39 100644 --- a/src/components/script/dom/event.rs +++ b/src/components/script/dom/event.rs @@ -35,7 +35,7 @@ pub enum EventPhase { PhaseBubbling = EventConstants::BUBBLING_PHASE, } -#[deriving(Eq, Encodable)] +#[deriving(PartialEq, Encodable)] pub enum EventTypeId { CustomEventTypeId, HTMLEventTypeId, diff --git a/src/components/script/dom/eventtarget.rs b/src/components/script/dom/eventtarget.rs index e4a62684e15..676c6a33925 100644 --- a/src/components/script/dom/eventtarget.rs +++ b/src/components/script/dom/eventtarget.rs @@ -22,22 +22,22 @@ use std::cell::RefCell; use std::ptr; use url::Url; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum ListenerPhase { Capturing, Bubbling, } -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum EventTargetTypeId { NodeTargetTypeId(NodeTypeId), WindowTypeId, XMLHttpRequestTargetTypeId(XMLHttpRequestId) } -#[deriving(Eq, Encodable)] +#[deriving(PartialEq, Encodable)] pub enum EventListenerType { Additive(EventListener), Inline(EventListener), @@ -51,7 +51,7 @@ impl EventListenerType { } } -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub struct EventListenerEntry { pub phase: ListenerPhase, pub listener: EventListenerType @@ -281,7 +281,7 @@ impl Reflectable for EventTarget { } impl<'a> VirtualMethods for JSRef<'a, EventTarget> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { None } } diff --git a/src/components/script/dom/formdata.rs b/src/components/script/dom/formdata.rs index a38f1ea53f9..5ad5bd5817e 100644 --- a/src/components/script/dom/formdata.rs +++ b/src/components/script/dom/formdata.rs @@ -15,7 +15,7 @@ use dom::htmlformelement::HTMLFormElement; use dom::window::Window; use servo_util::str::DOMString; use std::cell::RefCell; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; #[deriving(Encodable, Clone)] pub enum FormDatum { @@ -120,4 +120,4 @@ impl PrivateFormDataHelpers for FormData { let name = filename.unwrap_or(f.map(|inner| inner.name.clone()).unwrap_or("blob".to_string())); File::new(&*global, value, name) } -}
\ No newline at end of file +} diff --git a/src/components/script/dom/htmlanchorelement.rs b/src/components/script/dom/htmlanchorelement.rs index 046deea42e5..be177558134 100644 --- a/src/components/script/dom/htmlanchorelement.rs +++ b/src/components/script/dom/htmlanchorelement.rs @@ -68,9 +68,9 @@ impl<'a> PrivateHTMLAnchorElementHelpers for JSRef<'a, HTMLAnchorElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLAnchorElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(htmlelement as &VirtualMethods:) + Some(htmlelement as &VirtualMethods+) } fn handle_event(&self, event: &JSRef<Event>) { diff --git a/src/components/script/dom/htmlbodyelement.rs b/src/components/script/dom/htmlbodyelement.rs index 942be8103b5..449c9305cf7 100644 --- a/src/components/script/dom/htmlbodyelement.rs +++ b/src/components/script/dom/htmlbodyelement.rs @@ -59,9 +59,9 @@ impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let element: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(element as &VirtualMethods:) + Some(element as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/htmlcollection.rs b/src/components/script/dom/htmlcollection.rs index c2d1e103e4f..64bf42ecfe5 100644 --- a/src/components/script/dom/htmlcollection.rs +++ b/src/components/script/dom/htmlcollection.rs @@ -135,10 +135,10 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> { Live(ref root, ref filter) => { let root = root.root(); root.deref().traverse_preorder() - .count(|child| { + .filter(|&child| { let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&child); elem.map_or(false, |elem| filter.filter(elem, &*root)) - }) as u32 + }).count() as u32 } } } diff --git a/src/components/script/dom/htmlelement.rs b/src/components/script/dom/htmlelement.rs index 7a568b8fa4c..77248dc1d8c 100644 --- a/src/components/script/dom/htmlelement.rs +++ b/src/components/script/dom/htmlelement.rs @@ -93,9 +93,9 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let element: &JSRef<Element> = ElementCast::from_ref(self); - Some(element as &VirtualMethods:) + Some(element as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/htmliframeelement.rs b/src/components/script/dom/htmliframeelement.rs index dd97c8f48b5..420f035a19e 100644 --- a/src/components/script/dom/htmliframeelement.rs +++ b/src/components/script/dom/htmliframeelement.rs @@ -136,9 +136,9 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLIFrameElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(htmlelement as &VirtualMethods:) + Some(htmlelement as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs index 6bc113b5891..07a5fd5c04b 100644 --- a/src/components/script/dom/htmlimageelement.rs +++ b/src/components/script/dom/htmlimageelement.rs @@ -240,9 +240,9 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(htmlelement as &VirtualMethods:) + Some(htmlelement as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/htmlobjectelement.rs b/src/components/script/dom/htmlobjectelement.rs index 51488190e8c..83f7747f1b3 100644 --- a/src/components/script/dom/htmlobjectelement.rs +++ b/src/components/script/dom/htmlobjectelement.rs @@ -85,9 +85,9 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(htmlelement as &VirtualMethods:) + Some(htmlelement as &VirtualMethods+) } fn after_set_attr(&self, name: DOMString, value: DOMString) { diff --git a/src/components/script/dom/htmlserializer.rs b/src/components/script/dom/htmlserializer.rs index 2eca215e89b..88866d6e1e7 100644 --- a/src/components/script/dom/htmlserializer.rs +++ b/src/components/script/dom/htmlserializer.rs @@ -22,9 +22,9 @@ use dom::text::Text; pub fn serialize(iterator: &mut NodeIterator) -> String { let mut html = String::new(); let mut open_elements: Vec<String> = vec!(); - + let depth = iterator.depth; for node in *iterator { - while open_elements.len() > iterator.depth { + while open_elements.len() > depth { html.push_str("</"); html.push_str(open_elements.pop().unwrap().as_slice()); html.push_str(">"); diff --git a/src/components/script/dom/htmlstyleelement.rs b/src/components/script/dom/htmlstyleelement.rs index b2138b500ad..f185cb1391f 100644 --- a/src/components/script/dom/htmlstyleelement.rs +++ b/src/components/script/dom/htmlstyleelement.rs @@ -65,9 +65,9 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> { } impl<'a> VirtualMethods for JSRef<'a, HTMLStyleElement> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self); - Some(htmlelement as &VirtualMethods:) + Some(htmlelement as &VirtualMethods+) } fn child_inserted(&self, child: &JSRef<Node>) { diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index e67fe0eda2f..def4ee6248d 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -172,12 +172,6 @@ impl LayoutDataRef { } } - pub unsafe fn from_data<T>(data: Box<T>) -> LayoutDataRef { - LayoutDataRef { - data_cell: RefCell::new(Some(mem::transmute(data))), - } - } - /// Returns true if there is layout data present. #[inline] pub fn is_present(&self) -> bool { @@ -225,7 +219,7 @@ impl LayoutDataRef { pub trait TLayoutData {} /// The different types of nodes. -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum NodeTypeId { DoctypeNodeTypeId, DocumentFragmentNodeTypeId, @@ -901,7 +895,7 @@ fn gather_abstract_nodes<'a>(cur: &JSRef<'a, Node>, refs: &mut Vec<JSRef<'a, Nod } /// Specifies whether children must be recursively cloned or not. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum CloneChildrenFlag { CloneChildren, DoNotCloneChildren @@ -1024,13 +1018,13 @@ impl Node { if node.children().any(|c| c.is_text()) { return Err(HierarchyRequest); } - match node.child_elements().len() { + match node.child_elements().count() { 0 => (), // Step 6.1.2 1 => { // FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218 // will be fixed - if parent.child_elements().len() > 0 { + if parent.child_elements().count() > 0 { return Err(HierarchyRequest); } match child { @@ -1049,7 +1043,7 @@ impl Node { ElementNodeTypeId(_) => { // FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218 // will be fixed - if parent.child_elements().len() > 0 { + if parent.child_elements().count() > 0 { return Err(HierarchyRequest); } match child { @@ -1076,7 +1070,7 @@ impl Node { None => { // FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218 // will be fixed - if parent.child_elements().len() > 0 { + if parent.child_elements().count() > 0 { return Err(HierarchyRequest); } }, @@ -1649,7 +1643,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> { if node.children().any(|c| c.is_text()) { return Err(HierarchyRequest); } - match node.child_elements().len() { + match node.child_elements().count() { 0 => (), // Step 6.1.2 1 => { @@ -1837,7 +1831,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> { } // Step 5. - if this.children().len() != node.children().len() { + if this.children().count() != node.children().count() { return false; } @@ -1953,9 +1947,9 @@ pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Window> { } impl<'a> VirtualMethods for JSRef<'a, Node> { - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> { + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> { let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self); - Some(eventtarget as &VirtualMethods:) + Some(eventtarget as &VirtualMethods+) } } diff --git a/src/components/script/dom/nodelist.rs b/src/components/script/dom/nodelist.rs index ccd06c92fde..62e4d12e3b3 100644 --- a/src/components/script/dom/nodelist.rs +++ b/src/components/script/dom/nodelist.rs @@ -58,7 +58,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> { Simple(ref elems) => elems.len() as u32, Children(ref node) => { let node = node.root(); - node.deref().children().len() as u32 + node.deref().children().count() as u32 } } } diff --git a/src/components/script/dom/virtualmethods.rs b/src/components/script/dom/virtualmethods.rs index b32af5139da..aa1ac0313b9 100644 --- a/src/components/script/dom/virtualmethods.rs +++ b/src/components/script/dom/virtualmethods.rs @@ -31,7 +31,7 @@ use servo_util::str::DOMString; pub trait VirtualMethods { /// Returns self as the superclass of the implementation for this trait, /// if any. - fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:>; + fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+>; /// Called when changing or adding attributes, after the attribute's value /// has been updated. @@ -99,42 +99,42 @@ pub trait VirtualMethods { /// method call on the trait object will invoke the corresponding method on the /// concrete type, propagating up the parent hierarchy unless otherwise /// interrupted. -pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods: { +pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods+ { match node.type_id() { ElementNodeTypeId(HTMLAnchorElementTypeId) => { let element: &JSRef<HTMLAnchorElement> = HTMLAnchorElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(HTMLBodyElementTypeId) => { let element: &JSRef<HTMLBodyElement> = HTMLBodyElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(HTMLImageElementTypeId) => { let element: &JSRef<HTMLImageElement> = HTMLImageElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(HTMLIFrameElementTypeId) => { let element: &JSRef<HTMLIFrameElement> = HTMLIFrameElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(HTMLObjectElementTypeId) => { let element: &JSRef<HTMLObjectElement> = HTMLObjectElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(HTMLStyleElementTypeId) => { let element: &JSRef<HTMLStyleElement> = HTMLStyleElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(ElementTypeId) => { let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } ElementNodeTypeId(_) => { let element: &JSRef<HTMLElement> = HTMLElementCast::to_ref(node).unwrap(); - element as &VirtualMethods: + element as &VirtualMethods+ } _ => { - node as &VirtualMethods: + node as &VirtualMethods+ } } } diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs index 92cb313eca8..7d50a8dac4a 100644 --- a/src/components/script/dom/window.rs +++ b/src/components/script/dom/window.rs @@ -29,7 +29,7 @@ use js::jsapi::JSContext; use js::jsapi::{JS_GC, JS_GetRuntime}; use js::jsval::JSVal; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use std::cell::{Cell, RefCell}; use std::cmp; use std::comm::{channel, Sender}; @@ -43,7 +43,7 @@ use time; use serialize::{Encoder, Encodable}; use url::Url; -#[deriving(Eq, Encodable, TotalEq)] +#[deriving(PartialEq, Encodable, Eq)] pub struct TimerId(i32); #[deriving(Encodable)] diff --git a/src/components/script/dom/xmlhttprequest.rs b/src/components/script/dom/xmlhttprequest.rs index d07971d441d..b0f80ceabf1 100644 --- a/src/components/script/dom/xmlhttprequest.rs +++ b/src/components/script/dom/xmlhttprequest.rs @@ -61,13 +61,13 @@ use url::Url; // use SendParam = dom::bindings::codegen::UnionTypes::StringOrFormData; pub type SendParam = DOMString; -#[deriving(Eq,Encodable)] +#[deriving(PartialEq,Encodable)] pub enum XMLHttpRequestId { XMLHttpRequestTypeId, XMLHttpRequestUploadTypeId } -#[deriving(Eq, Encodable)] +#[deriving(PartialEq, Encodable)] enum XMLHttpRequestState { Unsent = 0u16, Opened = 1u16, @@ -889,7 +889,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { self.timer.deref().borrow_mut().oneshot(0); } fn text_response(&self) -> DOMString { - let mut encoding = UTF_8 as &Encoding:Send; + let mut encoding = UTF_8 as &Encoding+Send; match self.response_headers.deref().borrow().content_type { Some(ref x) => { for &(ref name, ref value) in x.parameters.iter() { diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs index 487fb8f0862..3b57680702e 100644 --- a/src/components/script/layout_interface.rs +++ b/src/components/script/layout_interface.rs @@ -87,7 +87,7 @@ pub struct HitTestResponse(pub UntrustedNodeAddress); pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>); /// Determines which part of the -#[deriving(Eq, Ord, TotalEq, TotalOrd, Encodable)] +#[deriving(PartialEq, PartialOrd, Eq, Ord, Encodable)] pub enum DocumentDamageLevel { /// Reflow, but do not perform CSS selector matching. ReflowDocumentDamage, @@ -116,7 +116,7 @@ pub struct DocumentDamage { } /// Why we're doing reflow. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum ReflowGoal { /// We're reflowing in order to send a display list to the screen. ReflowForDisplay, diff --git a/src/components/script/script.rs b/src/components/script/script.rs index 33b7eaa846a..efcd4283dd8 100644 --- a/src/components/script/script.rs +++ b/src/components/script/script.rs @@ -13,7 +13,10 @@ #![feature(globs, macro_rules, struct_variant, phase)] #![feature(phase)] -#[phase(syntax, link)] + +#![allow(non_snake_case_functions)] + +#[phase(plugin, link)] extern crate log; extern crate debug; @@ -29,7 +32,7 @@ extern crate native; extern crate net; extern crate serialize; extern crate time; -#[phase(syntax)] +#[phase(plugin)] extern crate servo_macros = "macros"; extern crate servo_net = "net"; extern crate servo_util = "util"; diff --git a/src/components/style/media_queries.rs b/src/components/style/media_queries.rs index da2fa989c6f..2c7b6b4b08f 100644 --- a/src/components/style/media_queries.rs +++ b/src/components/style/media_queries.rs @@ -36,7 +36,7 @@ pub enum MediaQueryType { MediaType(MediaType), } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum MediaType { Screen, Print, diff --git a/src/components/style/namespaces.rs b/src/components/style/namespaces.rs index 42a6bfae126..6ea1e4b4c3a 100644 --- a/src/components/style/namespaces.rs +++ b/src/components/style/namespaces.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::ast::*; -use collections::hashmap::HashMap; +use std::collections::hashmap::HashMap; use servo_util::namespace::Namespace; use errors::log_css_error; @@ -36,7 +36,7 @@ pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) { match component_value { Ident(value) => { if prefix.is_some() { syntax_error!() } - prefix = Some(value.into_owned()); + prefix = Some(value.into_string()); }, URL(value) | String(value) => { if ns.is_some() { syntax_error!() } diff --git a/src/components/style/properties/common_types.rs b/src/components/style/properties/common_types.rs index f7d8bbde60f..724778f9ab2 100644 --- a/src/components/style/properties/common_types.rs +++ b/src/components/style/properties/common_types.rs @@ -205,7 +205,7 @@ pub mod computed { } } - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum LengthOrPercentage { LP_Length(Au), LP_Percentage(CSSFloat), @@ -218,7 +218,7 @@ pub mod computed { } } - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum LengthOrPercentageOrAuto { LPA_Length(Au), LPA_Percentage(CSSFloat), @@ -233,7 +233,7 @@ pub mod computed { } } - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum LengthOrPercentageOrNone { LPN_Length(Au), LPN_Percentage(CSSFloat), diff --git a/src/components/style/properties/mod.rs.mako b/src/components/style/properties/mod.rs.mako index 5e38cc1b96d..44cbcbef40f 100644 --- a/src/components/style/properties/mod.rs.mako +++ b/src/components/style/properties/mod.rs.mako @@ -154,7 +154,7 @@ pub mod longhands { ${caller.body()} pub mod computed_value { #[allow(non_camel_case_types)] - #[deriving(Eq, Clone, FromPrimitive)] + #[deriving(PartialEq, Clone, FromPrimitive)] pub enum T { % for value in values.split(): ${to_rust_ident(value)}, @@ -398,7 +398,7 @@ pub mod longhands { } pub mod computed_value { use super::super::{Au, CSSFloat}; - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum T { Normal, Length(Au), @@ -486,7 +486,7 @@ pub mod longhands { pub mod computed_value { use super::super::{Au, CSSFloat}; #[allow(non_camel_case_types)] - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum T { % for keyword in vertical_align_keywords: ${to_rust_ident(keyword)}, @@ -529,12 +529,12 @@ pub mod longhands { <%self:longhand name="content"> pub use to_computed_value = super::computed_as_specified; pub mod computed_value { - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum Content { StringContent(String), } #[allow(non_camel_case_types)] - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum T { normal, none, @@ -605,7 +605,7 @@ pub mod longhands { pub mod computed_value { use super::super::super::common_types::computed::LengthOrPercentage; - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub struct T { pub horizontal: LengthOrPercentage, pub vertical: LengthOrPercentage, @@ -703,7 +703,7 @@ pub mod longhands { <%self:longhand name="font-family"> pub use to_computed_value = super::computed_as_specified; pub mod computed_value { - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum FontFamily { FamilyName(String), // Generic @@ -816,7 +816,7 @@ pub mod longhands { } } pub mod computed_value { - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub enum T { % for weight in range(100, 901, 100): Weight${weight}, @@ -905,7 +905,7 @@ pub mod longhands { <%self:longhand name="text-decoration"> pub use to_computed_value = super::computed_as_specified; - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub struct SpecifiedValue { pub underline: bool, pub overline: bool, @@ -957,7 +957,7 @@ pub mod longhands { pub use to_computed_value = super::computed_as_specified; - #[deriving(Clone, Eq)] + #[deriving(Clone, PartialEq)] pub struct SpecifiedValue { pub underline: Option<RGBA>, pub overline: Option<RGBA>, @@ -1562,7 +1562,7 @@ impl PropertyDeclaration { pub mod style_structs { use super::longhands; % for style_struct in STYLE_STRUCTS: - #[deriving(Eq, Clone)] + #[deriving(PartialEq, Clone)] pub struct ${style_struct.name} { % for longhand in style_struct.longhands: pub ${longhand.ident}: longhands::${longhand.ident}::computed_value::T, diff --git a/src/components/style/selector_matching.rs b/src/components/style/selector_matching.rs index 1a3752603ee..6e1af004a02 100644 --- a/src/components/style/selector_matching.rs +++ b/src/components/style/selector_matching.rs @@ -2,11 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use collections::hashmap::HashMap; +use collections::hash::Writer; +use std::collections::hashmap::HashMap; use std::ascii::StrAsciiExt; use std::hash::Hash; use std::hash::sip::SipState; -use num::div_rem; +use std::num::div_rem; use sync::Arc; use servo_util::namespace; @@ -49,12 +50,12 @@ impl<'a> Hash for LowercaseAsciiString<'a> { // `Ascii` type's invariants by using `to_ascii_nocheck`, but it's OK as we simply // convert to a byte afterward. unsafe { - state.write_u8(b.to_ascii_nocheck().to_lowercase().to_byte()).unwrap() + state.write(&[b.to_ascii_nocheck().to_lowercase().to_byte()]) }; } // Terminate the string with a non-UTF-8 character, to match what the built-in string // `ToBytes` implementation does. (See `libstd/to_bytes.rs`.) - state.write_u8(0xff).unwrap(); + state.write(&[0xff]); } } @@ -497,7 +498,7 @@ impl MatchedProperty { } } -impl Eq for MatchedProperty { +impl PartialEq for MatchedProperty { #[inline] fn eq(&self, other: &MatchedProperty) -> bool { let this_rank = (self.specificity, self.source_order); @@ -506,7 +507,9 @@ impl Eq for MatchedProperty { } } -impl Ord for MatchedProperty { +impl Eq for MatchedProperty {} + +impl PartialOrd for MatchedProperty { #[inline] fn lt(&self, other: &MatchedProperty) -> bool { let this_rank = (self.specificity, self.source_order); @@ -515,6 +518,15 @@ impl Ord for MatchedProperty { } } +impl Ord for MatchedProperty { + #[inline] + fn cmp(&self, other: &MatchedProperty) -> Ordering { + let this_rank = (self.specificity, self.source_order); + let other_rank = (other.specificity, other.source_order); + this_rank.cmp(&other_rank) + } +} + /// Determines whether the given element matches the given single or compound selector. /// /// NB: If you add support for any new kinds of selectors to this routine, be sure to set diff --git a/src/components/style/selectors.rs b/src/components/style/selectors.rs index 6acb818f098..d19d7d9d480 100644 --- a/src/components/style/selectors.rs +++ b/src/components/style/selectors.rs @@ -17,21 +17,21 @@ use namespaces::NamespaceMap; // Only used in tests -impl Eq for Arc<CompoundSelector> { +impl PartialEq for Arc<CompoundSelector> { fn eq(&self, other: &Arc<CompoundSelector>) -> bool { **self == **other } } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct Selector { pub compound_selectors: Arc<CompoundSelector>, pub pseudo_element: Option<PseudoElement>, pub specificity: u32, } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum PseudoElement { Before, After, @@ -40,13 +40,13 @@ pub enum PseudoElement { } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct CompoundSelector { pub simple_selectors: Vec<SimpleSelector>, pub next: Option<(Box<CompoundSelector>, Combinator)>, // c.next is left of c } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum Combinator { Child, // > Descendant, // space @@ -54,7 +54,7 @@ pub enum Combinator { LaterSibling, // ~ } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum SimpleSelector { IDSelector(String), ClassSelector(String), @@ -90,14 +90,14 @@ pub enum SimpleSelector { // ... } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct AttrSelector { pub name: String, pub lower_name: String, pub namespace: NamespaceConstraint, } -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum NamespaceConstraint { AnyNamespace, SpecificNamespace(Namespace), diff --git a/src/components/style/style.rs b/src/components/style/style.rs index 0368b71c1f6..31fd84dccd9 100644 --- a/src/components/style/style.rs +++ b/src/components/style/style.rs @@ -13,7 +13,7 @@ #![feature(globs, macro_rules)] #![feature(phase)] -#[phase(syntax, link)] extern crate log; +#[phase(plugin, link)] extern crate log; extern crate debug; extern crate collections; @@ -25,7 +25,7 @@ extern crate url; extern crate cssparser; extern crate encoding; -#[phase(syntax)] +#[phase(plugin)] extern crate servo_macros = "macros"; extern crate servo_util = "util"; diff --git a/src/components/util/cache.rs b/src/components/util/cache.rs index 768b015bc44..b3b32269911 100644 --- a/src/components/util/cache.rs +++ b/src/components/util/cache.rs @@ -2,16 +2,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use collections::HashMap; -use rand; +use std::collections::hashmap::HashMap; use rand::Rng; use std::hash::{Hash, sip}; +use std::rand::task_rng; use std::slice::Items; #[cfg(test)] use std::cell::Cell; -pub trait Cache<K: Eq, V: Clone> { +pub trait Cache<K: PartialEq, V: Clone> { fn insert(&mut self, key: K, value: V); fn find(&mut self, key: &K) -> Option<V>; fn find_or_create(&mut self, key: &K, blk: |&K| -> V) -> V; @@ -22,13 +22,13 @@ pub struct MonoCache<K, V> { entry: Option<(K,V)>, } -impl<K: Clone + Eq, V: Clone> MonoCache<K,V> { +impl<K: Clone + PartialEq, V: Clone> MonoCache<K,V> { pub fn new(_size: uint) -> MonoCache<K,V> { MonoCache { entry: None } } } -impl<K: Clone + Eq, V: Clone> Cache<K,V> for MonoCache<K,V> { +impl<K: Clone + PartialEq, V: Clone> Cache<K,V> for MonoCache<K,V> { fn insert(&mut self, key: K, value: V) { self.entry = Some((key, value)); } @@ -74,7 +74,7 @@ pub struct HashCache<K, V> { entries: HashMap<K, V>, } -impl<K: Clone + Eq + TotalEq + Hash, V: Clone> HashCache<K,V> { +impl<K: Clone + PartialEq + Eq + Hash, V: Clone> HashCache<K,V> { pub fn new() -> HashCache<K, V> { HashCache { entries: HashMap::new(), @@ -82,7 +82,7 @@ impl<K: Clone + Eq + TotalEq + Hash, V: Clone> HashCache<K,V> { } } -impl<K: Clone + Eq + TotalEq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> { +impl<K: Clone + PartialEq + Eq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> { fn insert(&mut self, key: K, value: V) { self.entries.insert(key, value); } @@ -123,7 +123,7 @@ pub struct LRUCache<K, V> { cache_size: uint, } -impl<K: Clone + Eq, V: Clone> LRUCache<K,V> { +impl<K: Clone + PartialEq, V: Clone> LRUCache<K,V> { pub fn new(size: uint) -> LRUCache<K, V> { LRUCache { entries: vec!(), @@ -146,7 +146,7 @@ impl<K: Clone + Eq, V: Clone> LRUCache<K,V> { } } -impl<K: Clone + Eq, V: Clone> Cache<K,V> for LRUCache<K,V> { +impl<K: Clone + PartialEq, V: Clone> Cache<K,V> for LRUCache<K,V> { fn insert(&mut self, key: K, val: V) { if self.entries.len() == self.cache_size { self.entries.remove(0); @@ -183,9 +183,9 @@ pub struct SimpleHashCache<K,V> { k1: u64, } -impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> { +impl<K:Clone+PartialEq+Hash,V:Clone> SimpleHashCache<K,V> { pub fn new(cache_size: uint) -> SimpleHashCache<K,V> { - let mut r = rand::task_rng(); + let mut r = task_rng(); SimpleHashCache { entries: Vec::from_elem(cache_size, None), k0: r.gen(), @@ -213,7 +213,7 @@ impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> { } } -impl<K:Clone+Eq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> { +impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> { fn insert(&mut self, key: K, value: V) { let bucket_index = self.bucket_for_key(&key); *self.entries.get_mut(bucket_index) = Some((key, value)); diff --git a/src/components/util/geometry.rs b/src/components/util/geometry.rs index e8f8afd4638..a8c03832058 100644 --- a/src/components/util/geometry.rs +++ b/src/components/util/geometry.rs @@ -64,7 +64,7 @@ pub enum PagePx {} // See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info. // // FIXME: Implement Au using Length and ScaleFactor instead of a custom type. -#[deriving(Clone, Eq, Ord, Zero)] +#[deriving(Clone, PartialEq, PartialOrd, Zero)] pub struct Au(pub i32); impl Default for Au { @@ -288,7 +288,7 @@ pub fn to_pt(au: Au) -> f64 { /// Returns true if the rect contains the given point. Points on the top or left sides of the rect /// are considered inside the rectangle, while points on the right or bottom sides of the rect are /// not considered inside the rectangle. -pub fn rect_contains_point<T:Ord + Add<T,T>>(rect: Rect<T>, point: Point2D<T>) -> bool { +pub fn rect_contains_point<T:PartialOrd + Add<T,T>>(rect: Rect<T>, point: Point2D<T>) -> bool { point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width && point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height } diff --git a/src/components/util/namespace.rs b/src/components/util/namespace.rs index 22dd1655443..1f32ae83017 100644 --- a/src/components/util/namespace.rs +++ b/src/components/util/namespace.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[deriving(Eq, Clone, Encodable)] +#[deriving(PartialEq, Clone, Encodable)] pub enum Namespace { Null, HTML, diff --git a/src/components/util/range.rs b/src/components/util/range.rs index 3c261d4c265..23dad9c4f69 100644 --- a/src/components/util/range.rs +++ b/src/components/util/range.rs @@ -12,10 +12,10 @@ use std::num::{Bounded, Zero}; pub trait RangeIndex: Copy + Clone + fmt::Show + + PartialEq + + PartialOrd + Eq + Ord - + TotalEq - + TotalOrd + Add<Self, Self> + Sub<Self, Self> + Neg<Self> @@ -40,7 +40,7 @@ impl IntRangeIndex<int> for int { #[macro_export] macro_rules! int_range_index { ($(#[$attr:meta])* struct $Self:ident($T:ty)) => ( - #[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show, Zero)] + #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Zero)] $(#[$attr])* pub struct $Self(pub $T); diff --git a/src/components/util/smallvec.rs b/src/components/util/smallvec.rs index daa2083d464..904dfaa41a3 100644 --- a/src/components/util/smallvec.rs +++ b/src/components/util/smallvec.rs @@ -11,7 +11,7 @@ use std::intrinsics; use std::mem; use std::ptr; use std::raw::Slice; -use std::rt::local_heap; +use rustrt::local_heap; use alloc::heap; // Generic code for all small vectors diff --git a/src/components/util/sort.rs b/src/components/util/sort.rs index 589a6456d4b..5d5ba481f57 100644 --- a/src/components/util/sort.rs +++ b/src/components/util/sort.rs @@ -4,7 +4,7 @@ //! In-place sorting. -fn quicksort_helper<T:Ord + Eq>(arr: &mut [T], left: int, right: int) { +fn quicksort_helper<T:Ord + Eq + PartialOrd + PartialEq>(arr: &mut [T], left: int, right: int) { if right <= left { return } @@ -68,7 +68,7 @@ fn quicksort_helper<T:Ord + Eq>(arr: &mut [T], left: int, right: int) { /// /// The algorithm is from Sedgewick and Bentley, "Quicksort is Optimal": /// http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf -pub fn quicksort<T:Ord + Eq>(arr: &mut [T]) { +pub fn quicksort<T:Ord + Eq + PartialOrd + PartialEq>(arr: &mut [T]) { if arr.len() <= 1 { return } @@ -79,8 +79,8 @@ pub fn quicksort<T:Ord + Eq>(arr: &mut [T]) { #[cfg(test)] pub mod test { - use rand; - use rand::{Rng, task_rng}; + use std::rand; + use std::rand::Rng; use sort; @@ -89,7 +89,7 @@ pub mod test { let mut rng = rand::task_rng(); for _ in range(0, 50000) { let len: uint = rng.gen(); - let mut v: Vec<int> = rng.gen_vec((len % 32) + 1).iter().map(|&x| x).collect(); + let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect(); sort::quicksort(v.as_mut_slice()); for i in range(0, v.len() - 1) { assert!(v.get(i) <= v.get(i + 1)) diff --git a/src/components/util/time.rs b/src/components/util/time.rs index c60a428c40b..754828c8390 100644 --- a/src/components/util/time.rs +++ b/src/components/util/time.rs @@ -33,7 +33,7 @@ pub enum TimeProfilerMsg { } #[repr(u32)] -#[deriving(Eq, Clone, Ord, TotalEq, TotalOrd)] +#[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)] pub enum TimeProfilerCategory { CompositingCategory, LayoutQueryCategory, diff --git a/src/components/util/url.rs b/src/components/util/url.rs index ccedb77918f..a9cd24d610e 100644 --- a/src/components/util/url.rs +++ b/src/components/util/url.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use collections::HashMap; +use std::collections::hashmap::HashMap; use std::os; use std_url; use std_url::Url; diff --git a/src/components/util/util.rs b/src/components/util/util.rs index 483de9ed6b6..2e206b1fe8e 100644 --- a/src/components/util/util.rs +++ b/src/components/util/util.rs @@ -10,7 +10,7 @@ #![feature(macro_rules)] #![feature(phase)] -#[phase(syntax, link)] +#[phase(plugin, link)] extern crate log; extern crate debug; @@ -21,6 +21,7 @@ extern crate geom; extern crate getopts; extern crate native; extern crate rand; +extern crate rustrt; extern crate serialize; extern crate sync; extern crate std_time = "time"; diff --git a/src/components/util/vec.rs b/src/components/util/vec.rs index f5c01786d9a..acb5e6f3325 100644 --- a/src/components/util/vec.rs +++ b/src/components/util/vec.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::cmp::{Ord, Eq}; +use std::cmp::{PartialOrd, PartialEq}; /// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in /// performance-critical code, so a closure is insufficient. @@ -10,7 +10,7 @@ pub trait Comparator<K,T> { fn compare(&self, key: &K, value: &T) -> Ordering; } -pub trait BinarySearchMethods<'a, T: TotalOrd + Ord + Eq> { +pub trait BinarySearchMethods<'a, T: Ord + PartialOrd + PartialEq> { fn binary_search(&self, key: &T) -> Option<&'a T>; fn binary_search_index(&self, key: &T) -> Option<uint>; } @@ -19,7 +19,7 @@ pub trait FullBinarySearchMethods<T> { fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<uint>; } -impl<'a, T: TotalOrd + Ord + Eq> BinarySearchMethods<'a, T> for &'a [T] { +impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] { fn binary_search(&self, key: &T) -> Option<&'a T> { self.binary_search_index(key).map(|i| &self[i]) } @@ -55,14 +55,14 @@ impl<'a, T> FullBinarySearchMethods<T> for &'a [T] { struct DefaultComparator; -impl<T:Eq + Ord + TotalOrd> Comparator<T,T> for DefaultComparator { +impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator { fn compare(&self, key: &T, value: &T) -> Ordering { (*key).cmp(value) } } #[cfg(test)] -fn test_find_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T]) { +fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) { let mut i = 0; while i < arr.len() { assert!(test_match(&arr[i], arr.binary_search(&arr[i]))); @@ -71,7 +71,7 @@ fn test_find_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T]) { } #[cfg(test)] -fn test_miss_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T], misses: &[T]) { +fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T], misses: &[T]) { let mut i = 0; while i < misses.len() { let res = arr.binary_search(&misses[i]); @@ -82,7 +82,7 @@ fn test_miss_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T], misses: &[T] } #[cfg(test)] -fn test_match<T: Eq>(b: &T, a: Option<&T>) -> bool { +fn test_match<T: PartialEq>(b: &T, a: Option<&T>) -> bool { match a { None => false, Some(t) => t == b diff --git a/src/components/util/workqueue.rs b/src/components/util/workqueue.rs index 5caa6ff7ca0..ccfbc03da1a 100644 --- a/src/components/util/workqueue.rs +++ b/src/components/util/workqueue.rs @@ -8,12 +8,12 @@ //! higher-level API on top of this could allow safe fork-join parallelism. use native; -use rand; use rand::{Rng, XorShiftRng}; use std::mem; +use std::rand::weak_rng; use std::sync::atomics::{AtomicUint, SeqCst}; use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker}; -use std::task::TaskOpts; +use rustrt::task::TaskOpts; /// A unit of work. /// @@ -217,7 +217,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> { port: worker_port, chan: supervisor_chan.clone(), other_deques: vec!(), - rng: rand::weak_rng(), + rng: weak_rng(), }); } diff --git a/src/platform/macos/rust-cocoa b/src/platform/macos/rust-cocoa -Subproject c0036e25bbff4cc9f2100b344c37e50a0201a96 +Subproject 9516a94b8b02e30e17a0eb52e4aaae9430064f4 diff --git a/src/platform/macos/rust-core-foundation b/src/platform/macos/rust-core-foundation -Subproject fe9455de1723be0b8ce78a60e110e18c739940a +Subproject 4186de0b559bfc21b09ecc9c33aca453d6d4876 diff --git a/src/platform/macos/rust-core-graphics b/src/platform/macos/rust-core-graphics -Subproject 8bb25c2a193f3b47bb5406c78c2d04396c345f2 +Subproject 1d79b7db2429f52201ca6ac071ce6526e00accc diff --git a/src/platform/macos/rust-core-text b/src/platform/macos/rust-core-text -Subproject 187c5852d2c285daa3d8c1a0a1e9c8c034a42ff +Subproject 0953d3258c050912ce91530a3625ed956881846 diff --git a/src/platform/macos/rust-io-surface b/src/platform/macos/rust-io-surface -Subproject a0a42da1b85f431d18630454c5f2879c15771a5 +Subproject 745cc15c4a6aba1833597c8f1f1244f0e187ee4 diff --git a/src/support/azure/rust-azure b/src/support/azure/rust-azure -Subproject 56beabc7132e9075620d397a38cf335003b846c +Subproject 2d00be47103f654c4fe30a806ac358abe9754d3 diff --git a/src/support/css/rust-cssparser b/src/support/css/rust-cssparser -Subproject 01bbc87a189134a71016290ce7c8b77b3b77ffb +Subproject 5b292cb73d4b01aaec56b16f18cca48325e5cff diff --git a/src/support/encoding/rust-encoding b/src/support/encoding/rust-encoding -Subproject d6dc8d0402e317e9f9cc932ddb8502fcfc48438 +Subproject 1b1792712cb56ba82e47a2109dc705b3a066bf1 diff --git a/src/support/geom/rust-geom b/src/support/geom/rust-geom -Subproject db3eb69799fa629599a729c37d6101e115cec01 +Subproject 2b5981a97ab607a7b24f39484105d17c1e3a6fb diff --git a/src/support/glfw/glfw-rs b/src/support/glfw/glfw-rs -Subproject 51cdd77e2319c35e1445ffca50c25bf3cf8372c +Subproject 9a53b6c4cd354bcd21e5dcae03a6555428302c1 diff --git a/src/support/http/rust-http b/src/support/http/rust-http -Subproject a02cf0c0b67fe159de9e5ffb8f31e923dd4754c +Subproject ae4820bfd19af931bfc84f406b74dfb67ab5ebe diff --git a/src/support/layers/rust-layers b/src/support/layers/rust-layers -Subproject 80515323fa470b340157ac6137d0f37b3e2d51d +Subproject 2b208270fac74af639228bc7d065436a73e67b2 diff --git a/src/support/phf/rust-phf b/src/support/phf/rust-phf -Subproject 8564c2f9b23a3e178f8b233b5c08e546c87d6f7 +Subproject 0165c93a0c77d1f48dcc62ffcb1a61e9fe9c4f2 diff --git a/src/support/png/rust-png b/src/support/png/rust-png -Subproject 0105a21091b89cda0c8480d2240c45dc0d7b385 +Subproject 6267a184db3fa0b9f21b717766166aba3ceca98 diff --git a/src/support/sharegl/sharegl b/src/support/sharegl/sharegl -Subproject 673b4ec2d8aa40c27de31969fa69b8504036024 +Subproject d5d71e7fa23076f945eb415d275d0da18084ff2 diff --git a/src/test/harness/contenttest/contenttest.rs b/src/test/harness/contenttest/contenttest.rs index bd57345811d..037c751c578 100644 --- a/src/test/harness/contenttest/contenttest.rs +++ b/src/test/harness/contenttest/contenttest.rs @@ -12,7 +12,7 @@ extern crate getopts; extern crate regex; extern crate test; -use test::{TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName}; +use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName}; use getopts::{getopts, reqopt}; use std::{os, str}; use std::io::fs; @@ -63,7 +63,8 @@ fn test_options(config: Config) -> TestOpts { save_metrics: None, test_shard: None, logfile: None, - nocapture: false + nocapture: false, + color: AutoColor } } diff --git a/src/test/harness/reftest/reftest.rs b/src/test/harness/reftest/reftest.rs index 8d71349055d..7e6638a37d9 100644 --- a/src/test/harness/reftest/reftest.rs +++ b/src/test/harness/reftest/reftest.rs @@ -16,7 +16,7 @@ use std::io; use std::io::{File, Reader, Command}; use std::io::process::ExitStatus; use std::os; -use test::{DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn}; +use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn}; use test::run_tests_console; use regex::Regex; @@ -45,6 +45,7 @@ fn main() { save_metrics: None, test_shard: None, nocapture: false, + color: AutoColor }; match run_tests_console(&test_opts, tests) { @@ -54,7 +55,7 @@ fn main() { } } -#[deriving(Eq)] +#[deriving(PartialEq)] enum ReftestKind { Same, Different, |