aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-12-18 04:42:50 -0700
committerbors-servo <metajack+bors@gmail.com>2014-12-18 04:42:50 -0700
commiteea49ee1d986c306a8eec32b64be9b10cb2278fc (patch)
tree5c9555bd62fbb7375fab1561cb62660ea1022b7d
parentd7b3900431598883212162460254c846bf5f8b52 (diff)
parentbf4480bb791cd918a00fb4bdea234fde676b28e0 (diff)
downloadservo-eea49ee1d986c306a8eec32b64be9b10cb2278fc.tar.gz
servo-eea49ee1d986c306a8eec32b64be9b10cb2278fc.zip
auto merge of #4420 : servo/servo/fix-warnings, r=Ms2ger
-rw-r--r--components/compositing/compositor.rs7
-rw-r--r--components/gfx/paint_context.rs8
-rw-r--r--components/gfx/text/glyph.rs8
-rw-r--r--components/layout/flow.rs7
-rw-r--r--components/layout/inline.rs9
-rw-r--r--components/plugins/lints.rs2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py28
-rw-r--r--components/script/dom/bindings/conversions.rs5
-rw-r--r--components/script/dom/bindings/utils.rs6
-rw-r--r--components/servo/Cargo.lock4
-rw-r--r--components/util/geometry.rs12
-rw-r--r--components/util/logical_geometry.rs33
-rw-r--r--components/util/range.rs69
-rw-r--r--ports/cef/Cargo.lock4
-rw-r--r--ports/gonk/Cargo.lock5
-rw-r--r--python/servo/build_commands.py6
16 files changed, 95 insertions, 118 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 5b265d2ec15..59ceaea49dc 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -14,7 +14,6 @@ use windowing::{MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg}
use azure::azure_hl;
use std::cmp;
use std::mem;
-use std::num::Zero;
use geom::point::{Point2D, TypedPoint2D};
use geom::rect::{Rect, TypedRect};
use geom::size::TypedSize2D;
@@ -176,7 +175,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
context: None,
root_pipeline: None,
scene: Scene::new(Rect {
- origin: Zero::zero(),
+ origin: Point2D::zero(),
size: window_size.as_f32(),
}),
window_size: window_size,
@@ -1027,7 +1026,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window.
self.scene.viewport = Rect {
- origin: Zero::zero(),
+ origin: Point2D::zero(),
size: self.window_size.as_f32(),
};
// paint the scene.
@@ -1121,7 +1120,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
};
let clip_rect_for_children = if masks_to_bounds {
- Rect(Zero::zero(), clipped_layer_bounds.size)
+ Rect(Point2D::zero(), clipped_layer_bounds.size)
} else {
clipped_layer_bounds.translate(&clip_rect.origin)
};
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index 81cbd806fbc..96de5a82aed 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -29,7 +29,7 @@ use servo_util::geometry::{Au, MAX_RECT};
use servo_util::opts;
use servo_util::range::Range;
use std::default::Default;
-use std::num::{Float, FloatMath, Zero};
+use std::num::{Float, FloatMath};
use std::ptr;
use style::computed_values::border_style;
use sync::Arc;
@@ -666,7 +666,7 @@ impl<'a> PaintContext<'a> {
self.draw_target.set_transform(&current_transform.mul(&Matrix2D::new(0., -1.,
1., 0.,
x, y)));
- Zero::zero()
+ Point2D::zero()
}
SidewaysRight => {
let x = text.baseline_origin.x.to_subpx() as AzFloat;
@@ -674,7 +674,7 @@ impl<'a> PaintContext<'a> {
self.draw_target.set_transform(&current_transform.mul(&Matrix2D::new(0., 1.,
-1., 0.,
x, y)));
- Zero::zero()
+ Point2D::zero()
}
};
@@ -988,7 +988,7 @@ impl ScaledFontExtensionMethods for ScaledFont {
for slice in run.natural_word_slices_in_range(range) {
for (_i, glyph) in slice.glyphs.iter_glyphs_for_char_range(&slice.range) {
let glyph_advance = glyph.advance();
- let glyph_offset = glyph.offset().unwrap_or(Zero::zero());
+ let glyph_offset = glyph.offset().unwrap_or(Point2D::zero());
let azglyph = struct__AzGlyph {
mIndex: glyph.id() as uint32_t,
mPosition: struct__AzPoint {
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 4f9407f8bbf..981a0f877cc 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -7,11 +7,11 @@ use self::GlyphInfo::*;
use servo_util::vec::*;
use servo_util::range;
-use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex};
+use servo_util::range::{Range, RangeIndex, EachIndex};
use servo_util::geometry::Au;
use std::cmp::PartialOrd;
-use std::num::{NumCast, Zero};
+use std::num::NumCast;
use std::mem;
use std::u16;
use std::vec::Vec;
@@ -434,7 +434,7 @@ impl GlyphData {
GlyphData {
id: id,
advance: advance,
- offset: offset.unwrap_or(Zero::zero()),
+ offset: offset.unwrap_or(Point2D::zero()),
is_missing: is_missing,
cluster_start: cluster_start,
ligature_start: ligature_start,
@@ -549,7 +549,7 @@ impl<'a> GlyphStore {
fn glyph_is_compressible(data: &GlyphData) -> bool {
is_simple_glyph_id(data.id)
&& is_simple_advance(data.advance)
- && data.offset.is_zero()
+ && data.offset == Point2D::zero()
&& data.cluster_start // others are stored in detail buffer
}
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index ebc78b6197f..bceaef0b2c8 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -53,7 +53,6 @@ use servo_util::geometry::Au;
use servo_util::logical_geometry::WritingMode;
use servo_util::logical_geometry::{LogicalRect, LogicalSize};
use std::mem;
-use std::num::Zero;
use std::fmt;
use std::iter::Zip;
use std::raw;
@@ -686,7 +685,7 @@ impl AbsolutePositionInfo {
// of the root layer.
AbsolutePositionInfo {
relative_containing_block_size: LogicalSize::zero(writing_mode),
- stacking_relative_position_of_absolute_containing_block: Zero::zero(),
+ stacking_relative_position_of_absolute_containing_block: Point2D::zero(),
layers_needed_for_positioned_flows: false,
}
}
@@ -902,7 +901,7 @@ impl BaseFlow {
parallel: FlowParallelInfo::new(),
floats: Floats::new(writing_mode),
collapsible_margins: CollapsibleMargins::new(),
- stacking_relative_position: Zero::zero(),
+ stacking_relative_position: Point2D::zero(),
abs_descendants: Descendants::new(),
absolute_static_i_offset: Au(0),
fixed_static_i_offset: Au(0),
@@ -911,7 +910,7 @@ impl BaseFlow {
absolute_cb: ContainingBlockLink::new(),
display_list_building_result: DisplayListBuildingResult::None,
absolute_position_info: AbsolutePositionInfo::new(writing_mode),
- clip_rect: Rect(Zero::zero(), Size2D(Au(0), Au(0))),
+ clip_rect: Rect(Point2D::zero(), Size2D::zero()),
flags: flags,
writing_mode: writing_mode,
}
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 70b933dcacf..c3c531fcfdf 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -28,12 +28,11 @@ use gfx::text::glyph::CharIndex;
use servo_util::geometry::Au;
use servo_util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use servo_util::opts;
-use servo_util::range::{IntRangeIndex, Range, RangeIndex};
+use servo_util::range::{Range, RangeIndex};
use servo_util::arc_ptr_eq;
use std::cmp::max;
use std::fmt;
use std::mem;
-use std::num;
use std::u16;
use style::computed_values::{text_align, vertical_align, white_space};
use style::ComputedValues;
@@ -211,7 +210,7 @@ impl LineBreaker {
/// Reinitializes the pending line to blank data.
fn reset_line(&mut self) {
- self.pending_line.range.reset(num::zero(), num::zero());
+ self.pending_line.range.reset(FragmentIndex(0), FragmentIndex(0));
self.pending_line.bounds = LogicalRect::new(self.floats.writing_mode,
Au(0),
self.cur_b,
@@ -632,7 +631,7 @@ impl LineBreaker {
if self.pending_line_is_empty() {
assert!(self.new_fragments.len() <= (u16::MAX as uint));
self.pending_line.range.reset(FragmentIndex(self.new_fragments.len() as int),
- num::zero());
+ FragmentIndex(0));
}
self.pending_line.range.extend_by(FragmentIndex(1));
@@ -655,7 +654,7 @@ impl LineBreaker {
/// Returns true if the pending line is empty and false otherwise.
fn pending_line_is_empty(&self) -> bool {
- self.pending_line.range.length() == num::zero()
+ self.pending_line.range.length() == FragmentIndex(0)
}
}
diff --git a/components/plugins/lints.rs b/components/plugins/lints.rs
index c48eeed9c80..d5891cc9c5a 100644
--- a/components/plugins/lints.rs
+++ b/components/plugins/lints.rs
@@ -78,7 +78,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
ast::TyPath(_, _, id) => {
- match cx.tcx.def_map.borrow().get_copy(&id) {
+ match cx.tcx.def_map.borrow()[id].clone() {
def::DefTy(def_id, _) => {
if ty::has_attr(cx.tcx, def_id, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 4a760225cf4..b34c6441b70 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -104,8 +104,8 @@ class CastableObjectUnwrapper():
self.substitution = {
"type": descriptor.nativeType,
"depth": descriptor.interface.inheritanceDepth(),
- "prototype": "PrototypeList::id::" + descriptor.name,
- "protoID": "PrototypeList::id::" + descriptor.name + " as uint",
+ "prototype": "PrototypeList::ID::" + descriptor.name,
+ "protoID": "PrototypeList::ID::" + descriptor.name + " as uint",
"source": source,
"codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
}
@@ -1418,12 +1418,12 @@ class CGNamespace(CGWrapper):
return CGNamespace(namespaces[0], inner, public=public)
def DOMClass(descriptor):
- protoList = ['PrototypeList::id::' + proto for proto in descriptor.prototypeChain]
- # Pad out the list to the right length with id::Count so we
+ protoList = ['PrototypeList::ID::' + proto for proto in descriptor.prototypeChain]
+ # Pad out the list to the right length with ID::Count so we
# guarantee that all the lists are the same length. id::Count
# is never the ID of any prototype, so it's safe to use as
# padding.
- protoList.extend(['PrototypeList::id::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
+ protoList.extend(['PrototypeList::ID::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
return """DOMClass {
interface_chain: [ %s ],
@@ -1801,7 +1801,7 @@ def CreateBindingJSObject(descriptor, parent=None):
if descriptor.proxy:
assert not descriptor.isGlobal()
create += """
-let handler = RegisterBindings::proxy_handlers[PrototypeList::proxies::%s as uint];
+let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as uint];
let mut private = PrivateValue(squirrel_away_unique(aObject) as *const libc::c_void);
let obj = with_compartment(aCx, proto, || {
NewProxyObject(aCx, handler,
@@ -1887,8 +1887,8 @@ class CGIDLInterface(CGThing):
}
return string.Template("""
impl IDLInterface for ${type} {
- fn get_prototype_id(_: Option<${type}>) -> PrototypeList::id {
- PrototypeList::id::${type}
+ fn get_prototype_id(_: Option<${type}>) -> PrototypeList::ID {
+ PrototypeList::ID::${type}
}
fn get_prototype_depth(_: Option<${type}>) -> uint {
${depth}
@@ -2023,7 +2023,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
Argument('*mut JSObject', 'aReceiver')]
CGAbstractMethod.__init__(self, descriptor, name,
'*mut JSObject', args, pub=pub)
- self.id = idPrefix + "id::" + self.descriptor.name
+ self.id = idPrefix + "ID::" + self.descriptor.name
def definition_body(self):
return CGGeneric("""
@@ -2682,7 +2682,7 @@ class CGMemberJITInfo(CGThing):
self.descriptor = descriptor
def defineJitInfo(self, infoName, opName, infallible):
- protoID = "PrototypeList::id::%s as u32" % self.descriptor.name
+ protoID = "PrototypeList::ID::%s as u32" % self.descriptor.name
depth = self.descriptor.interface.inheritanceDepth()
failstr = "true" if infallible else "false"
return ("\n"
@@ -4397,7 +4397,7 @@ class CGRegisterProxyHandlersMethod(CGAbstractMethod):
def definition_body(self):
return CGList([
- CGGeneric("proxy_handlers[proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
+ CGGeneric("proxy_handlers[Proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
for desc in self.descriptors
], "\n")
@@ -5135,8 +5135,8 @@ class GlobalGenRoots():
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
- CGNonNamespacedEnum('id', protos, [0], deriving="PartialEq"),
- CGNonNamespacedEnum('proxies', proxies, [0], deriving="PartialEq"),
+ CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq"),
+ CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq"),
])
@@ -5150,7 +5150,7 @@ class GlobalGenRoots():
return CGImports(code, [], [
'dom::bindings::codegen',
- 'dom::bindings::codegen::PrototypeList::proxies',
+ 'dom::bindings::codegen::PrototypeList::Proxies',
'js::jsapi::JSContext',
'js::jsapi::JSObject',
'libc',
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 925311619a4..52150b26f9c 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -6,6 +6,7 @@
//! Conversions of Rust values to and from `JSVal`.
+use dom::bindings::codegen::PrototypeList;
use dom::bindings::js::{JS, JSRef, Root};
use dom::bindings::str::ByteString;
use dom::bindings::utils::{Reflectable, Reflector};
@@ -29,15 +30,13 @@ use libc;
use std::default;
use std::slice;
-use dom::bindings::codegen::PrototypeList;
-
/// A trait to retrieve the constants necessary to check if a `JSObject`
/// implements a given interface.
// FIXME (https://github.com/rust-lang/rfcs/pull/4)
// remove Option<Self> arguments.
pub trait IDLInterface {
/// Returns the prototype ID.
- fn get_prototype_id(_: Option<Self>) -> PrototypeList::id;
+ fn get_prototype_id(_: Option<Self>) -> PrototypeList::ID;
/// Returns the prototype depth, i.e., the number of interfaces this
/// interface inherits from.
fn get_prototype_depth(_: Option<Self>) -> uint;
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index a08b664b3dd..f598068fa53 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -124,7 +124,7 @@ pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<DOMClass, ()> {
/// not a reflector for a DOM object of the given type (as defined by the
/// proto_id and proto_depth).
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
- proto_id: PrototypeList::id,
+ proto_id: PrototypeList::ID,
proto_depth: uint) -> Result<JS<T>, ()> {
unsafe {
let dom_class = get_dom_class(obj).or_else(|_| {
@@ -234,7 +234,7 @@ pub struct NativePropertyHooks {
pub struct DOMClass {
/// A list of interfaces that this object implements, in order of decreasing
/// derivedness.
- pub interface_chain: [PrototypeList::id, ..MAX_PROTO_CHAIN_LENGTH],
+ pub interface_chain: [PrototypeList::ID, ..MAX_PROTO_CHAIN_LENGTH],
/// The NativePropertyHooks for the interface associated with this class.
pub native_hooks: &'static NativePropertyHooks,
@@ -421,7 +421,7 @@ pub unsafe extern fn ThrowingConstructor(cx: *mut JSContext, _argc: c_uint, _vp:
/// Construct and cache the ProtoOrIfaceArray for the given global.
/// Fails if the argument is not a DOM global.
pub fn initialize_global(global: *mut JSObject) {
- let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::Count as uint]);
+ let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::ID::Count as uint]);
unsafe {
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
let box_ = squirrel_away_unique(protoArray);
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 716539140c9..48bfdb26775 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -247,7 +247,7 @@ source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d45
[[package]]
name = "geom"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#95e746133b4a35b53eb259304668b63ee8de42b8"
+source = "git+https://github.com/servo/rust-geom#5e52790076fc238a395d1777c4280fa46a1555fa"
[[package]]
name = "gfx"
@@ -425,7 +425,7 @@ source = "git+https://github.com/bjz/gl-rs.git#c76c23fc9a0dae824b45550d4b823cdb7
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#5fbdc521b82296e325d2df13fce8026c727c01d2"
+source = "git+https://github.com/servo/rust-layers#21798aac4de6bfd800836f419dd5b6a308edcaa4"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 8be6b50dbee..2dc9fe61b4c 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -6,11 +6,12 @@ use geom::length::Length;
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
+use geom::num::Zero;
use serialize::{Encodable, Encoder};
use std::default::Default;
use std::i32;
-use std::num::{Float, NumCast, Zero};
+use std::num::{Float, NumCast};
use std::fmt;
// Units for use with geom::length and geom::scale_factor.
@@ -64,7 +65,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, Hash, PartialEq, PartialOrd, Eq, Ord, Zero)]
+#[deriving(Clone, Hash, PartialEq, PartialOrd, Eq, Ord)]
pub struct Au(pub i32);
impl Default for Au {
@@ -74,6 +75,13 @@ impl Default for Au {
}
}
+impl Zero for Au {
+ #[inline]
+ fn zero() -> Au {
+ Au(0)
+ }
+}
+
pub static ZERO_POINT: Point2D<Au> = Point2D {
x: Au(0),
y: Au(0),
diff --git a/components/util/logical_geometry.rs b/components/util/logical_geometry.rs
index 96664cc5605..e21039ce758 100644
--- a/components/util/logical_geometry.rs
+++ b/components/util/logical_geometry.rs
@@ -5,9 +5,9 @@
//! Geometry in flow-relative space.
use geom::{Size2D, Point2D, SideOffsets2D, Rect};
+use geom::num::Zero;
use std::cmp::{min, max};
use std::fmt::{Show, Formatter, FormatError};
-use std::num::Zero;
bitflags!(
#[deriving(Encodable)]
@@ -158,11 +158,6 @@ impl<T: Zero> LogicalSize<T> {
debug_writing_mode: DebugWritingMode::new(mode),
}
}
-
- #[inline]
- pub fn is_zero(&self) -> bool {
- self.inline.is_zero() && self.block.is_zero()
- }
}
impl<T: Copy> LogicalSize<T> {
@@ -295,11 +290,6 @@ impl<T: Zero> LogicalPoint<T> {
debug_writing_mode: DebugWritingMode::new(mode),
}
}
-
- #[inline]
- pub fn is_zero(&self) -> bool {
- self.i.is_zero() && self.b.is_zero()
- }
}
impl<T: Copy> LogicalPoint<T> {
@@ -476,14 +466,6 @@ impl<T: Zero> LogicalMargin<T> {
debug_writing_mode: DebugWritingMode::new(mode),
}
}
-
- #[inline]
- pub fn is_zero(&self) -> bool {
- self.block_start.is_zero() &&
- self.inline_end.is_zero() &&
- self.block_end.is_zero() &&
- self.inline_start.is_zero()
- }
}
impl<T: Copy> LogicalMargin<T> {
@@ -666,6 +648,14 @@ impl<T: Copy> LogicalMargin<T> {
}
}
+impl<T: PartialEq + Zero> LogicalMargin<T> {
+ #[inline]
+ pub fn is_zero(&self) -> bool {
+ self.block_start == Zero::zero() && self.inline_end == Zero::zero() &&
+ self.block_end == Zero::zero() && self.inline_start == Zero::zero()
+ }
+}
+
impl<T: Add<T, T>> LogicalMargin<T> {
#[inline]
pub fn inline_start_end(&self) -> T {
@@ -756,11 +746,6 @@ impl<T: Zero> LogicalRect<T> {
debug_writing_mode: DebugWritingMode::new(mode),
}
}
-
- #[inline]
- pub fn is_zero(&self) -> bool {
- self.start.is_zero() && self.size.is_zero()
- }
}
impl<T: Copy> LogicalRect<T> {
diff --git a/components/util/range.rs b/components/util/range.rs
index 2cdb49e27b6..103f6d3c91d 100644
--- a/components/util/range.rs
+++ b/components/util/range.rs
@@ -6,29 +6,15 @@ use std::cmp::{max, min};
use std::iter;
use std::fmt;
use std::num;
-use std::num::{Int, Bounded, Zero};
+use std::num::Int;
/// An index type to be used by a `Range`
-pub trait RangeIndex: Copy
- + Clone
- + fmt::Show
- + PartialEq
- + PartialOrd
- + Eq
- + Ord
- + Add<Self, Self>
- + Sub<Self, Self>
- + Neg<Self>
- + Zero {}
-
-pub trait IntRangeIndex<T>: RangeIndex + Copy {
+pub trait RangeIndex<T>: Int + fmt::Show {
fn new(x: T) -> Self;
fn get(self) -> T;
}
-impl RangeIndex for int {}
-
-impl IntRangeIndex<int> for int {
+impl RangeIndex<int> for int {
#[inline]
fn new(x: int) -> int { x }
@@ -40,7 +26,7 @@ impl IntRangeIndex<int> for int {
#[macro_export]
macro_rules! int_range_index {
($(#[$attr:meta])* struct $Self:ident($T:ty)) => (
- #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Zero)]
+ #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)]
$(#[$attr])*
pub struct $Self(pub $T);
@@ -51,7 +37,18 @@ macro_rules! int_range_index {
}
}
- impl RangeIndex for $Self {}
+ impl RangeIndex<$T> for $Self {
+ #[inline]
+ fn new(x: $T) -> $Self {
+ $Self(x)
+ }
+
+ #[inline]
+ fn get(self) -> $T {
+ match self { $Self(x) => x }
+ }
+ }
+
impl ::std::num::Int for $Self {
fn zero() -> $Self { $Self(0) }
fn one() -> $Self { $Self(1) }
@@ -77,18 +74,6 @@ macro_rules! int_range_index {
}
}
- impl IntRangeIndex<$T> for $Self {
- #[inline]
- fn new(x: $T) -> $Self {
- $Self(x)
- }
-
- #[inline]
- fn get(self) -> $T {
- match self { $Self(x) => x }
- }
- }
-
impl Add<$Self, $Self> for $Self {
#[inline]
fn add(&self, other: &$Self) -> $Self {
@@ -196,7 +181,7 @@ pub struct Range<I> {
length: I,
}
-impl<I: RangeIndex> fmt::Show for Range<I> {
+impl<I: RangeIndex<T>, T> fmt::Show for Range<I> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "[{} .. {})", self.begin(), self.end())
}
@@ -207,14 +192,14 @@ pub struct EachIndex<T, I> {
it: iter::Range<T>,
}
-pub fn each_index<T: Int, I: IntRangeIndex<T>>(start: I, stop: I) -> EachIndex<T, I> {
+pub fn each_index<T: Int, I: RangeIndex<T>>(start: I, stop: I) -> EachIndex<T, I> {
EachIndex { it: iter::range(start.get(), stop.get()) }
}
-impl<T: Int, I: IntRangeIndex<T>> Iterator<I> for EachIndex<T, I> {
+impl<T: Int, I: RangeIndex<T>> Iterator<I> for EachIndex<T, I> {
#[inline]
fn next(&mut self) -> Option<I> {
- self.it.next().map(|i| IntRangeIndex::new(i))
+ self.it.next().map(|i| RangeIndex::new(i))
}
#[inline]
@@ -223,7 +208,7 @@ impl<T: Int, I: IntRangeIndex<T>> Iterator<I> for EachIndex<T, I> {
}
}
-impl<I: RangeIndex> Range<I> {
+impl<I: RangeIndex<T>, T> Range<I> {
/// Create a new range from beginning and length offsets. This could be
/// denoted as `[begin, begin + length)`.
///
@@ -239,7 +224,7 @@ impl<I: RangeIndex> Range<I> {
#[inline]
pub fn empty() -> Range<I> {
- Range::new(num::zero(), num::zero())
+ Range::new(Int::zero(), Int::zero())
}
/// The index offset to the beginning of the range.
@@ -287,7 +272,7 @@ impl<I: RangeIndex> Range<I> {
/// `true` if the offset from the beginning to the end of the range is zero.
#[inline]
pub fn is_empty(&self) -> bool {
- self.length().is_zero()
+ self.length() == Int::zero()
}
/// Shift the entire range by the supplied index delta.
@@ -360,7 +345,7 @@ impl<I: RangeIndex> Range<I> {
}
/// Methods for `Range`s with indices based on integer values
-impl<T: Int+Bounded, I: IntRangeIndex<T>> Range<I> {
+impl<T: Int, I: RangeIndex<T>> Range<I> {
/// Returns an iterater that increments over `[begin, end)`.
#[inline]
pub fn each_index(&self) -> EachIndex<T, I> {
@@ -372,7 +357,7 @@ impl<T: Int+Bounded, I: IntRangeIndex<T>> Range<I> {
let s_len = s.len();
match num::cast::<uint, T>(s_len) {
Some(len) => {
- let len = IntRangeIndex::new(len);
+ let len = RangeIndex::new(len);
self.begin() < len
&& self.end() <= len
&& self.length() <= len
@@ -381,8 +366,8 @@ impl<T: Int+Bounded, I: IntRangeIndex<T>> Range<I> {
debug!("Range<T>::is_valid_for_string: string length (len={}) is longer than the \
max value for the range index (max={})", s_len,
{
- let max: T = Bounded::max_value();
- let val: I = IntRangeIndex::new(max);
+ let max: T = Int::max_value();
+ let val: I = RangeIndex::new(max);
val
});
false
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 9079fd27a9c..cf65e21778c 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -243,7 +243,7 @@ source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d45
[[package]]
name = "geom"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#95e746133b4a35b53eb259304668b63ee8de42b8"
+source = "git+https://github.com/servo/rust-geom#5e52790076fc238a395d1777c4280fa46a1555fa"
[[package]]
name = "gfx"
@@ -393,7 +393,7 @@ source = "git+https://github.com/bjz/gl-rs.git#c76c23fc9a0dae824b45550d4b823cdb7
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#5fbdc521b82296e325d2df13fce8026c727c01d2"
+source = "git+https://github.com/servo/rust-layers#21798aac4de6bfd800836f419dd5b6a308edcaa4"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 7e0c096994f..637efe32449 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -207,7 +207,7 @@ source = "git+https://github.com/alexcrichton/gcc-rs#d35c34c871dd75f97fadf04cb0e
[[package]]
name = "geom"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#e5e74911ac6d3201009879b72499d6c681302611"
+source = "git+https://github.com/servo/rust-geom#5e52790076fc238a395d1777c4280fa46a1555fa"
[[package]]
name = "gfx"
@@ -329,7 +329,7 @@ source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#b068d2a96d54bf173b548aece36f5ea4ef9353cf"
+source = "git+https://github.com/servo/rust-layers#21798aac4de6bfd800836f419dd5b6a308edcaa4"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -410,6 +410,7 @@ dependencies = [
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
+ "style 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"util 0.0.1",
]
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index a283b0d6c91..540c0f1601b 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -38,14 +38,16 @@ class MachCommands(CommandBase):
@CommandArgument('--verbose', '-v',
action='store_true',
help='Print verbose output')
+ @CommandArgument('params', nargs='...',
+ help="Command-line arguments to be passed through to Cargo")
def build(self, target=None, release=False, jobs=None, android=None,
- verbose=False, debug_mozjs=False):
+ verbose=False, debug_mozjs=False, params=None):
self.ensure_bootstrapped()
if android is None:
android = self.config["build"]["android"]
- opts = []
+ opts = params or []
features = []
if release: