servo: Fixed deprecated vector syntax
authorMargaret Meyerhofer <mmeyerhofer@mozilla.com>
Thu, 12 Jul 2012 10:13:06 -0700
changeset 470862 84127bca3edc80373f49f9d0be7631ab820467b0
parent 470861 10c24d238b693b7f5fccbe30132e9499eaf610d5
child 470863 d2cc88a6196ea810bad8b3017ed43843e4d343a4
push id44079
push userbmo:gps@mozilla.com
push dateSat, 04 Feb 2017 00:14:49 +0000
servo: Fixed deprecated vector syntax Source-Repo: https://github.com/servo/servo Source-Revision: 1212f3df65db6ca7d7948805d285100dfc8f8336
servo/Makefile.in
servo/src/servo/dom/rcu.rs
servo/src/servo/dom/style.rs
servo/src/servo/gfx/pngsink.rs
servo/src/servo/gfx/surface.rs
servo/src/servo/layout/base.rs
servo/src/servo/layout/display_list.rs
servo/src/servo/layout/display_list_builder.rs
servo/src/servo/layout/style/matching.rs
servo/src/servo/net.rs
servo/src/servo/opts.rs
servo/src/servo/parser/css_builder.rs
servo/src/servo/parser/css_lexer.rs
servo/src/servo/parser/html_builder.rs
servo/src/servo/parser/html_lexer.rs
servo/src/servo/parser/lexer_util.rs
servo/src/servo/platform/osmain.rs
servo/src/servo/servo.rc
servo/src/servo/servo.rs
servo/src/servo/text/font.rs
servo/src/servo/text/native_font/quartz_native_font.rs
servo/src/servo/text/shaper.rs
servo/src/servo/text/text_run.rs
servo/src/servo/util/tree.rs
--- a/servo/Makefile.in
+++ b/servo/Makefile.in
@@ -181,21 +181,21 @@ check-rust-stb-image:
 check-rust-geom:
 	$(MAKE) check -C src/rust-geom
 
 .PHONY: check-rust-opengles
 check-rust-opengles:
 	$(MAKE) check -C src/rust-opengles
 
 .PHONY: check-rust-glut
-check-rust-glut:
+check-rust-glut: $(GLUT_DEPS)
 	RUSTFLAGS="-L ../rust-opengles" $(MAKE) check -C src/rust-glut
 
 .PHONY: check-rust-layers
-check-rust-layers:
+check-rust-layers: $(LAYERS_DEPS)
 	RUSTFLAGS="-L ../rust-geom -L ../rust-opengles -L ../rust-glut -L ../rust-azure -L ../rust-cocoa" \
         $(MAKE) check -C src/rust-layers
 
 .PHONY:	clean
 clean: $(CLEAN_DEPS)
 
 .PHONY: clean-ragel
 clean-ragel:
--- a/servo/src/servo/dom/rcu.rs
+++ b/servo/src/servo/dom/rcu.rs
@@ -46,25 +46,26 @@ fields.
 Readers can associate a piece of auxiliary data of type `A` along with main nodes.  This is
 convenient but dangerous: it is the reader's job to ensure that this data remains live independent
 of the RCU nodes themselves.
 
 ")];
 
 import ptr::extensions;
 import core::libc::types::os::arch::c95::size_t;
+import vec::push;
 
 export Handle;
 export ReaderMethods;
 export WriterMethods;
 export Scope;
 
 type ScopeData<T:send,A> = {
     mut layout_active: bool,
-    mut free_list: [Handle<T,A>],
+    mut free_list: ~[Handle<T,A>],
     mut first_dirty: Handle<T,A>
 };
 
 class ScopeResource<T:send,A> {
     let d : ScopeData<T,A>;
     new(-d : ScopeData<T,A>) {
         self.d = d;
     }
@@ -154,17 +155,17 @@ unsafe fn free_handle<T:send,A>(h: Handl
 }
 
 fn null_handle<T:send,A>() -> Handle<T,A> {
     _Handle(ptr::null())
 }
 
 fn Scope<T:send,A>() -> Scope<T,A> {
     @ScopeResource({mut layout_active: false,
-                    mut free_list: [],
+                    mut free_list: ~[],
                     mut first_dirty: null_handle()})
 }
 
 impl WriterMethods<T:copy send,A> for Scope<T,A> {
     fn is_reader_forked() -> bool {
         self.d.layout_active
     }
 
@@ -214,17 +215,17 @@ impl WriterMethods<T:copy send,A> for Sc
         let d: *HandleData<T,A> =
             unsafe::reinterpret_cast(
                 libc::malloc(sys::size_of::<HandleData<T,A>>() as size_t));
         (*d).read_ptr = self.clone(ptr::addr_of(v));
         (*d).write_ptr = unsafe::reinterpret_cast((*d).read_ptr);
         (*d).read_aux = ptr::null();
         (*d).next_dirty = null_handle();
         let h = _Handle(d);
-        self.d.free_list += [h];
+        push(self.d.free_list, h);
         ret h;
     }
 }
 
 #[cfg(test)]
 #[warn(no_non_implicitly_copyable_typarams)]
 mod test {
 
--- a/servo/src/servo/dom/style.rs
+++ b/servo/src/servo/dom/style.rs
@@ -16,17 +16,17 @@ enum StyleDeclaration{
 enum Attr{
     Exists(str),
     Exact(str, str),
     Includes(str, str),
     StartsWith(str, str)
 }
     
 enum Selector{
-    Element(str, [Attr]),
+    Element(str, ~[Attr]),
     Child(~Selector, ~Selector),
     Descendant(~Selector, ~Selector),
     Sibling(~Selector, ~Selector)
 }
 
-type Rule = ([~Selector], [StyleDeclaration]);
+type Rule = (~[~Selector], ~[StyleDeclaration]);
 
-type Stylesheet = [~Rule];
+type Stylesheet = ~[~Rule];
--- a/servo/src/servo/gfx/pngsink.rs
+++ b/servo/src/servo/gfx/pngsink.rs
@@ -1,13 +1,13 @@
 #[doc = "
 A graphics sink that renders to PNG format buffers
 
 Each time the renderer renders a frame the bufsink will output a
-`[u8]` containing the frame in PNG format.
+`~[u8]` containing the frame in PNG format.
 "];
 
 export PngSink, Msg, Exit;
 
 import libc::{c_int, c_uint, c_void, c_uchar};
 import azure::AzDrawTargetRef;
 import azure_bg = azure::bindgen;
 import azure_bg::{AzCreateDrawTargetForCairoSurface, AzReleaseDrawTarget};
@@ -40,17 +40,17 @@ impl PngSink of Sink for chan<Msg> {
     fn draw(next_dt: chan<AzDrawTargetRef>, draw_me: AzDrawTargetRef) {
         self.send(Draw(next_dt, draw_me))
     }
     fn add_event_listener(_listener: chan<Event>) {
         // No events in this sink.
     }
 }
 
-fn PngSink(output: chan<[u8]>) -> PngSink {
+fn PngSink(output: chan<~[u8]>) -> PngSink {
     spawn_listener::<Msg>(|po| {
         let cairo_surf = cairo_image_surface_create(
             CAIRO_FORMAT_ARGB32, 800 as c_int, 600 as c_int
             );
         assert cairo_surf.is_not_null();
 
         let draw_target = AzCreateDrawTargetForCairoSurface(cairo_surf);
         assert draw_target.is_not_null();
@@ -71,28 +71,28 @@ fn PngSink(output: chan<[u8]>) -> PngSin
 
         AzReleaseDrawTarget(draw_target);
         cairo_surface_destroy(cairo_surf);
     })
 }
 
 fn do_draw(sender: chan<AzDrawTargetRef>,
            dt: AzDrawTargetRef,
-           output: chan<[u8]>,
+           output: chan<~[u8]>,
            cairo_surf: *cairo_surface_t) {
 
-    listen(|data_ch: chan<[u8]>| {
+    listen(|data_ch: chan<~[u8]>| {
 
         extern fn write_fn(closure: *c_void,
                            data: *c_uchar,
                            len: c_uint)
 
             -> cairo_status_t unsafe {
 
-            let p: *chan<[u8]> = reinterpret_cast(closure);
+            let p: *chan<~[u8]> = reinterpret_cast(closure);
             let data_ch = *p;
 
             // Convert from *c_uchar to *u8
             let data = reinterpret_cast(data);
             let len = len as uint;
             // Copy to a vector
             let data = vec_from_buf(data, len);
             data_ch.send(data);
@@ -103,17 +103,17 @@ fn do_draw(sender: chan<AzDrawTargetRef>
         let closure = addr_of(data_ch);
 
         unsafe {
             cairo_surface_write_to_png_stream(
                 cairo_surf, write_fn, reinterpret_cast(closure));
         }
 
         // Collect the entire image into a single vector
-        let mut result = [];
+        let mut result = ~[];
         while data_ch.peek() {
             result += data_ch.recv();
         }
 
         // Send the PNG image away
         output.send(result);
     });
     // Send the next draw target to the renderer
@@ -122,17 +122,17 @@ fn do_draw(sender: chan<AzDrawTargetRef>
 
 #[test]
 fn sanity_check() {
     listen(|self_channel| {
 
         let sink = PngSink(self_channel);
         let renderer = Renderer(sink);
 
-        let dlist = [];
+        let dlist = ~[];
         renderer.send(RenderMsg(dlist));
         listen(|from_renderer| {
             renderer.send(renderer::ExitMsg(from_renderer));
             from_renderer.recv();
         });
 
         sink.send(Exit)
     })
--- a/servo/src/servo/gfx/surface.rs
+++ b/servo/src/servo/gfx/surface.rs
@@ -4,17 +4,17 @@ import int::num;
 enum format {
     fo_rgba_8888
     // TODO: RGB 565, others?
 }
 
 type image_surface = {
     size: Size2D<int>,
     format: format,
-    buffer: [u8]
+    buffer: ~[u8]
 };
 
 impl format for format {
     fn bpp() -> uint {
         alt self {
             fo_rgba_8888 { 32u }
         }
     }
--- a/servo/src/servo/layout/base.rs
+++ b/servo/src/servo/layout/base.rs
@@ -12,16 +12,17 @@ import geom::size::Size2D;
 import image::base::image;
 import layout::block::block_layout_methods;
 import layout::inline::inline_layout_methods;
 import util::tree;
 import util::color::Color;
 import text::text_box;
 import style::style::computed_style;
 import text::text_layout_methods;
+import vec::{push, push_all};
 
 enum BoxKind {
     BlockBox,
     InlineBox,
     IntrinsicBox(@Size2D<au>),
     TextBox(@text_box)
 }
 
@@ -166,31 +167,34 @@ mod test {
 
     /*
     use sdl;
     import sdl::video;
 
     fn with_screen(f: fn(*sdl::surface)) {
         let screen = video::set_video_mode(
             320, 200, 32,
-            [video::hwsurface], [video::doublebuf]);
+            ~[video::hwsurface], ~[video::doublebuf]);
         assert screen != ptr::null();
 
         f(screen);
 
         video::free_surface(screen);
     }
     */
 
-    fn flat_bounds(root: @Box) -> [Rect<au>] {
-        let mut r = [];
+    fn flat_bounds(root: @Box) -> ~[Rect<au>] {
+        let mut r = ~[];
         for tree::each_child(BTree, root) |c| {
-            r += flat_bounds(c);
+            push_all(r, flat_bounds(c));
         }
-        ret r + [copy root.bounds];
+
+        push(r, copy root.bounds);
+
+        ret r;
     }
 
     #[test]
     #[ignore(reason = "busted")]
     fn do_layout() {
         let s = Scope();
 
         fn mk_img(size: Size2D<au>) -> ~ElementKind {
@@ -213,15 +217,15 @@ mod test {
 
         tree::add_child(BTree, b3, b0);
         tree::add_child(BTree, b3, b1);
         tree::add_child(BTree, b3, b2);
 
         b3.reflow_block(au(100));
         let fb = flat_bounds(b3);
         #debug["fb=%?", fb];
-        assert fb == [geometry::box(au(0), au(0), au(10), au(10)),   // n0
-                      geometry::box(au(0), au(10), au(10), au(15)),  // n1
-                      geometry::box(au(0), au(25), au(10), au(20)),  // n2
-                      geometry::box(au(0), au(0), au(100), au(45))]; // n3
+        assert fb == ~[geometry::box(au(0), au(0), au(10), au(10)),   // n0
+                       geometry::box(au(0), au(10), au(10), au(15)),  // n1
+                       geometry::box(au(0), au(25), au(10), au(20)),  // n2
+                       geometry::box(au(0), au(0), au(100), au(45))]; // n3
     }
 }
 
--- a/servo/src/servo/layout/display_list.rs
+++ b/servo/src/servo/layout/display_list.rs
@@ -11,9 +11,9 @@ enum item_type {
     padding(u8, u8, u8, u8)
 }
 
 enum display_item = {
     item_type: item_type,
     bounds: Rect<au>
 };
 
-type display_list = [display_item];
+type display_list = ~[display_item];
--- a/servo/src/servo/layout/display_list_builder.rs
+++ b/servo/src/servo/layout/display_list_builder.rs
@@ -8,16 +8,17 @@ import gfx::renderer;
 import util::color::methods;
 import util::tree;
 import box_builder::box_builder_methods;
 import text::text_layout_methods;
 import geom::size::Size2D;
 import geom::point::Point2D;
 import geom::rect::Rect;
 import base::{Box, TextBox, BTree, BoxTreeReadMethods};
+import vec::push;
 
 #[doc = "
 
 Builds a display list for a box and all its children
 
 "]
 fn build_display_list(box : @Box) -> dl::display_list {
     ret build_display_list_from_origin(box, Point2D(au(0), au(0)));
@@ -58,59 +59,57 @@ Creates a display list item for a single
 
 # Arguments 
 
 * `box` - The box to build the display list for
 * `origin` - The coordinates of upper-left corner of the passed in box.
 
 "]
 #[warn(no_non_implicitly_copyable_typarams)]
-fn box_to_display_items(box: @Box, origin: Point2D<au>) -> [dl::display_item] {
-    let mut items = [];
+fn box_to_display_items(box: @Box, origin: Point2D<au>) -> ~[dl::display_item] {
+    let mut items = ~[];
 
     #debug("request to display a box from origin %?", origin);
 
     let bounds = Rect(origin, copy box.bounds.size);
 
     alt (box.kind, box.appearance.background_image, box.appearance.background_color) {
       (TextBox(subbox), _, _) {
         let run = copy subbox.run;
         assert run.is_some();
-        items += [
-            dl::display_item({
-                item_type: dl::display_item_solid_color(255u8, 255u8, 255u8),
-                bounds: bounds
-            }),
-            dl::display_item({
-                item_type: dl::display_item_text(run.get()),
-                bounds: bounds
-            })
-        ];
+        push(items, dl::display_item({
+            item_type: dl::display_item_solid_color(255u8, 255u8, 255u8),
+            bounds: bounds
+        }));
+        push(items, dl::display_item({
+            item_type: dl::display_item_text(run.get()),
+            bounds: bounds
+        }));
       }
       (_, some(image), some(*)) | (_, some(image), none) {
-        items += [dl::display_item({
+        push(items, dl::display_item({
             item_type: dl::display_item_image(~copy *image),
             bounds: bounds
-        })];
+        }));
       }
       (_, none, some(col)) {
         #debug("Assigning color %? to box with bounds %?", col, bounds);
-        items += [dl::display_item({
+        push(items, dl::display_item({
             item_type: dl::display_item_solid_color(col.red, col.green, col.blue),
             bounds: bounds
-        })];
+        }));
       }
       (_, none, none) {
         let r = rand::rng();
-        items += [dl::display_item({
+        push(items, dl::display_item({
             item_type: dl::display_item_solid_color(r.next() as u8,
                                                     r.next() as u8,
                                                     r.next() as u8),
             bounds: bounds
-        })];
+        }));
       }
     }
 
     #debug("layout: display items: %?", items);
     ret items;
 }
 
 
--- a/servo/src/servo/layout/style/matching.rs
+++ b/servo/src/servo/layout/style/matching.rs
@@ -214,70 +214,70 @@ mod test {
         ret scope.new_node(base::Element(elmt));
     }
 
     #[test]
     fn test_match_pipe1() {
         let scope = NodeScope();
         let node = new_node_from_attr(scope, "lang", "en-us");
 
-        let sel = Element("*", [StartsWith("lang", "en")]);
+        let sel = Element("*", ~[StartsWith("lang", "en")]);
 
         assert node.matches_selector(~sel);
     }
 
     #[test]
     fn test_match_pipe2() {
         let scope = NodeScope();
         let node = new_node_from_attr(scope, "lang", "en");
 
-        let sel = Element("*", [StartsWith("lang", "en")]);
+        let sel = Element("*", ~[StartsWith("lang", "en")]);
 
         assert node.matches_selector(~sel);
     }
     
     #[test] 
     fn test_not_match_pipe() {
         let scope = NodeScope();
         let node = new_node_from_attr(scope, "lang", "english");
 
-        let sel = Element("*", [StartsWith("lang", "en")]);
+        let sel = Element("*", ~[StartsWith("lang", "en")]);
 
         assert !node.matches_selector(~sel);
     }
 
     #[test]
     fn test_match_includes() {
         let scope = NodeScope();
         let node = new_node_from_attr(scope, "mad", "hatter cobler cooper");
 
-        let sel = Element("div", [Includes("mad", "hatter")]);
+        let sel = Element("div", ~[Includes("mad", "hatter")]);
 
         assert node.matches_selector(~sel);
     }
 
     #[test]
     fn test_match_exists() {
         let scope = NodeScope();
         let node = new_node_from_attr(scope, "mad", "hatter cobler cooper");
 
-        let sel1 = Element("div", [Exists("mad")]);
-        let sel2 = Element("div", [Exists("hatter")]);
+        let sel1 = Element("div", ~[Exists("mad")]);
+        let sel2 = Element("div", ~[Exists("hatter")]);
 
         assert node.matches_selector(~sel1);
         assert !node.matches_selector(~sel2);
     }
 
     #[test]
     fn test_match_exact() {
         let scope = NodeScope();
         let node1 = new_node_from_attr(scope, "mad", "hatter cobler cooper");
         let node2 = new_node_from_attr(scope, "mad", "hatter");
 
-        let sel = Element("div", [Exact("mad", "hatter")]);
+        let sel = Element("div", ~[Exact("mad", "hatter")]);
 
         assert !node1.matches_selector(~copy sel);
         assert node2.matches_selector(~sel);
     }
 
     #[test]
     fn match_tree() {
         let scope = NodeScope();
@@ -290,49 +290,49 @@ mod test {
         let gggchild = new_node_from_attr(scope, "flag", "purple");
 
         scope.add_child(root, child1);
         scope.add_child(root, child2);
         scope.add_child(child2, gchild);
         scope.add_child(gchild, ggchild);
         scope.add_child(ggchild, gggchild);
 
-        let sel1 = Descendant(~Element("*", [Exact("class", "blue")]),
-                              ~Element("*", []));
+        let sel1 = Descendant(~Element("*", ~[Exact("class", "blue")]),
+                              ~Element("*", ~[]));
 
         assert !root.matches_selector(~copy sel1);
         assert child1.matches_selector(~copy sel1);
         assert child2.matches_selector(~copy sel1);
         assert gchild.matches_selector(~copy sel1);
         assert ggchild.matches_selector(~copy sel1);
         assert gggchild.matches_selector(~sel1);
 
-        let sel2 = Descendant(~Child(~Element("*", [Exact("class", "blue")]),
-                                     ~Element("*", [])),
-                              ~Element("div", [Exists("flag")]));
+        let sel2 = Descendant(~Child(~Element("*", ~[Exact("class", "blue")]),
+                                     ~Element("*", ~[])),
+                              ~Element("div", ~[Exists("flag")]));
 
         assert !root.matches_selector(~copy sel2);
         assert !child1.matches_selector(~copy sel2);
         assert !child2.matches_selector(~copy sel2);
         assert gchild.matches_selector(~copy sel2);
         assert ggchild.matches_selector(~copy sel2);
         assert gggchild.matches_selector(~sel2);
 
-        let sel3 = Sibling(~Element("*", []), ~Element("*", []));
+        let sel3 = Sibling(~Element("*", ~[]), ~Element("*", ~[]));
 
         assert !root.matches_selector(~copy sel3);
         assert child1.matches_selector(~copy sel3);
         assert child2.matches_selector(~copy sel3);
         assert !gchild.matches_selector(~copy sel3);
         assert !ggchild.matches_selector(~copy sel3);
         assert !gggchild.matches_selector(~sel3);
 
-        let sel4 = Descendant(~Child(~Element("*", [Exists("class")]),
-                                    ~Element("*", [])),
-                              ~Element("*", []));
+        let sel4 = Descendant(~Child(~Element("*", ~[Exists("class")]),
+                                    ~Element("*", ~[])),
+                              ~Element("*", ~[]));
 
         assert !root.matches_selector(~copy sel4);
         assert !child1.matches_selector(~copy sel4);
         assert !child2.matches_selector(~copy sel4);
         assert gchild.matches_selector(~copy sel4);
         assert ggchild.matches_selector(~copy sel4);
         assert gggchild.matches_selector(~sel4);
     }
--- a/servo/src/servo/net.rs
+++ b/servo/src/servo/net.rs
@@ -1,15 +1,15 @@
 export uri, input_stream, channel, io_service, file_channel;
 
 import uri::uri;
 
 iface input_stream {
     fn close();
-    fn read() -> [u8];
+    fn read() -> ~[u8];
 }
 
 iface channel {
     fn uri() -> uri;
     fn open() -> input_stream;
 }
 
 iface io_service {
--- a/servo/src/servo/opts.rs
+++ b/servo/src/servo/opts.rs
@@ -1,32 +1,32 @@
 #[doc = "
 
 Configuration options for a single run of the servo application. Created
 from command line arguments.
 
 "];
 
 type Opts = {
-    urls: [str],
+    urls: ~[str],
     render_mode: RenderMode
 };
 
 enum RenderMode {
     Screen,
     Png(str)
 }
 
 #[warn(no_non_implicitly_copyable_typarams)]
-fn from_cmdline_args(args: [str]) -> Opts {
+fn from_cmdline_args(args: ~[str]) -> Opts {
     import std::getopts;
 
     let args = args.tail();
 
-    let opts = [
+    let opts = ~[
         getopts::optopt("o")
     ];
 
     let match = alt getopts::getopts(args, opts) {
       result::ok(m) { copy m }
       result::err(f) { fail getopts::fail_str(f) }
     };
 
--- a/servo/src/servo/parser/css_builder.rs
+++ b/servo/src/servo/parser/css_builder.rs
@@ -7,16 +7,17 @@ import dom::style;
 import style::{DisInline, DisBlock, DisNone, Display, TextColor, BackgroundColor, FontSize};
 import parser::css_lexer::{Token, StartDescription, EndDescription,
                            Descendant, Child, Sibling,
                            Comma, Element, Attr, Description,
                            Eof};
 import comm::recv;
 import option::is_none;
 import util::color::parsing::parse_color;
+import vec::push;
 
 type TokenReader = {stream : port<Token>, mut lookahead : option<Token>};
 
 impl methods for TokenReader {
     fn get() -> Token {
         alt copy self.lookahead {
           some(tok)  { self.lookahead = none; copy tok }
           none       { recv(self.stream) }
@@ -32,41 +33,41 @@ impl methods for TokenReader {
 fn parse_element(reader : TokenReader) -> option<~style::Selector> {
     // Get the current element type
     let elmt_name = alt reader.get() {
       Element(tag)  { copy tag }
       Eof  { ret none; }
       _  { fail "Expected an element" }
     };
 
-    let mut attr_list = [];
+    let mut attr_list = ~[];
 
     // Get the attributes associated with that element
     loop {
         let tok = reader.get();
         alt tok {
-          Attr(attr)       { attr_list += [copy attr]; }
+          Attr(attr)       { push(attr_list, copy attr); }
           StartDescription | Descendant | Child | Sibling | Comma {
             reader.unget(tok); 
             break;
           }
           Eof              { ret none; }          
           Element(_)          { fail "Unexpected second element without "
                                    + "relation to first element"; }
           EndDescription         { fail "Unexpected '}'"; }
           Description(_, _)       { fail "Unexpected description"; }
         }
     }
         
     ret some(~style::Element(elmt_name, attr_list));
 }
 
 fn parse_rule(reader : TokenReader) -> option<~style::Rule> {
-    let mut sel_list = [];
-    let mut desc_list = [];
+    let mut sel_list = ~[];
+    let mut desc_list = ~[];
 
     // Collect all the selectors that this rule applies to
     loop {
         let mut cur_sel;
 
         alt parse_element(reader) {
           some(elmt)  { cur_sel = copy elmt; }
           none        { ret none; } // we hit an eof in the middle of a rule
@@ -102,23 +103,23 @@ fn parse_rule(reader : TokenReader) -> o
                     let new_sel = copy elmt;
                     cur_sel <- ~style::Sibling(built_sel, new_sel)
                   }
                   none         { ret none; }
                 }
               }
               StartDescription {
                 let built_sel <- cur_sel; 
-                sel_list += [built_sel];
+                push(sel_list, built_sel);
                 reader.unget(StartDescription);
                 break;
               }
               Comma      {
                 let built_sel <- cur_sel;
-                sel_list += [built_sel];
+                push(sel_list, built_sel);
                 reader.unget(Comma);
                 break;
               }
               Attr(_) | EndDescription | Element(_) | Description(_, _) {
                 fail #fmt["Unexpected token %? in elements", tok];
               }
               Eof        { ret none; }
             }
@@ -141,55 +142,53 @@ fn parse_rule(reader : TokenReader) -> o
           Description(prop, val) {
             alt prop {
               "font-size" {
                 // TODO, support more ways to declare a font size than # pt
                 assert val.ends_with("pt");
                 let num = val.substr(0u, val.len() - 2u);
                 
                 alt uint::from_str(num) {
-                  some(n)    { desc_list += [FontSize(n)]; }
+                  some(n)    { push(desc_list, FontSize(n)); }
                   none       { fail "Nonnumber provided as font size"; }
                 }
               }
               "display" {
                 alt val {
-                  "inline"   { desc_list += [Display(DisInline)]; }
-                  "block"    { desc_list += [Display(DisBlock)]; }
-                  "none"     { desc_list += [Display(DisNone)]; }
-                  _          { #debug["Recieved unknown display value '%s'",
-                                      val]; }
+                  "inline"   { push(desc_list, Display(DisInline)); }
+                  "block"    { push(desc_list, Display(DisBlock)); }
+                  "none"     { push(desc_list, Display(DisNone)); }
+                  _          { #debug["Recieved unknown display value '%s'", val]; }
                 }
               }
               "color" {
-                desc_list += [TextColor(parse_color(val))];
+                push(desc_list, TextColor(parse_color(val)));
               }
               "background-color" {
-                desc_list += [BackgroundColor(parse_color(val))];
+                push(desc_list, BackgroundColor(parse_color(val)));
               }
-              _          { #debug["Recieved unknown style property '%s'",
-                                  val]; }
+              _ { #debug["Recieved unknown style property '%s'", val]; }
             }
           }
           Eof        { ret none; }
           StartDescription | Descendant | Child | Sibling
           | Comma | Element(_) | Attr(_)  {
             fail #fmt["Unexpected token %? in description", tok]; 
           }
         }
     }
 
     ret some(~(sel_list, desc_list));
 }
 
-fn build_stylesheet(stream : port<Token>) -> [~style::Rule] {
-    let mut rule_list = [];
+fn build_stylesheet(stream : port<Token>) -> ~[~style::Rule] {
+    let mut rule_list = ~[];
     let reader = {stream : stream, mut lookahead : none};
 
     loop {
         alt parse_rule(reader) {
-          some(rule)   { rule_list += [copy rule]; }
+          some(rule)   { push(rule_list, copy rule); }
           none         { break; }
         }
     }
 
     ret rule_list;
 }
--- a/servo/src/servo/parser/css_lexer.rs
+++ b/servo/src/servo/parser/css_lexer.rs
@@ -1,12 +1,13 @@
 import comm::{port, chan};
 import dom::style;
 import option::is_none;
 import str::from_bytes;
+import vec::push;
 
 import lexer_util::*;
 
 enum ParserState {
     CssElement,
     CssRelation,
     CssDescription,
     CssAttribute
@@ -150,40 +151,40 @@ impl css_methods for CssLexer {
             self.input_state.eat_whitespace();
 
             alt self.input_state.get() {
               CoeChar(c)  { ch = c }
               CoeEof      { fail "Reached end of file in CSS description" }
             }
         }
         
-        let mut desc_name = [];
+        let mut desc_name = ~[];
         
         // Get the name of the descriptor
         loop {
             if ch.is_whitespace() {
                 self.input_state.eat_whitespace();
             } else if ch == ':' as u8 {
                 if desc_name.len() == 0u {
                     fail "Expected descriptor name";
                 } else {
                     break;
                 }
             } else {
-                desc_name += [ch];
+                push(desc_name, ch);
             }
 
             alt self.input_state.get() {
               CoeChar(c)  { ch = c }
               CoeEof      { fail "Reached end of file in CSS description" }
             }
         }
 
         self.input_state.eat_whitespace();
-        let mut desc_val = [];
+        let mut desc_val = ~[];
 
         // Get the value of the descriptor
         loop {
             alt self.input_state.get() {
               CoeChar(c)  { ch = c }
               CoeEof      { fail "Reached end of file in CSS description" }
             }
 
@@ -198,17 +199,17 @@ impl css_methods for CssLexer {
                 }
             } else if ch == ';' as u8 {
                 if desc_val.len() == 0u {
                     fail "Expected descriptor value";
                 } else {
                     break;
                 }
             } else {
-                desc_val += [ch];
+                push(desc_val, ch);
             }
         }
 
         ret Description(from_bytes(desc_name), from_bytes(desc_val));
     }
 }
 
 fn parser(reader: io::reader, state : ParserState) -> CssLexer {
--- a/servo/src/servo/parser/html_builder.rs
+++ b/servo/src/servo/parser/html_builder.rs
@@ -5,17 +5,17 @@ import dom::base::{HTMLImageElement, Nod
 import dom::base::{UnknownElement};
 import dom::rcu::WriterMethods;
 import geom::size::Size2D;
 import gfx::geometry;
 import gfx::geometry::au;
 import parser = parser::html_lexer;
 import parser::Token;
 import dom::style::Stylesheet;
-
+import vec::{push, push_all_move, flat_map};
 import dvec::extensions;
 
 enum css_message {
     file(~str),
     exit   
 }
 
 #[warn(no_non_implicitly_copyable_typarams)]
@@ -81,46 +81,41 @@ spawned, collates them, and sends them t
 
 # Arguments
 
 * `to_parent` - A channel on which to send back the full set of rules.
 * `from_parent` - A port on which to receive new links.
 
 "]
 fn css_link_listener(to_parent : chan<Stylesheet>, from_parent : port<css_message>) {
-    let mut result_vec = [];
+    let mut result_vec = ~[];
 
     loop {
         alt from_parent.recv() {
           file(filename) {
             let result_port = comm::port();
             let result_chan = comm::chan(result_port);
             let filename = copy filename;
             task::spawn(|| {
                 //TODO: deal with extraneous copies
                 let filename <- copy filename;
                 let css_stream = css_lexer::spawn_css_lexer_task(filename);
                 let mut css_rules = css_builder::build_stylesheet(css_stream);
                 result_chan.send(css_rules);
             });
-            result_vec += [result_port];
+            push(result_vec, result_port);
           }
           exit {
             break;
           }
         }
     }
 
-    let css_rules = [];
+    let css_rules = flat_map(result_vec, |result_port| { result_port.recv() });
     
-    let css_rules = result_vec.foldl(css_rules, |rules, result_port| {
-        let new_rules = result_port.recv();
-        rules + new_rules
-    });
-
     to_parent.send(css_rules);
 }
 
 #[warn(no_non_implicitly_copyable_typarams)]
 fn build_dom(scope: NodeScope, stream: port<Token>) -> (Node, port<Stylesheet>) {
     // The current reference node.
     let mut cur_node = scope.new_node(Element(ElementData("html", ~HTMLDivElement)));
     // We will spawn a separate task to parse any css that is
--- a/servo/src/servo/parser/html_lexer.rs
+++ b/servo/src/servo/parser/html_lexer.rs
@@ -1,12 +1,13 @@
 import comm::{port, chan};
 import dom::style;
 import option::is_none;
 import str::from_bytes;
+import vec::push;
 import lexer_util::*;
 
 enum Token {
     StartOpeningTag(str),
     EndOpeningTag,
     EndTag(str),
     SelfCloseTag,
     Text(str),
@@ -71,25 +72,25 @@ impl html_methods for HtmlLexer {
             let ident = self.input_state.parse_ident();
             self.input_state.eat_whitespace();
 
             self.parser_state = TagHtml;
             ret StartOpeningTag(ident);
         }
         
         // Make a text node.
-        let mut s: [u8] = [ch];
+        let mut s: ~[u8] = ~[ch];
         loop {
             alt self.input_state.get() {
               CoeChar(c) {
                 if c == ('<' as u8) {
                     self.input_state.unget(c);
                     ret Text(from_bytes(s));
                 }
-                s += [c];
+                push(s, c);
               }
               CoeEof { ret Text(from_bytes(s)); }
             }
         }
     }
     
     fn parse_in_tag_state(c: u8) -> Token {
         let mut ch = c;
@@ -115,38 +116,38 @@ impl html_methods for HtmlLexer {
             }
         }
 
         if !ch.is_alpha() {
             fail #fmt("expected alphabetical in tag but found %c", ch as char);
         }
 
         // Parse an attribute.
-        let mut attribute_name = [ch];
+        let mut attribute_name = ~[ch];
         loop {
             alt self.input_state.get() {
               CoeChar(c) {
                 if c == ('=' as u8) { break; }
-                attribute_name += [c];
+                push(attribute_name, c);
               }
               CoeEof {
                 let name = from_bytes(attribute_name);
                 ret Attr(copy name, name);
               }
             }
         }
 
         // Parse the attribute value.
         self.input_state.expect('"' as u8);
-        let mut attribute_value = [];
+        let mut attribute_value = ~[];
         loop {
             alt self.input_state.get() {
               CoeChar(c) {
                 if c == ('"' as u8) { break; }
-                attribute_value += [c];
+                push(attribute_value, c);
               }
               CoeEof {
                 ret Attr(from_bytes(attribute_name), from_bytes(attribute_value));
               }
             }
         }
 
         // Eat whitespacpe.
--- a/servo/src/servo/parser/lexer_util.rs
+++ b/servo/src/servo/parser/lexer_util.rs
@@ -1,11 +1,11 @@
 import option::is_none;
 import str::from_bytes;
-
+import vec::push;
 
 enum CharOrEof {
     CoeChar(u8),
     CoeEof
 }
 
 type InputState = {
     mut lookahead: option<CharOrEof>,
@@ -58,22 +58,22 @@ impl util_methods for InputState {
             }
             CoeEof {
                 self.parse_err(#fmt("expected '%c' at eof", ch as char));
             }
         }
     }
 
     fn parse_ident() -> str {
-        let mut result: [u8] = [];
+        let mut result: ~[u8] = ~[];
         loop {
             alt self.get() {
                 CoeChar(c) {
                     if (c.is_alpha()) {
-                        result += [c];
+                        push(result, c);
                     } else if result.len() == 0u {
                         self.parse_err("expected ident");
                     } else {
                         self.unget(c);
                         break;
                     }
                 }
                 CoeEof {
--- a/servo/src/servo/platform/osmain.rs
+++ b/servo/src/servo/platform/osmain.rs
@@ -8,16 +8,17 @@ import azure::cairo::bindgen::*;
 import comm::*;
 import dvec::{dvec, extensions};
 import azure::cairo::cairo_surface_t;
 import gfx::renderer::{Sink};
 import dom::event::{Event, ResizeEvent};
 import layers::ImageLayer;
 import geom::size::Size2D;
 import std::cmp::fuzzy_eq;
+import vec::push;
 
 type OSMain = chan<Msg>;
 
 enum Msg {
     BeginDrawing(chan<AzDrawTargetRef>),
     Draw(chan<AzDrawTargetRef>, AzDrawTargetRef),
     AddKeyHandler(chan<()>),
     AddEventListener(chan<Event>),
@@ -195,16 +196,17 @@ fn surface_set() -> surface_set {
 
 type surface = {
     cairo_surf: *cairo_surface_t,
     az_target: AzDrawTargetRef
 };
 
 fn mk_surface() -> surface {
     let cairo_surf = cairo_image_surface_create(cairo::CAIRO_FORMAT_RGB24, 800, 600);
+
     assert !ptr::is_null(cairo_surf);
 
     let azure_target = AzCreateDrawTargetForCairoSurface(cairo_surf);
     assert !ptr::is_null(azure_target);
 
     {
         cairo_surf: cairo_surf,
         az_target: azure_target
--- a/servo/src/servo/servo.rc
+++ b/servo/src/servo/servo.rc
@@ -2,18 +2,16 @@
        vers = "0.1",
        uuid = "637ffc98-9058-471d-9de7-abfc49ef0549",
        url = "http://servo.org/")];
 
 #[comment = "The Servo Parallel Browser Project"];
 #[license = "MPL"];
 #[crate_type = "lib"];
 
-#[warn(no_old_vecs)];
-
 use std;
 use sdl;
 use azure;
 use js;
 use stb_image;
 use geom;
 use glut;
 use layers;
@@ -91,16 +89,17 @@ mod text {
 }
 
 mod util {
     mod tree;
     mod color;
     mod unsafe;
 }
 
+#[warn(no_non_implicitly_copyable_typarams)]
 mod content {
 }
 
 mod net {
     mod uri;
 }
 
 mod opts;
--- a/servo/src/servo/servo.rs
+++ b/servo/src/servo/servo.rs
@@ -1,16 +1,16 @@
 import comm::*;
 import gfx::renderer;
 import platform::osmain;
 import osmain::{OSMain, AddKeyHandler};
 import opts::{Opts, Screen, Png};
 import engine::{Engine, LoadURLMsg};
 
-fn main(args: [str]) {
+fn main(args: ~[str]) {
     run(opts::from_cmdline_args(args))
 }
 
 #[warn(no_non_implicitly_copyable_typarams)]
 fn run(opts: Opts) {
     alt opts.render_mode {
       Screen {
         run_pipeline_screen(opts.urls)
@@ -20,17 +20,17 @@ fn run(opts: Opts) {
         if opts.urls.len() > 1u {
             fail "servo asks that you stick to a single URL in PNG output mode"
         }
         run_pipeline_png(opts.urls.head(), outfile)
       }
     }
 }
 
-fn run_pipeline_screen(urls: [str]) {
+fn run_pipeline_screen(urls: ~[str]) {
 
     // The platform event handler thread
     let osmain = OSMain();
 
     // Create a serve instance
     let engine = Engine(osmain);
     let engine_chan = engine.start();
 
--- a/servo/src/servo/text/font.rs
+++ b/servo/src/servo/text/font.rs
@@ -27,17 +27,17 @@ import azure::cairo::bindgen::{
 A font handle. Layout can use this to calculate glyph metrics
 and the renderer can use it to render text.
 "]
 class Font {
     let fontbuf: @~[u8];
     let cairo_font: *cairo_scaled_font_t;
     let font_dtor: fn@();
 
-    new(-fontbuf: [u8]) {
+    new(-fontbuf: ~[u8]) {
         let (cairo_font, font_dtor) = get_cairo_font(&copy fontbuf);
         assert cairo_font.is_not_null();
 
         self.fontbuf = @fontbuf;
         self.cairo_font = cairo_font;
         self.font_dtor = font_dtor;
     }
 
@@ -76,17 +76,17 @@ class Font {
             none
         }
     }
 
     fn glyph_h_advance(glyph: GlyphIndex) -> int {
 
         #debug("getting h advance for glyph %?", glyph);
 
-        let glyphs: [cairo_glyph_t] = [{
+        let glyphs: ~[cairo_glyph_t] = ~[{
             index: glyph as c_ulong,
             x: 0 as c_double,
             y: 0 as c_double,
         }];
         let extents: cairo_text_extents_t = {
             x_bearing: 0 as c_double,
             y_bearing: 0 as c_double,
             width: 0 as c_double,
@@ -259,17 +259,17 @@ fn get_cairo_face(buf: &~[u8]) -> (*cair
 
 fn create_test_font() -> @Font {
     import font_library::FontLibrary;
 
     let flib = FontLibrary();
     ret flib.get_test_font();
 }
 
-fn test_font_bin() -> [u8] { #include_bin("JosefinSans-SemiBold.ttf") }
+fn test_font_bin() -> ~[u8] { #include_bin("JosefinSans-SemiBold.ttf") }
 
 fn should_destruct_on_fail_without_leaking() {
     #[test];
     #[should_fail];
     #[ignore];
 
     let _font = create_test_font();
     fail;
--- a/servo/src/servo/text/native_font/quartz_native_font.rs
+++ b/servo/src/servo/text/native_font/quartz_native_font.rs
@@ -43,17 +43,17 @@ class QuartzNativeFont/& {
     }
 
     // FIXME: What unit is this returning? Let's have a custom type
     fn glyph_h_advance(_glyph: GlyphIndex) -> option<int> {
         fail;
     }
 }
 
-fn create(buf: [u8]) -> result<QuartzNativeFont, ()> {
+fn create(buf: ~[u8]) -> result<QuartzNativeFont, ()> {
     let fontprov = vec::as_buf(buf, |cbuf| {
         CGDataProviderCreateWithData(
             null(),
             unsafe { reinterpret_cast(cbuf) },
             buf.len() as size_t,
             null())
     });
     // FIXME: Error handling
--- a/servo/src/servo/text/shaper.rs
+++ b/servo/src/servo/text/shaper.rs
@@ -30,17 +30,17 @@ import harfbuzz::bindgen::{hb_blob_creat
                            hb_font_funcs_set_glyph_h_advance_func,
                            hb_font_funcs_set_glyph_func,
                            hb_font_funcs_set_glyph_h_kerning_func};
 
 #[doc = "
 Calculate the layout metrics associated with a some given text
 when rendered in a specific font.
 "]
-fn shape_text(font: &Font, text: str) -> [Glyph] unsafe {
+fn shape_text(font: &Font, text: str) -> ~[Glyph] unsafe {
     #debug("shaping text '%s'", text);
 
     let face_blob = vec::as_buf(*(*font).buf(), |buf| {
         hb_blob_create(reinterpret_cast(buf),
                        (*(*font).buf()).len() as c_uint,
                        HB_MEMORY_MODE_READONLY,
                        null(),
                        null())
@@ -74,27 +74,27 @@ fn shape_text(font: &Font, text: str) ->
     let info_ = hb_buffer_get_glyph_infos(buffer, addr_of(info_len));
     assert info_.is_not_null();
     let pos_len = 0 as c_uint;
     let pos = hb_buffer_get_glyph_positions(buffer, addr_of(pos_len));
     assert pos.is_not_null();
 
     assert info_len == pos_len;
 
-    let mut glyphs = [];
+    let mut glyphs = ~[];
 
     for uint::range(0u, info_len as uint) |i| {
         let info_ = offset(info_, i);
         let pos = offset(pos, i);
         let codepoint = (*info_).codepoint as uint;
         let pos = hb_glyph_pos_to_servo_glyph_pos(&*pos);
         #debug("glyph %?: codep %?, x_adv %?, y_adv %?, x_off %?, y_of %?",
                i, codepoint, pos.advance.x, pos.advance.y, pos.offset.x, pos.offset.y);
 
-        glyphs += [Glyph(codepoint, pos)];
+        glyphs += ~[Glyph(codepoint, pos)];
     }
 
     hb_buffer_destroy(buffer);
     hb_font_funcs_destroy(funcs);
     hb_font_destroy(hbfont);
     hb_face_destroy(hbface);
     hb_blob_destroy(face_blob);
 
@@ -143,21 +143,21 @@ fn hb_glyph_pos_to_servo_glyph_pos(hb_po
 
 fn should_get_glyph_indexes() {
     #[test];
     #[ignore(reason = "random failures")];
 
     let font = font::create_test_font();
     let glyphs = shape_text(font, "firecracker");
     let idxs = glyphs.map(|glyph| glyph.index);
-    assert idxs == [32u, 8u, 13u, 14u, 10u, 13u, 201u, 10u, 37u, 14u, 13u];
+    assert idxs == ~[32u, 8u, 13u, 14u, 10u, 13u, 201u, 10u, 37u, 14u, 13u];
 }
 
 fn should_get_glyph_h_advance() {
     #[test];
     #[ignore(reason = "random failures")];
 
     let font = font::create_test_font();
     let glyphs = shape_text(font, "firecracker");
     let actual = glyphs.map(|g| g.pos.advance.x);
-    let expected = [6, 4, 7, 9, 8, 7, 10, 8, 9, 9, 7].map(|a| px_to_au(a));
+    let expected = (~[6, 4, 7, 9, 8, 7, 10, 8, 9, 9, 7]).map(|a| px_to_au(a));
     assert expected == actual;
 }
--- a/servo/src/servo/text/text_run.rs
+++ b/servo/src/servo/text/text_run.rs
@@ -4,17 +4,17 @@ import gfx::geometry::{au, px_to_au};
 import libc::{c_void};
 import font_library::FontLibrary;
 import font::Font;
 import glyph::Glyph;
 import shaper::shape_text;
 
 #[doc="A single, unbroken line of text."]
 class TextRun {
-    let glyphs: [Glyph];
+    let glyphs: ~[Glyph];
 
     new(font: Font, text: str) {
         self.glyphs = shape_text(&font, text);
     }
 
     fn size() -> Size2D<au> {
         let height = px_to_au(20);
         let pen_start_x = px_to_au(0);
--- a/servo/src/servo/util/tree.rs
+++ b/servo/src/servo/util/tree.rs
@@ -94,20 +94,20 @@ mod test {
             f(d.fields)
         }
     }
 
     fn new_dummy(v: uint) -> dummy {
         dummy(@{fields: empty(), value: v})
     }
 
-    fn parent_with_3_children() -> {p: dummy, children: [dummy]} {
-        let children = [new_dummy(0u),
-                        new_dummy(1u),
-                        new_dummy(2u)];
+    fn parent_with_3_children() -> {p: dummy, children: ~[dummy]} {
+        let children = ~[new_dummy(0u),
+                         new_dummy(1u),
+                         new_dummy(2u)];
         let p = new_dummy(3u);
 
         for vec::each(children) |c| {
             add_child(dtree, p, c);
         }
 
         ret {p: p, children: children};
     }