From 7a6db3f982cea9c5c1ed9921358988c1180851dc Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Thu, 14 Feb 2013 22:14:59 +0900 Subject: [PATCH 1/4] Remove DVec from syntax::parse --- src/libsyntax/parse/mod.rs | 3 +-- src/libsyntax/parse/parser.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 12038898a9d..84d6ebd83c7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -227,12 +227,11 @@ mod test { use super::*; use std::serialize::Encodable; use std; - use core::dvec; use core::str; use util::testing::*; #[test] fn to_json_str (val: Encodable) -> ~str { - let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0}; + let bw = @io::BytesWriter(); val.encode(~std::json::Encoder(bw as io::Writer)); str::from_bytes(bw.bytes.data) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 41ccf39e2ce..c9ca28768db 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -84,8 +84,6 @@ use print::pprust::expr_to_str; use util::interner::Interner; use core::cmp; -use core::dvec::DVec; -use core::dvec; use core::either::{Either, Left, Right}; use core::either; use core::result::Result; @@ -1323,11 +1321,11 @@ pub impl Parser { } fn parse_all_token_trees() -> ~[token_tree] { - let tts = DVec(); + let mut tts = ~[]; while self.token != token::EOF { tts.push(self.parse_token_tree()); } - tts.get() + tts } fn parse_matchers() -> ~[matcher] { @@ -3954,7 +3952,7 @@ pub impl Parser { VIEW_ITEMS_AND_ITEMS_ALLOWED | IMPORTS_AND_ITEMS_ALLOWED => false }; - let (view_items, items, foreign_items) = (DVec(), DVec(), DVec()); + let mut (view_items, items, foreign_items) = (~[], ~[], ~[]); loop { match self.parse_item_or_view_item(attrs, items_allowed, foreign_items_allowed, @@ -3986,9 +3984,9 @@ pub impl Parser { } {attrs_remaining: attrs, - view_items: dvec::unwrap(move view_items), - items: dvec::unwrap(move items), - foreign_items: dvec::unwrap(move foreign_items)} + view_items: view_items, + items: items, + foreign_items: foreign_items} } // Parses a source module as a crate From ae38935ff3d295dbf2fca5a5cef5103e868678bb Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Thu, 14 Feb 2013 22:36:56 +0900 Subject: [PATCH 2/4] Remove DVec from check_const --- src/librustc/middle/check_const.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 6d4de6aeb93..c86f7ea5a92 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -16,7 +16,6 @@ use middle::ty; use middle::typeck; use util::ppaux; -use core::dvec::DVec; use core::option; use std::oldmap::HashMap; use syntax::ast::*; @@ -212,20 +211,20 @@ pub fn check_item_recursion(sess: Session, ast_map: ast_map::map, def_map: resolve::DefMap, it: @item) { - type env = { + struct env { root_it: @item, sess: Session, ast_map: ast_map::map, def_map: resolve::DefMap, - idstack: @DVec, - }; + idstack: @mut ~[node_id] + } - let env = { + let env = env { root_it: it, sess: sess, ast_map: ast_map, def_map: def_map, - idstack: @DVec() + idstack: @mut ~[] }; let visitor = visit::mk_vt(@visit::Visitor { @@ -236,12 +235,12 @@ pub fn check_item_recursion(sess: Session, (visitor.visit_item)(it, env, visitor); fn visit_item(it: @item, &&env: env, v: visit::vt) { - if (*env.idstack).contains(&(it.id)) { + if env.idstack.contains(&(it.id)) { env.sess.span_fatal(env.root_it.span, ~"recursive constant"); } - (*env.idstack).push(it.id); + env.idstack.push(it.id); visit::visit_item(it, env, v); - (*env.idstack).pop(); + env.idstack.pop(); } fn visit_expr(e: @expr, &&env: env, v: visit::vt) { From 9324f497b28ae4d98ef443e747390d1f0ccee1de Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Thu, 14 Feb 2013 22:51:01 +0900 Subject: [PATCH 3/4] Remove DVec from json --- src/libstd/json.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 95f9130fa37..aa459ebed91 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -1298,7 +1298,7 @@ mod tests { // and json... not sure where to put these tests. #[test] fn test_write_enum () { - let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0}; + let bw = @io::BytesWriter(); let bww : @io::Writer = (bw as @io::Writer); let encoder = (@Encoder(bww) as @serialize::Encoder); do encoder.emit_enum(~"animal") { @@ -1319,7 +1319,7 @@ mod tests { #[test] fn test_write_some () { - let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0}; + let bw = @io::BytesWriter(); let bww : @io::Writer = (bw as @io::Writer); let encoder = (@Encoder(bww) as @serialize::Encoder); do encoder.emit_enum(~"Option") { @@ -1335,7 +1335,7 @@ mod tests { #[test] fn test_write_none () { - let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0}; + let bw = @io::BytesWriter(); let bww : @io::Writer = (bw as @io::Writer); let encoder = (@Encoder(bww) as @serialize::Encoder); do encoder.emit_enum(~"Option") { From 26697c371db2816bcaa32a050b5d32bce7294ca0 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Thu, 14 Feb 2013 23:12:12 +0900 Subject: [PATCH 4/4] Remove DVec from workcache --- src/libstd/workcache.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index d78761b70e3..c06f2f867bc 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -16,7 +16,6 @@ use serialize::{Encoder, Encodable, Decoder, Decodable}; use sort; use core::cmp; -use core::dvec; use core::either::{Either, Left, Right}; use core::io; use core::option; @@ -141,13 +140,12 @@ type WorkMap = LinearMap; pub impl WorkMap: Encodable { fn encode(&self, s: &S) { - let d = dvec::DVec(); + let mut d = ~[]; for self.each |&(k, v)| { d.push((copy *k, copy *v)) } - let mut v = d.get(); - sort::tim_sort(v); - v.encode(s) + sort::tim_sort(d); + d.encode(s) } }