Skip to content

Commit af2f0ef

Browse files
committed
auto merge of rust-lang#4927 : sanxiyn/rust/remove-dvec, r=catamorphism
2 parents bf27352 + 26697c3 commit af2f0ef

File tree

5 files changed

+21
-27
lines changed

5 files changed

+21
-27
lines changed

src/librustc/middle/check_const.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use middle::ty;
1616
use middle::typeck;
1717
use util::ppaux;
1818

19-
use core::dvec::DVec;
2019
use core::option;
2120
use std::oldmap::HashMap;
2221
use syntax::ast::*;
@@ -212,20 +211,20 @@ pub fn check_item_recursion(sess: Session,
212211
ast_map: ast_map::map,
213212
def_map: resolve::DefMap,
214213
it: @item) {
215-
type env = {
214+
struct env {
216215
root_it: @item,
217216
sess: Session,
218217
ast_map: ast_map::map,
219218
def_map: resolve::DefMap,
220-
idstack: @DVec<node_id>,
221-
};
219+
idstack: @mut ~[node_id]
220+
}
222221

223-
let env = {
222+
let env = env {
224223
root_it: it,
225224
sess: sess,
226225
ast_map: ast_map,
227226
def_map: def_map,
228-
idstack: @DVec()
227+
idstack: @mut ~[]
229228
};
230229

231230
let visitor = visit::mk_vt(@visit::Visitor {
@@ -236,12 +235,12 @@ pub fn check_item_recursion(sess: Session,
236235
(visitor.visit_item)(it, env, visitor);
237236

238237
fn visit_item(it: @item, &&env: env, v: visit::vt<env>) {
239-
if (*env.idstack).contains(&(it.id)) {
238+
if env.idstack.contains(&(it.id)) {
240239
env.sess.span_fatal(env.root_it.span, ~"recursive constant");
241240
}
242-
(*env.idstack).push(it.id);
241+
env.idstack.push(it.id);
243242
visit::visit_item(it, env, v);
244-
(*env.idstack).pop();
243+
env.idstack.pop();
245244
}
246245

247246
fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {

src/libstd/json.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ mod tests {
12981298
// and json... not sure where to put these tests.
12991299
#[test]
13001300
fn test_write_enum () {
1301-
let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0};
1301+
let bw = @io::BytesWriter();
13021302
let bww : @io::Writer = (bw as @io::Writer);
13031303
let encoder = (@Encoder(bww) as @serialize::Encoder);
13041304
do encoder.emit_enum(~"animal") {
@@ -1319,7 +1319,7 @@ mod tests {
13191319
13201320
#[test]
13211321
fn test_write_some () {
1322-
let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0};
1322+
let bw = @io::BytesWriter();
13231323
let bww : @io::Writer = (bw as @io::Writer);
13241324
let encoder = (@Encoder(bww) as @serialize::Encoder);
13251325
do encoder.emit_enum(~"Option") {
@@ -1335,7 +1335,7 @@ mod tests {
13351335

13361336
#[test]
13371337
fn test_write_none () {
1338-
let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0};
1338+
let bw = @io::BytesWriter();
13391339
let bww : @io::Writer = (bw as @io::Writer);
13401340
let encoder = (@Encoder(bww) as @serialize::Encoder);
13411341
do encoder.emit_enum(~"Option") {

src/libstd/workcache.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use serialize::{Encoder, Encodable, Decoder, Decodable};
1616
use sort;
1717

1818
use core::cmp;
19-
use core::dvec;
2019
use core::either::{Either, Left, Right};
2120
use core::io;
2221
use core::option;
@@ -141,13 +140,12 @@ type WorkMap = LinearMap<WorkKey, ~str>;
141140

142141
pub impl<S: Encoder> WorkMap: Encodable<S> {
143142
fn encode(&self, s: &S) {
144-
let d = dvec::DVec();
143+
let mut d = ~[];
145144
for self.each |&(k, v)| {
146145
d.push((copy *k, copy *v))
147146
}
148-
let mut v = d.get();
149-
sort::tim_sort(v);
150-
v.encode(s)
147+
sort::tim_sort(d);
148+
d.encode(s)
151149
}
152150
}
153151

src/libsyntax/parse/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,11 @@ mod test {
227227
use super::*;
228228
use std::serialize::Encodable;
229229
use std;
230-
use core::dvec;
231230
use core::str;
232231
use util::testing::*;
233232

234233
#[test] fn to_json_str (val: Encodable<std::json::Encoder>) -> ~str {
235-
let bw = @io::BytesWriter {bytes: dvec::DVec(), pos: 0};
234+
let bw = @io::BytesWriter();
236235
val.encode(~std::json::Encoder(bw as io::Writer));
237236
str::from_bytes(bw.bytes.data)
238237
}

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ use print::pprust::expr_to_str;
8484
use util::interner::Interner;
8585

8686
use core::cmp;
87-
use core::dvec::DVec;
88-
use core::dvec;
8987
use core::either::{Either, Left, Right};
9088
use core::either;
9189
use core::result::Result;
@@ -1323,11 +1321,11 @@ pub impl Parser {
13231321
}
13241322

13251323
fn parse_all_token_trees() -> ~[token_tree] {
1326-
let tts = DVec();
1324+
let mut tts = ~[];
13271325
while self.token != token::EOF {
13281326
tts.push(self.parse_token_tree());
13291327
}
1330-
tts.get()
1328+
tts
13311329
}
13321330

13331331
fn parse_matchers() -> ~[matcher] {
@@ -3954,7 +3952,7 @@ pub impl Parser {
39543952
VIEW_ITEMS_AND_ITEMS_ALLOWED | IMPORTS_AND_ITEMS_ALLOWED => false
39553953
};
39563954

3957-
let (view_items, items, foreign_items) = (DVec(), DVec(), DVec());
3955+
let mut (view_items, items, foreign_items) = (~[], ~[], ~[]);
39583956
loop {
39593957
match self.parse_item_or_view_item(attrs, items_allowed,
39603958
foreign_items_allowed,
@@ -3986,9 +3984,9 @@ pub impl Parser {
39863984
}
39873985

39883986
{attrs_remaining: attrs,
3989-
view_items: dvec::unwrap(move view_items),
3990-
items: dvec::unwrap(move items),
3991-
foreign_items: dvec::unwrap(move foreign_items)}
3987+
view_items: view_items,
3988+
items: items,
3989+
foreign_items: foreign_items}
39923990
}
39933991

39943992
// Parses a source module as a crate

0 commit comments

Comments
 (0)