diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-09-26 17:33:34 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-09-26 18:02:07 -0700 |
| commit | 67a8e7128aea292445b763b47b04bc5f4fd43cb2 (patch) | |
| tree | 9ddde322dbc8fd5af39e903419cae508d9df05f6 /src/rustc | |
| parent | cd79e1d1b20a2c289dd15bc2766f97c789d975aa (diff) | |
| download | rust-67a8e7128aea292445b763b47b04bc5f4fd43cb2.tar.gz rust-67a8e7128aea292445b763b47b04bc5f4fd43cb2.zip | |
Demode vec::push (and convert to method)
Diffstat (limited to 'src/rustc')
43 files changed, 229 insertions, 230 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index c8f5871333f..4bbd51524c4 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -392,14 +392,14 @@ fn build_link_meta(sess: session, c: ast::crate, output: &Path, if attr::get_meta_item_name(*meta) == ~"name" { match attr::get_meta_item_value_str(*meta) { Some(v) => { name = Some(v); } - None => vec::push(cmh_items, *meta) + None => cmh_items.push(*meta) } } else if attr::get_meta_item_name(*meta) == ~"vers" { match attr::get_meta_item_value_str(*meta) { Some(v) => { vers = Some(v); } - None => vec::push(cmh_items, *meta) + None => cmh_items.push(*meta) } - } else { vec::push(cmh_items, *meta); } + } else { cmh_items.push(*meta); } } return {name: name, vers: vers, cmh_items: cmh_items}; } @@ -657,9 +657,9 @@ fn link_binary(sess: session, let mut cc_args = vec::append(~[stage], sess.targ_cfg.target_strs.cc_args); - vec::push(cc_args, ~"-o"); - vec::push(cc_args, output.to_str()); - vec::push(cc_args, obj_filename.to_str()); + cc_args.push(~"-o"); + cc_args.push(output.to_str()); + cc_args.push(obj_filename.to_str()); let mut lib_cmd; let os = sess.targ_cfg.os; @@ -674,17 +674,17 @@ fn link_binary(sess: session, let cstore = sess.cstore; for cstore::get_used_crate_files(cstore).each |cratepath| { if cratepath.filetype() == Some(~".rlib") { - vec::push(cc_args, cratepath.to_str()); + cc_args.push(cratepath.to_str()); loop; } let dir = cratepath.dirname(); - if dir != ~"" { vec::push(cc_args, ~"-L" + dir); } + if dir != ~"" { cc_args.push(~"-L" + dir); } let libarg = unlib(sess.targ_cfg, cratepath.filestem().get()); - vec::push(cc_args, ~"-l" + libarg); + cc_args.push(~"-l" + libarg); } let ula = cstore::get_used_link_args(cstore); - for ula.each |arg| { vec::push(cc_args, *arg); } + for ula.each |arg| { cc_args.push(*arg); } // # Extern library linking @@ -695,41 +695,41 @@ fn link_binary(sess: session, // forces to make sure that library can be found at runtime. let addl_paths = sess.opts.addl_lib_search_paths; - for addl_paths.each |path| { vec::push(cc_args, ~"-L" + path.to_str()); } + for addl_paths.each |path| { cc_args.push(~"-L" + path.to_str()); } // The names of the extern libraries let used_libs = cstore::get_used_libraries(cstore); - for used_libs.each |l| { vec::push(cc_args, ~"-l" + *l); } + for used_libs.each |l| { cc_args.push(~"-l" + *l); } if sess.building_library { - vec::push(cc_args, lib_cmd); + cc_args.push(lib_cmd); // On mac we need to tell the linker to let this library // be rpathed if sess.targ_cfg.os == session::os_macos { - vec::push(cc_args, ~"-Wl,-install_name,@rpath/" + cc_args.push(~"-Wl,-install_name,@rpath/" + output.filename().get()); } } if !sess.debugging_opt(session::no_rt) { // Always want the runtime linked in - vec::push(cc_args, ~"-lrustrt"); + cc_args.push(~"-lrustrt"); } // On linux librt and libdl are an indirect dependencies via rustrt, // and binutils 2.22+ won't add them automatically if sess.targ_cfg.os == session::os_linux { - vec::push_all(cc_args, ~[~"-lrt", ~"-ldl"]); + cc_args.push_all(~[~"-lrt", ~"-ldl"]); // LLVM implements the `frem` instruction as a call to `fmod`, // which lives in libm. Similar to above, on some linuxes we // have to be explicit about linking to it. See #2510 - vec::push(cc_args, ~"-lm"); + cc_args.push(~"-lm"); } if sess.targ_cfg.os == session::os_freebsd { - vec::push_all(cc_args, ~[~"-pthread", ~"-lrt", + cc_args.push_all(~[~"-pthread", ~"-lrt", ~"-L/usr/local/lib", ~"-lexecinfo", ~"-L/usr/local/lib/gcc46", ~"-L/usr/local/lib/gcc44", ~"-lstdc++", @@ -743,15 +743,15 @@ fn link_binary(sess: session, // understand how to unwind our __morestack frame, so we have to turn it // off. This has impacted some other projects like GHC. if sess.targ_cfg.os == session::os_macos { - vec::push(cc_args, ~"-Wl,-no_compact_unwind"); + cc_args.push(~"-Wl,-no_compact_unwind"); } // Stack growth requires statically linking a __morestack function - vec::push(cc_args, ~"-lmorestack"); + cc_args.push(~"-lmorestack"); // FIXME (#2397): At some point we want to rpath our guesses as to where // extern libraries might live, based on the addl_lib_search_paths - vec::push_all(cc_args, rpath::get_rpath_flags(sess, &output)); + cc_args.push_all(rpath::get_rpath_flags(sess, &output)); debug!("%s link args: %s", cc_prog, str::connect(cc_args, ~" ")); // We run 'cc' here diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs index 132bbc96344..8aa7caefc7a 100644 --- a/src/rustc/back/rpath.rs +++ b/src/rustc/back/rpath.rs @@ -81,8 +81,8 @@ fn get_rpaths(os: session::os, log_rpaths(~"fallback", fallback_rpaths); let mut rpaths = rel_rpaths; - vec::push_all(rpaths, abs_rpaths); - vec::push_all(rpaths, fallback_rpaths); + rpaths.push_all(abs_rpaths); + rpaths.push_all(fallback_rpaths); // Remove duplicates let rpaths = minimize_rpaths(rpaths); @@ -136,9 +136,9 @@ fn get_relative_to(abs1: &Path, abs2: &Path) -> Path { } let mut path = ~[]; - for uint::range(start_idx, len1 - 1) |_i| { vec::push(path, ~".."); }; + for uint::range(start_idx, len1 - 1) |_i| { path.push(~".."); }; - vec::push_all(path, vec::view(split2, start_idx, len2 - 1)); + path.push_all(vec::view(split2, start_idx, len2 - 1)); if vec::is_not_empty(path) { return Path("").push_many(path); @@ -172,7 +172,7 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { for rpaths.each |rpath| { let s = rpath.to_str(); if !set.contains_key(s) { - vec::push(minimized, *rpath); + minimized.push(*rpath); set.insert(s, ()); } } diff --git a/src/rustc/back/upcall.rs b/src/rustc/back/upcall.rs index f289a0bdf27..a2c864f6f46 100644 --- a/src/rustc/back/upcall.rs +++ b/src/rustc/back/upcall.rs @@ -28,7 +28,7 @@ fn declare_upcalls(targ_cfg: @session::config, tys: ~[TypeRef], rv: TypeRef) -> ValueRef { let mut arg_tys: ~[TypeRef] = ~[]; - for tys.each |t| { vec::push(arg_tys, *t); } + for tys.each |t| { arg_tys.push(*t); } let fn_ty = T_fn(arg_tys, rv); return base::decl_cdecl_fn(llmod, prefix + name, fn_ty); } diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index f890fa85eb3..3acacd3c0a5 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -94,7 +94,7 @@ fn parse_cfgspecs(cfgspecs: ~[~str]) -> ast::crate_cfg { // meta_word variant. let mut words = ~[]; for cfgspecs.each |s| { - vec::push(words, attr::mk_word_item(*s)); + words.push(attr::mk_word_item(*s)); } return words; } @@ -466,7 +466,7 @@ fn build_session_options(binary: ~str, level_name, lint_name)); } Some(lint) => { - vec::push(lint_opts, (lint.lint, *level)); + lint_opts.push((lint.lint, *level)); } } } diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index e1441d9ee5e..55d71ab6950 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -99,7 +99,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) -> fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) -> Option<@ast::item> { - vec::push(cx.path, i.ident); + cx.path.push(i.ident); debug!("current path: %s", ast_util::path_name_i(cx.path, cx.sess.parse_sess.interner)); @@ -286,7 +286,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr { debug!("building test vector from %u tests", cx.testfns.len()); let mut descs = ~[]; for cx.testfns.each |test| { - vec::push(descs, mk_test_desc_rec(cx, *test)); + descs.push(mk_test_desc_rec(cx, *test)); } let inner_expr = @{id: cx.sess.next_node_id(), diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index 8a982eaf497..edf6a9612c7 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -115,7 +115,7 @@ fn iter_crate_data(cstore: cstore, i: fn(ast::crate_num, crate_metadata)) { fn add_used_crate_file(cstore: cstore, lib: &Path) { if !vec::contains(p(cstore).used_crate_files, copy *lib) { - vec::push(p(cstore).used_crate_files, copy *lib); + p(cstore).used_crate_files.push(copy *lib); } } @@ -127,7 +127,7 @@ fn add_used_library(cstore: cstore, lib: ~str) -> bool { assert lib != ~""; if vec::contains(p(cstore).used_libraries, lib) { return false; } - vec::push(p(cstore).used_libraries, lib); + p(cstore).used_libraries.push(lib); return true; } @@ -136,7 +136,7 @@ fn get_used_libraries(cstore: cstore) -> ~[~str] { } fn add_used_link_args(cstore: cstore, args: ~str) { - vec::push_all(p(cstore).used_link_args, str::split_char(args, ' ')); + p(cstore).used_link_args.push_all(str::split_char(args, ' ')); } fn get_used_link_args(cstore: cstore) -> ~[~str] { @@ -163,7 +163,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] { let cdata = cstore::get_crate_data(cstore, cnum); let hash = decoder::get_crate_hash(cdata.data); debug!("Add hash[%s]: %s", cdata.name, hash); - vec::push(result, {name: cdata.name, hash: hash}); + result.push({name: cdata.name, hash: hash}); }; pure fn lteq(a: &crate_hash, b: &crate_hash) -> bool {a.name <= b.name} let sorted = std::sort::merge_sort(lteq, result); diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 4a72867eb85..a6bb681bc16 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -227,7 +227,7 @@ fn item_type(item_id: ast::def_id, item: ebml::Doc, fn item_impl_traits(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ~[ty::t] { let mut results = ~[]; for ebml::tagged_docs(item, tag_impl_trait) |ity| { - vec::push(results, doc_type(ity, tcx, cdata)); + results.push(doc_type(ity, tcx, cdata)); }; results } @@ -239,7 +239,7 @@ fn item_ty_param_bounds(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) let bd = parse_bounds_data(p.data, p.start, cdata.cnum, tcx, |did| { translate_def_id(cdata, did) }); - vec::push(bounds, bd); + bounds.push(bd); } @bounds } @@ -263,7 +263,7 @@ fn enum_variant_ids(item: ebml::Doc, cdata: cmd) -> ~[ast::def_id] { let v = tag_items_data_item_variant; for ebml::tagged_docs(item, v) |p| { let ext = ebml::with_doc_data(p, |d| parse_def_id(d)); - vec::push(ids, {crate: cdata.cnum, node: ext.node}); + ids.push({crate: cdata.cnum, node: ext.node}); }; return ids; } @@ -278,10 +278,10 @@ fn item_path(intr: @ident_interner, item_doc: ebml::Doc) -> ast_map::path { for ebml::docs(path_doc) |tag, elt_doc| { if tag == tag_path_elt_mod { let str = ebml::doc_as_str(elt_doc); - vec::push(result, ast_map::path_mod(intr.intern(@str))); + result.push(ast_map::path_mod(intr.intern(@str))); } else if tag == tag_path_elt_name { let str = ebml::doc_as_str(elt_doc); - vec::push(result, ast_map::path_name(intr.intern(@str))); + result.push(ast_map::path_name(intr.intern(@str))); } else { // ignore tag_path_len element } @@ -584,7 +584,7 @@ fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id, let mut arg_tys: ~[ty::t] = ~[]; match ty::get(ctor_ty).sty { ty::ty_fn(f) => { - for f.sig.inputs.each |a| { vec::push(arg_tys, a.ty); } + for f.sig.inputs.each |a| { arg_tys.push(a.ty); } } _ => { /* Nullary enum variant. */ } } @@ -592,7 +592,7 @@ fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id, Some(val) => { disr_val = val; } _ => { /* empty */ } } - vec::push(infos, @{args: arg_tys, ctor_ty: ctor_ty, name: name, + infos.push(@{args: arg_tys, ctor_ty: ctor_ty, name: name, id: *did, disr_val: disr_val}); disr_val += 1; } @@ -645,7 +645,7 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc, let m_did = ebml::with_doc_data(doc, |d| parse_def_id(d)); let mth_item = lookup_item(m_did.node, cdata.data); let self_ty = get_self_ty(mth_item); - vec::push(rslt, @{did: translate_def_id(cdata, m_did), + rslt.push(@{did: translate_def_id(cdata, m_did), /* FIXME (maybe #2323) tjc: take a look at this. */ n_tps: item_ty_param_count(mth_item) - base_tps, ident: item_name(intr, mth_item), @@ -675,7 +675,7 @@ fn get_impls_for_mod(intr: @ident_interner, cdata: cmd, let nm = item_name(intr, item); if match name { Some(n) => { n == nm } None => { true } } { let base_tps = item_ty_param_count(item); - vec::push(result, @{ + result.push(@{ did: local_did, ident: nm, methods: item_impl_methods(intr, impl_cdata, item, base_tps) }); @@ -701,7 +701,7 @@ fn get_trait_methods(intr: @ident_interner, cdata: cmd, id: ast::node_id, ~"get_trait_methods: id has non-function type"); } }; let self_ty = get_self_ty(mth); - vec::push(result, {ident: name, tps: bounds, fty: fty, + result.push({ident: name, tps: bounds, fty: fty, self_ty: self_ty, vis: ast::public}); } @@ -753,7 +753,7 @@ fn get_class_members(intr: @ident_interner, cdata: cmd, id: ast::node_id, let name = item_name(intr, an_item); let did = item_def_id(an_item, cdata); let mt = field_mutability(an_item); - vec::push(result, {ident: name, id: did, vis: + result.push({ident: name, id: did, vis: family_to_visibility(f), mutability: mt}); } } @@ -835,7 +835,7 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::meta_item] { for ebml::tagged_docs(md, tag_meta_item_word) |meta_item_doc| { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); - vec::push(items, attr::mk_word_item(n)); + items.push(attr::mk_word_item(n)); }; for ebml::tagged_docs(md, tag_meta_item_name_value) |meta_item_doc| { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); @@ -844,13 +844,13 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::meta_item] { let v = str::from_bytes(ebml::doc_data(vd)); // FIXME (#623): Should be able to decode meta_name_value variants, // but currently the encoder just drops them - vec::push(items, attr::mk_name_value_item_str(n, v)); + items.push(attr::mk_name_value_item_str(n, v)); }; for ebml::tagged_docs(md, tag_meta_item_list) |meta_item_doc| { let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); let subitems = get_meta_items(meta_item_doc); - vec::push(items, attr::mk_list_item(n, subitems)); + items.push(attr::mk_list_item(n, subitems)); }; return items; } @@ -865,10 +865,10 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::attribute] { // an attribute assert (vec::len(meta_items) == 1u); let meta_item = meta_items[0]; - vec::push(attrs, - {node: {style: ast::attr_outer, value: *meta_item, - is_sugared_doc: false}, - span: ast_util::dummy_sp()}); + attrs.push( + {node: {style: ast::attr_outer, value: *meta_item, + is_sugared_doc: false}, + span: ast_util::dummy_sp()}); }; } option::None => () @@ -910,7 +910,7 @@ fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] { str::from_bytes(ebml::doc_data(ebml::get_doc(doc, tag_))) } for ebml::tagged_docs(depsdoc, tag_crate_dep) |depdoc| { - vec::push(deps, {cnum: crate_num, + deps.push({cnum: crate_num, name: intr.intern(@docstr(depdoc, tag_crate_dep_name)), vers: docstr(depdoc, tag_crate_dep_vers), hash: docstr(depdoc, tag_crate_dep_hash)}); @@ -977,7 +977,7 @@ fn get_crate_module_paths(intr: @ident_interner, cdata: cmd) // Collect everything by now. There might be multiple // paths pointing to the same did. Those will be // unified later by using the mods map - vec::push(res, (did, path)); + res.push((did, path)); } return do vec::filter(res) |x| { let (_, xp) = x; diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 3424ea8dd57..81ad9dfc3a5 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -118,12 +118,12 @@ type entry<T> = {val: T, pos: uint}; fn add_to_index(ecx: @encode_ctxt, ebml_w: ebml::Writer, path: &[ident], &index: ~[entry<~str>], name: ident) { let mut full_path = ~[]; - vec::push_all(full_path, path); - vec::push(full_path, name); - vec::push(index, - {val: ast_util::path_name_i(full_path, - ecx.tcx.sess.parse_sess.interner), - pos: ebml_w.writer.tell()}); + full_path.push_all(path); + full_path.push(name); + index.push( + {val: ast_util::path_name_i(full_path, + ecx.tcx.sess.parse_sess.interner), + pos: ebml_w.writer.tell()}); } fn encode_trait_ref(ebml_w: ebml::Writer, ecx: @encode_ctxt, t: @trait_ref) { @@ -225,7 +225,7 @@ fn encode_enum_variant_info(ecx: @encode_ctxt, ebml_w: ebml::Writer, let mut i = 0; let vi = ty::enum_variants(ecx.tcx, {crate: local_crate, node: id}); for variants.each |variant| { - vec::push(*index, {val: variant.node.id, pos: ebml_w.writer.tell()}); + index.push({val: variant.node.id, pos: ebml_w.writer.tell()}); ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(variant.node.id)); encode_family(ebml_w, 'v'); @@ -390,9 +390,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::Writer, match field.node.kind { named_field(nm, mt, vis) => { let id = field.node.id; - vec::push(*index, {val: id, pos: ebml_w.writer.tell()}); - vec::push(*global_index, {val: id, - pos: ebml_w.writer.tell()}); + index.push({val: id, pos: ebml_w.writer.tell()}); + global_index.push({val: id, + pos: ebml_w.writer.tell()}); ebml_w.start_tag(tag_items_data_item); debug!("encode_info_for_class: doing %s %d", tcx.sess.str_of(nm), id); @@ -411,9 +411,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::Writer, for methods.each |m| { match m.vis { public | inherited => { - vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()}); - vec::push(*global_index, - {val: m.id, pos: ebml_w.writer.tell()}); + index.push({val: m.id, pos: ebml_w.writer.tell()}); + global_index.push( + {val: m.id, pos: ebml_w.writer.tell()}); let impl_path = vec::append_one(path, ast_map::path_name(m.ident)); debug!("encode_info_for_class: doing %s %d", @@ -519,7 +519,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, fn add_to_index_(item: @item, ebml_w: ebml::Writer, index: @mut ~[entry<int>]) { - vec::push(*index, {val: item.id, pos: ebml_w.writer.tell()}); + index.push({val: item.id, pos: ebml_w.writer.tell()}); } let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index); @@ -603,7 +603,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, index); /* Encode the dtor */ do struct_def.dtor.iter |dtor| { - vec::push(*index, {val: dtor.node.id, pos: ebml_w.writer.tell()}); + index.push({val: dtor.node.id, pos: ebml_w.writer.tell()}); encode_info_for_ctor(ecx, ebml_w, dtor.node.id, ecx.tcx.sess.ident_of( ecx.tcx.sess.str_of(item.ident) + @@ -688,7 +688,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, for struct_def.ctor.each |ctor| { debug!("encoding info for ctor %s %d", ecx.tcx.sess.str_of(item.ident), ctor.node.id); - vec::push(*index, { + index.push({ val: ctor.node.id, pos: ebml_w.writer.tell() }); @@ -723,7 +723,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, let impl_path = vec::append_one(path, ast_map::path_name(item.ident)); for methods.each |m| { - vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()}); + index.push({val: m.id, pos: ebml_w.writer.tell()}); encode_info_for_method(ecx, ebml_w, impl_path, should_inline(m.attrs), item.id, *m, vec::append(tps, m.tps)); @@ -774,7 +774,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, let ty_m = ast_util::trait_method_to_ty_method(*m); if ty_m.self_ty.node != ast::sty_static { loop; } - vec::push(*index, {val: ty_m.id, pos: ebml_w.writer.tell()}); + index.push({val: ty_m.id, pos: ebml_w.writer.tell()}); ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(ty_m.id)); @@ -799,7 +799,7 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, index: @mut ~[entry<int>], path: ast_map::path, abi: foreign_abi) { if !reachable(ecx, nitem.id) { return; } - vec::push(*index, {val: nitem.id, pos: ebml_w.writer.tell()}); + index.push({val: nitem.id, pos: ebml_w.writer.tell()}); ebml_w.start_tag(tag_items_data_item); match nitem.node { @@ -831,7 +831,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer, crate: @crate) -> ~[entry<int>] { let index = @mut ~[]; ebml_w.start_tag(tag_items_data); - vec::push(*index, {val: crate_node_id, pos: ebml_w.writer.tell()}); + index.push({val: crate_node_id, pos: ebml_w.writer.tell()}); encode_info_for_mod(ecx, ebml_w, crate.node.module, crate_node_id, ~[], syntax::parse::token::special_idents::invalid); @@ -869,15 +869,15 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer, fn create_index<T: Copy Hash IterBytes>(index: ~[entry<T>]) -> ~[@~[entry<T>]] { let mut buckets: ~[@mut ~[entry<T>]] = ~[]; - for uint::range(0u, 256u) |_i| { vec::push(buckets, @mut ~[]); }; + for uint::range(0u, 256u) |_i| { buckets.push(@mut ~[]); }; for index.each |elt| { let h = elt.val.hash() as uint; - vec::push(*buckets[h % 256], *elt); + buckets[h % 256].push(*elt); } let mut buckets_frozen = ~[]; for buckets.each |bucket| { - vec::push(buckets_frozen, @**bucket); + buckets_frozen.push(@**bucket); } return buckets_frozen; } @@ -889,7 +889,7 @@ fn encode_index<T>(ebml_w: ebml::Writer, buckets: ~[@~[entry<T>]], let mut bucket_locs: ~[uint] = ~[]; ebml_w.start_tag(tag_index_buckets); for buckets.each |bucket| { - vec::push(bucket_locs, ebml_w.writer.tell()); + bucket_locs.push(ebml_w.writer.tell()); ebml_w.start_tag(tag_index_buckets_bucket); for vec::each(**bucket) |elt| { ebml_w.start_tag(tag_index_buckets_bucket_elt); @@ -996,8 +996,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> ~[attribute] { let mut attrs: ~[attribute] = ~[]; let mut found_link_attr = false; for crate.node.attrs.each |attr| { - vec::push( - attrs, + attrs.push( if attr::get_attr_name(*attr) != ~"link" { *attr } else { @@ -1011,7 +1010,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> ~[attribute] { }); } - if !found_link_attr { vec::push(attrs, synthesize_link_attr(ecx, ~[])); } + if !found_link_attr { attrs.push(synthesize_link_attr(ecx, ~[])); } return attrs; } @@ -1031,7 +1030,7 @@ fn encode_crate_deps(ecx: @encode_ctxt, ebml_w: ebml::Writer, let dep = {cnum: key, name: ecx.tcx.sess.ident_of(val.name), vers: decoder::get_crate_vers(val.data), hash: decoder::get_crate_hash(val.data)}; - vec::push(deps, dep); + deps.push(dep); }; // Sort by cnum diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs index 77d06bd2d29..63370b09321 100644 --- a/src/rustc/metadata/filesearch.rs +++ b/src/rustc/metadata/filesearch.rs @@ -39,15 +39,15 @@ fn mk_filesearch(maybe_sysroot: Option<Path>, fn lib_search_paths() -> ~[Path] { let mut paths = self.addl_lib_search_paths; - vec::push(paths, - make_target_lib_path(&self.sysroot, - self.target_triple)); + paths.push( + make_target_lib_path(&self.sysroot, + self.target_triple)); match get_cargo_lib_path_nearest() { - result::Ok(p) => vec::push(paths, p), + result::Ok(p) => paths.push(p), result::Err(_) => () } match get_cargo_lib_path() { - result::Ok(p) => vec::push(paths, p), + result::Ok(p) => paths.push(p), result::Err(_) => () } paths diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index b2c28fafd4c..2ccaccf17a5 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -90,7 +90,7 @@ fn find_library_crate_aux(cx: ctxt, option::None::<()> } else { debug!("found %s with matching metadata", path.to_str()); - vec::push(matches, {ident: path.to_str(), data: cvec}); + matches.push({ident: path.to_str(), data: cvec}); option::None::<()> } } diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index 5cf24aef558..f3fa0e3f350 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -84,7 +84,7 @@ fn parse_ret_ty(st: @pstate, conv: conv_did) -> (ast::ret_style, ty::t) { fn parse_path(st: @pstate) -> @ast::path { let mut idents: ~[ast::ident] = ~[]; fn is_last(c: char) -> bool { return c == '(' || c == ':'; } - vec::push(idents, parse_ident_(st, is_last)); + idents.push(parse_ident_(st, is_last)); loop { match peek(st) { ':' => { next(st); next(st); } @@ -93,7 +93,7 @@ fn parse_path(st: @pstate) -> @ast::path { return @{span: ast_util::dummy_sp(), global: false, idents: idents, rp: None, types: ~[]}; - } else { vec::push(idents, parse_ident_(st, is_last)); } + } else { idents.push(parse_ident_(st, is_last)); } } } }; @@ -136,7 +136,7 @@ fn parse_substs(st: @pstate, conv: conv_did) -> ty::substs { assert next(st) == '['; let mut params: ~[ty::t] = ~[]; - while peek(st) != ']' { vec::push(params, parse_ty(st, conv)); } + while peek(st) != ']' { params.push(parse_ty(st, conv)); } st.pos = st.pos + 1u; return {self_r: self_r, @@ -273,7 +273,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { let mut fields: ~[ty::field] = ~[]; while peek(st) != ']' { let name = st.tcx.sess.ident_of(parse_str(st, '=')); - vec::push(fields, {ident: name, mt: parse_mt(st, conv)}); + fields.push({ident: name, mt: parse_mt(st, conv)}); } st.pos = st.pos + 1u; return ty::mk_rec(st.tcx, fields); @@ -281,7 +281,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { 'T' => { assert (next(st) == '['); let mut params = ~[]; - while peek(st) != ']' { vec::push(params, parse_ty(st, conv)); } + while peek(st) != ']' { params.push(parse_ty(st, conv)); } st.pos = st.pos + 1u; return ty::mk_tup(st.tcx, params); } @@ -348,7 +348,7 @@ fn parse_mt(st: @pstate, conv: conv_did) -> ty::mt { fn parse_def(st: @pstate, conv: conv_did) -> ast::def_id { let mut def = ~[]; - while peek(st) != '|' { vec::push(def, next_byte(st)); } + while peek(st) != '|' { def.push(next_byte(st)); } st.pos = st.pos + 1u; return conv(parse_def_id(def)); } @@ -412,7 +412,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::FnTy { let mut inputs: ~[ty::arg] = ~[]; while peek(st) != ']' { let mode = parse_mode(st); - vec::push(inputs, {mode: mode, ty: parse_ty(st, conv)}); + inputs.push({mode: mode, ty: parse_ty(st, conv)}); } st.pos += 1u; // eat the ']' let (ret_style, ret_ty) = parse_ret_ty(st, conv); @@ -464,7 +464,7 @@ fn parse_bounds_data(data: @~[u8], start: uint, fn parse_bounds(st: @pstate, conv: conv_did) -> @~[ty::param_bound] { let mut bounds = ~[]; loop { - vec::push(bounds, match next(st) { + bounds.push(match next(st) { 'S' => ty::bound_send, 'C' => ty::bound_copy, 'K' => ty::bound_const, diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs index 1e885605171..618d43e121a 100644 --- a/src/rustc/middle/capture.rs +++ b/src/rustc/middle/capture.rs @@ -122,6 +122,6 @@ fn compute_capture_vars(tcx: ty::ctxt, } let mut result = ~[]; - for cap_map.each_value |cap_var| { vec::push(result, cap_var); } + for cap_map.each_value |cap_var| { result.push(cap_var); } return result; } diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 32801ed760c..54f415857ba 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -67,7 +67,7 @@ fn check_arms(tcx: ty::ctxt, arms: ~[arm]) { } _ => () } - if arm.guard.is_none() { vec::push(seen, v); } + if arm.guard.is_none() { seen.push(v); } } } } @@ -269,7 +269,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option<ctor> { let mut found = ~[]; for m.each |r| { do option::iter(&pat_ctor_id(tcx, r[0])) |id| { - if !vec::contains(found, id) { vec::push(found, id); } + if !vec::contains(found, id) { found.push(id); } } } let variants = ty::enum_variants(tcx, eid); diff --git a/src/rustc/middle/freevars.rs b/src/rustc/middle/freevars.rs index 251ef2c89b7..7e925d7d8d8 100644 --- a/src/rustc/middle/freevars.rs +++ b/src/rustc/middle/freevars.rs @@ -63,7 +63,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk) if i == depth { // Made it to end of loop let dnum = ast_util::def_id_of_def(def).node; if !seen.contains_key(dnum) { - vec::push(*refs, @{def:def, span:expr.span}); + refs.push(@{def:def, span:expr.span}); seen.insert(dnum, ()); } } diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 4f9045ec77e..7d911f7d05a 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -42,17 +42,17 @@ fn kind_to_str(k: kind) -> ~str { let mut kinds = ~[]; if ty::kind_lteq(kind_const(), k) { - vec::push(kinds, ~"const"); + kinds.push(~"const"); } if ty::kind_can_be_copied(k) { - vec::push(kinds, ~"copy"); + kinds.push(~"copy"); } if ty::kind_can_be_sent(k) { - vec::push(kinds, ~"send"); + kinds.push(~"send"); } else if ty::kind_is_owned(k) { - vec::push(kinds, ~"owned"); + kinds.push(~"owned"); } str::connect(kinds, ~" ") diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index ff77a598d27..b92f8e8441f 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -288,7 +288,7 @@ impl ctxt { for metas.each |meta| { match meta.node { ast::meta_word(lintname) => { - vec::push(triples, (*meta, *level, lintname)); + triples.push((*meta, *level, lintname)); } _ => { self.sess.span_err( diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index a4c9b5f4b35..b39b7914905 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -302,7 +302,7 @@ fn IrMaps(tcx: ty::ctxt, method_map: typeck::method_map, impl IrMaps { fn add_live_node(lnk: LiveNodeKind) -> LiveNode { let ln = LiveNode(self.num_live_nodes); - vec::push(self.lnks, lnk); + self.lnks.push(lnk); self.num_live_nodes += 1u; debug!("%s is of kind %?", ln.to_str(), lnk); @@ -319,7 +319,7 @@ impl IrMaps { fn add_variable(vk: VarKind) -> Variable { let v = Variable(self.num_vars); - vec::push(self.var_kinds, vk); + self.var_kinds.push(vk); self.num_vars += 1u; match vk { @@ -540,7 +540,7 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) { cap_move | cap_drop => true, // var must be dead afterwards cap_copy | cap_ref => false // var can still be used }; - vec::push(call_caps, {ln: cv_ln, is_move: is_move, rv: rv}); + call_caps.push({ln: cv_ln, is_move: is_move, rv: rv}); } None => {} } diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs index e67b85b869c..006065988b9 100644 --- a/src/rustc/middle/pat_util.rs +++ b/src/rustc/middle/pat_util.rs @@ -54,6 +54,6 @@ fn pat_bindings(dm: resolve::DefMap, pat: @pat, fn pat_binding_ids(dm: resolve::DefMap, pat: @pat) -> ~[node_id] { let mut found = ~[]; - pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| vec::push(found, b_id) ); + pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| found.push(b_id) ); return found; } diff --git a/src/rustc/middle/region.rs b/src/rustc/middle/region.rs index ae1c739b26b..ff708b7f4ef 100644 --- a/src/rustc/middle/region.rs +++ b/src/rustc/middle/region.rs @@ -141,7 +141,7 @@ fn nearest_common_ancestor(region_map: region_map, scope_a: ast::node_id, match region_map.find(scope) { None => return result, Some(superscope) => { - vec::push(result, superscope); + result.push(superscope); scope = superscope; } } diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 7380a217ebe..99d98c52f95 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -2897,7 +2897,7 @@ impl Resolver { if reexport { ~"reexport" } else { ~"export"}, self.session.str_of(ident), def_id_of_def(d.def)); - vec::push(*exports2, Export2 { + exports2.push(Export2 { reexport: reexport, name: self.session.str_of(ident), def_id: def_id_of_def(d.def) @@ -2949,7 +2949,7 @@ impl Resolver { for %?", self.session.str_of(name), module_.def_id); - vec::push(*exports2, Export2 { + exports2.push(Export2 { reexport: false, name: self.session.str_of(name), def_id: def_id_of_def(target_def) @@ -2960,7 +2960,7 @@ impl Resolver { %?", self.session.str_of(name), module_.def_id); - vec::push(*exports2, Export2 { + exports2.push(Export2 { reexport: true, name: self.session.str_of(name), def_id: def_id_of_def(target_def) diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 11b694bcb1d..165ca8e2fc4 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -305,7 +305,7 @@ fn enter_match(bcx: block, dm: DefMap, m: &[@Match/&r], _ => {} } - vec::push(result, @Match {pats: pats, data: br.data}); + result.push(@Match {pats: pats, data: br.data}); } None => () } @@ -398,8 +398,8 @@ fn enter_rec_or_struct(bcx: block, dm: DefMap, m: &[@Match/&r], col: uint, let mut pats = ~[]; for vec::each(fields) |fname| { match fpats.find(|p| p.ident == *fname) { - None => vec::push(pats, dummy), - Some(pat) => vec::push(pats, pat.pat) + None => pats.push(dummy), + Some(pat) => pats.push(pat.pat) } } Some(pats) @@ -582,7 +582,7 @@ fn collect_record_or_struct_fields(m: &[@Match], col: uint) -> ~[ast::ident] { for field_pats.each |field_pat| { let field_ident = field_pat.ident; if !vec::any(*idents, |x| x == field_ident) { - vec::push(*idents, field_ident); + idents.push(field_ident); } } } @@ -1162,9 +1162,9 @@ fn trans_alt_inner(scope_cx: block, let arm_data = @ArmData {bodycx: body, arm: arm, bindings_map: bindings_map}; - vec::push(arm_datas, arm_data); + arm_datas.push(arm_data); for vec::each(arm.pats) |p| { - vec::push(matches, @Match {pats: ~[*p], data: arm_data}); + matches.push(@Match {pats: ~[*p], data: arm_data}); } } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index b29fac0fa2f..94b09a30e4b 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -76,7 +76,7 @@ impl @crate_ctxt: get_insn_ctxt { fn insn_ctxt(s: &str) -> icx_popper { debug!("new insn_ctxt: %s", s); if self.sess.count_llvm_insns() { - vec::push(*self.stats.llvm_insn_ctxt, str::from_slice(s)); + self.stats.llvm_insn_ctxt.push(str::from_slice(s)); } icx_popper(self) } @@ -98,7 +98,7 @@ fn log_fn_time(ccx: @crate_ctxt, name: ~str, start: time::Timespec, end: time::Timespec) { let elapsed = 1000 * ((end.sec - start.sec) as int) + ((end.nsec as int) - (start.nsec as int)) / 1000000; - vec::push(*ccx.stats.fn_times, {ident: name, time: elapsed}); + ccx.stats.fn_times.push({ident: name, time: elapsed}); } fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv, @@ -1153,7 +1153,7 @@ fn cleanup_and_leave(bcx: block, upto: Option<BasicBlockRef>, } let sub_cx = sub_block(bcx, ~"cleanup"); Br(bcx, sub_cx.llbb); - vec::push(inf.cleanup_paths, {target: leave, dest: sub_cx.llbb}); + inf.cleanup_paths.push({target: leave, dest: sub_cx.llbb}); bcx = trans_block_cleanups_(sub_cx, block_cleanups(cur), is_lpad); } _ => () @@ -2001,7 +2001,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef, let llenvarg = llvm::LLVMGetParam(llfdecl, 1 as c_uint); let mut args = ~[lloutputarg, llenvarg]; if takes_argv { - vec::push(args, llvm::LLVMGetParam(llfdecl, 2 as c_uint)); + args.push(llvm::LLVMGetParam(llfdecl, 2 as c_uint)); } Call(bcx, main_llfn, args); @@ -2451,10 +2451,10 @@ fn create_module_map(ccx: @crate_ctxt) -> ValueRef { for ccx.module_data.each |key, val| { let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)), p2i(ccx, val)]); - vec::push(elts, elt); + elts.push(elt); } let term = C_struct(~[C_int(ccx, 0), C_int(ccx, 0)]); - vec::push(elts, term); + elts.push(term); llvm::LLVMSetInitializer(map, C_array(elttype, elts)); return map; } @@ -2492,10 +2492,10 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) { let cr = str::as_c_str(nm, |buf| { llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf) }); - vec::push(subcrates, p2i(ccx, cr)); + subcrates.push(p2i(ccx, cr)); i += 1; } - vec::push(subcrates, C_int(ccx, 0)); + subcrates.push(C_int(ccx, 0)); let llannihilatefn; let annihilate_def_id = ccx.tcx.lang_items.annihilate_fn.get(); diff --git a/src/rustc/middle/trans/build.rs b/src/rustc/middle/trans/build.rs index 865374054e6..070132b4b18 100644 --- a/src/rustc/middle/trans/build.rs +++ b/src/rustc/middle/trans/build.rs @@ -435,7 +435,7 @@ fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef { // XXX: Use a small-vector optimization to avoid allocations here. fn GEPi(cx: block, base: ValueRef, ixs: &[uint]) -> ValueRef { let mut v: ~[ValueRef] = ~[]; - for vec::each(ixs) |i| { vec::push(v, C_i32(*i as i32)); } + for vec::each(ixs) |i| { v.push(C_i32(*i as i32)); } count_insn(cx, "gepi"); return InBoundsGEP(cx, base, v); } diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs index 3050297b360..470d4dbb4ab 100644 --- a/src/rustc/middle/trans/callee.rs +++ b/src/rustc/middle/trans/callee.rs @@ -478,10 +478,10 @@ fn trans_args(cx: block, llenv: ValueRef, args: CallArgs, fn_ty: ty::t, } } }; - vec::push(llargs, llretslot); + llargs.push(llretslot); // Arg 1: Env (closure-bindings / self value) - vec::push(llargs, llenv); + llargs.push(llenv); // ... then explicit args. @@ -497,11 +497,11 @@ fn trans_args(cx: block, llenv: ValueRef, args: CallArgs, fn_ty: ty::t, if i == last { ret_flag } else { None }, autoref_arg) }); - vec::push(llargs, arg_val); + llargs.push(arg_val); } } ArgVals(vs) => { - vec::push_all(llargs, vs); + llargs.push_all(vs); } } @@ -622,7 +622,7 @@ fn trans_arg_expr(bcx: block, // However, we must cleanup should we fail before the // callee is actually invoked. scratch.add_clean(bcx); - vec::push(*temp_cleanups, scratch.val); + temp_cleanups.push(scratch.val); match arg_datum.appropriate_mode() { ByValue => { diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs index 38526c223a1..7b071866136 100644 --- a/src/rustc/middle/trans/closure.rs +++ b/src/rustc/middle/trans/closure.rs @@ -259,16 +259,16 @@ fn build_closure(bcx0: block, match cap_var.mode { capture::cap_ref => { assert ck == ty::ck_block; - vec::push(env_vals, EnvValue {action: EnvRef, - datum: datum}); + env_vals.push(EnvValue {action: EnvRef, + datum: datum}); } capture::cap_copy => { - vec::push(env_vals, EnvValue {action: EnvStore, - datum: datum}); + env_vals.push(EnvValue {action: EnvStore, + datum: datum}); } capture::cap_move => { - vec::push(env_vals, EnvValue {action: EnvMove, - datum: datum}); + env_vals.push(EnvValue {action: EnvMove, + datum: datum}); } capture::cap_drop => { bcx = datum.drop_val(bcx); @@ -283,8 +283,8 @@ fn build_closure(bcx0: block, // Flag indicating we have returned (a by-ref bool): let flag_datum = Datum {val: flagptr, ty: ty::mk_bool(tcx), mode: ByRef, source: FromLvalue}; - vec::push(env_vals, EnvValue {action: EnvRef, - datum: flag_datum}); + env_vals.push(EnvValue {action: EnvRef, + datum: flag_datum}); // Return value (we just pass a by-ref () and cast it later to // the right thing): @@ -295,8 +295,8 @@ fn build_closure(bcx0: block, let ret_casted = PointerCast(bcx, ret_true, T_ptr(T_nil())); let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(tcx), mode: ByRef, source: FromLvalue}; - vec::push(env_vals, EnvValue {action: EnvRef, - datum: ret_datum}); + env_vals.push(EnvValue {action: EnvRef, + datum: ret_datum}); } return store_environment(bcx, env_vals, ck); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index fc74e5e0e4d..0df63e40acf 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -348,9 +348,9 @@ fn add_clean(bcx: block, val: ValueRef, t: ty::t) { let {root, rooted} = root_for_cleanup(bcx, val, t); let cleanup_type = cleanup_type(bcx.tcx(), t); do in_scope_cx(bcx) |info| { - vec::push(info.cleanups, - clean(|a| glue::drop_ty_root(a, root, rooted, t), - cleanup_type)); + info.cleanups.push( + clean(|a| glue::drop_ty_root(a, root, rooted, t), + cleanup_type)); scope_clean_changed(info); } } @@ -362,9 +362,9 @@ fn add_clean_temp_immediate(cx: block, val: ValueRef, ty: ty::t) { ty_to_str(cx.ccx().tcx, ty)); let cleanup_type = cleanup_type(cx.tcx(), ty); do in_scope_cx(cx) |info| { - vec::push(info.cleanups, - clean_temp(val, |a| glue::drop_ty_immediate(a, val, ty), - cleanup_type)); + info.cleanups.push( + clean_temp(val, |a| glue::drop_ty_immediate(a, val, ty), + cleanup_type)); scope_clean_changed(info); } } @@ -376,9 +376,9 @@ fn add_clean_temp_mem(bcx: block, val: ValueRef, t: ty::t) { let {root, rooted} = root_for_cleanup(bcx, val, t); let cleanup_type = cleanup_type(bcx.tcx(), t); do in_scope_cx(bcx) |info| { - vec::push(info.cleanups, - clean_temp(val, |a| glue::drop_ty_root(a, root, rooted, t), - cleanup_type)); + info.cleanups.push( + clean_temp(val, |a| glue::drop_ty_root(a, root, rooted, t), + cleanup_type)); scope_clean_changed(info); } } @@ -388,8 +388,8 @@ fn add_clean_free(cx: block, ptr: ValueRef, heap: heap) { heap_exchange => |a| glue::trans_unique_free(a, ptr) }; do in_scope_cx(cx) |info| { - vec::push(info.cleanups, clean_temp(ptr, free_fn, - normal_exit_and_unwind)); + info.cleanups.push(clean_temp(ptr, free_fn, + normal_exit_and_unwind)); scope_clean_changed(info); } } @@ -1050,7 +1050,7 @@ fn C_postr(s: ~str) -> ValueRef { fn C_zero_byte_arr(size: uint) -> ValueRef unsafe { let mut i = 0u; let mut elts: ~[ValueRef] = ~[]; - while i < size { vec::push(elts, C_u8(0u)); i += 1u; } + while i < size { elts.push(C_u8(0u)); i += 1u; } return llvm::LLVMConstArray(T_i8(), vec::raw::to_ptr(elts), elts.len() as c_uint); } diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index 26a83951c01..6cd4b49fa3b 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -383,7 +383,7 @@ fn create_derived_type(type_tag: int, file: ValueRef, name: ~str, line: int, fn add_member(cx: @struct_ctxt, name: ~str, line: int, size: int, align: int, ty: ValueRef) { - vec::push(cx.members, create_derived_type(MemberTag, cx.file, name, line, + cx.members.push(create_derived_type(MemberTag, cx.file, name, line, size * 8, align * 8, cx.total_size, ty)); cx.total_size += size * 8; @@ -529,7 +529,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::ty) ty::ty_rec(fields) { let fs = ~[]; for field in fields { - vec::push(fs, {node: {ident: field.ident, + fs.push({node: {ident: field.ident, mt: {ty: t_to_ty(cx, field.mt.ty, span), mutbl: field.mt.mutbl}}, span: span}); diff --git a/src/rustc/middle/trans/expr.rs b/src/rustc/middle/trans/expr.rs index 17a1ff112cd..dafaebef9e0 100644 --- a/src/rustc/middle/trans/expr.rs +++ b/src/rustc/middle/trans/expr.rs @@ -993,7 +993,7 @@ fn trans_rec_or_struct(bcx: block, let dest = GEPi(bcx, addr, struct_field(ix)); bcx = trans_into(bcx, field.node.expr, SaveIn(dest)); add_clean_temp_mem(bcx, dest, field_tys[ix].mt.ty); - vec::push(temp_cleanups, dest); + temp_cleanups.push(dest); } // copy over any remaining fields from the base (for @@ -1046,7 +1046,7 @@ fn trans_tup(bcx: block, elts: ~[@ast::expr], dest: Dest) -> block { let e_ty = expr_ty(bcx, *e); bcx = trans_into(bcx, *e, SaveIn(dest)); add_clean_temp_mem(bcx, dest, e_ty); - vec::push(temp_cleanups, dest); + temp_cleanups.push(dest); } for vec::each(temp_cleanups) |cleanup| { revoke_clean(bcx, *cleanup); diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs index e775b3fd746..f1077912fec 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/src/rustc/middle/trans/foreign.rs @@ -297,21 +297,21 @@ fn llreg_ty(cls: ~[x86_64_reg_class]) -> TypeRef { while i < e { match cls[i] { integer_class => { - vec::push(tys, T_i64()); + tys.push(T_i64()); } sse_fv_class => { let vec_len = llvec_len(vec::tailn(cls, i + 1u)) * 2u; let vec_ty = llvm::LLVMVectorType(T_f32(), vec_len as c_uint); - vec::push(tys, vec_ty); + tys.push(vec_ty); i += vec_len; loop; } sse_fs_class => { - vec::push(tys, T_f32()); + tys.push(T_f32()); } sse_ds_class => { - vec::push(tys, T_f64()); + tys.push(T_f64()); } _ => fail ~"llregtype: unhandled class" } @@ -378,8 +378,8 @@ fn x86_64_tys(atys: ~[TypeRef], let mut attrs = ~[]; for vec::each(atys) |t| { let (ty, attr) = x86_64_ty(*t, is_pass_byval, ByValAttribute); - vec::push(arg_tys, ty); - vec::push(attrs, attr); + arg_tys.push(ty); + attrs.push(attr); } let mut (ret_ty, ret_attr) = x86_64_ty(rty, is_ret_bysret, StructRetAttribute); @@ -619,7 +619,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt, } else { load_inbounds(bcx, llargbundle, [0u, i]) }; - vec::push(llargvals, llargval); + llargvals.push(llargval); i += 1u; } } @@ -627,7 +627,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt, while i < n { let llargval = load_inbounds(bcx, llargbundle, [0u, i]); - vec::push(llargvals, llargval); + llargvals.push(llargval); i += 1u; } } @@ -1041,12 +1041,12 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let mut i = 0u; let n = vec::len(tys.arg_tys); let llretptr = load_inbounds(bcx, llargbundle, ~[0u, n]); - vec::push(llargvals, llretptr); + llargvals.push(llretptr); let llenvptr = C_null(T_opaque_box_ptr(bcx.ccx())); - vec::push(llargvals, llenvptr); + llargvals.push(llenvptr); while i < n { let llargval = load_inbounds(bcx, llargbundle, ~[0u, i]); - vec::push(llargvals, llargval); + llargvals.push(llargval); i += 1u; } return llargvals; diff --git a/src/rustc/middle/trans/monomorphize.rs b/src/rustc/middle/trans/monomorphize.rs index 8a68ef4823b..40558e72c80 100644 --- a/src/rustc/middle/trans/monomorphize.rs +++ b/src/rustc/middle/trans/monomorphize.rs @@ -246,7 +246,7 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t], for vec::each(*bounds) |bound| { match *bound { ty::bound_trait(_) => { - vec::push(v, meth::vtable_id(ccx, vts[i])); + v.push(meth::vtable_id(ccx, vts[i])); i += 1u; } _ => () diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs index 10f93626280..e1eae115694 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -332,7 +332,7 @@ fn write_content(bcx: block, bcx = expr::trans_into(bcx, *element, SaveIn(lleltptr)); add_clean_temp_mem(bcx, lleltptr, vt.unit_ty); - vec::push(temp_cleanups, lleltptr); + temp_cleanups.push(lleltptr); } for vec::each(temp_cleanups) |cleanup| { revoke_clean(bcx, *cleanup); @@ -369,7 +369,7 @@ fn write_content(bcx: block, bcx = tmpdatum.move_to(bcx, INIT, lleltptr); } add_clean_temp_mem(bcx, lleltptr, vt.unit_ty); - vec::push(temp_cleanups, lleltptr); + temp_cleanups.push(lleltptr); } for vec::each(temp_cleanups) |cleanup| { diff --git a/src/rustc/middle/trans/type_of.rs b/src/rustc/middle/trans/type_of.rs index d9032f8ce90..99555d5b294 100644 --- a/src/rustc/middle/trans/type_of.rs +++ b/src/rustc/middle/trans/type_of.rs @@ -39,13 +39,13 @@ fn type_of_fn(cx: @crate_ctxt, inputs: ~[ty::arg], let mut atys: ~[TypeRef] = ~[]; // Arg 0: Output pointer. - vec::push(atys, T_ptr(type_of(cx, output))); + atys.push(T_ptr(type_of(cx, output))); // Arg 1: Environment - vec::push(atys, T_opaque_box_ptr(cx)); + atys.push(T_opaque_box_ptr(cx)); // ... then explicit args. - vec::push_all(atys, type_of_explicit_args(cx, inputs)); + atys.push_all(type_of_explicit_args(cx, inputs)); return T_fn(atys, llvm::LLVMVoidType()); } @@ -151,7 +151,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef { let mut tys: ~[TypeRef] = ~[]; for vec::each(fields) |f| { let mt_ty = f.mt.ty; - vec::push(tys, type_of(cx, mt_ty)); + tys.push(type_of(cx, mt_ty)); } // n.b.: introduce an extra layer of indirection to match @@ -164,7 +164,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef { ty::ty_tup(elts) => { let mut tys = ~[]; for vec::each(elts) |elt| { - vec::push(tys, type_of(cx, *elt)); + tys.push(type_of(cx, *elt)); } T_struct(tys) } diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index f256b4b76cd..ed71d27451c 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -2243,10 +2243,10 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { } ty_class(did, ref substs) => { - vec::push(*seen, did); - let r = vec::any(class_items_as_fields(cx, did, substs), - |f| type_requires(cx, seen, r_ty, f.mt.ty)); - vec::pop(*seen); + seen.push(did); + let r = vec::any(class_items_as_fields(cx, did, substs), + |f| type_requires(cx, seen, r_ty, f.mt.ty)); + vec::pop(*seen); r } @@ -2258,18 +2258,18 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { false } - ty_enum(did, ref substs) => { - vec::push(*seen, did); - let vs = enum_variants(cx, did); - let r = vec::len(*vs) > 0u && vec::all(*vs, |variant| { - vec::any(variant.args, |aty| { - let sty = subst(cx, substs, aty); - type_requires(cx, seen, r_ty, sty) - }) - }); - vec::pop(*seen); - r - } + ty_enum(did, ref substs) => { + seen.push(did); + let vs = enum_variants(cx, did); + let r = vec::len(*vs) > 0u && vec::all(*vs, |variant| { + vec::any(variant.args, |aty| { + let sty = subst(cx, substs, aty); + type_requires(cx, seen, r_ty, sty) + }) + }); + vec::pop(*seen); + r + } }; debug!("subtypes_require(%s, %s)? %b", @@ -3036,7 +3036,7 @@ fn param_tys_in_type(ty: t) -> ~[param_ty] { do walk_ty(ty) |ty| { match get(ty).sty { ty_param(p) => { - vec::push(rslt, p); + rslt.push(p); } _ => () } @@ -3052,7 +3052,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { let mut rslt = ~[]; do walk_ty(ty) |ty| { match get(ty).sty { - ty_infer(TyVar(v)) => vec::push(rslt, v), + ty_infer(TyVar(v)) => rslt.push(v), _ => () } } @@ -3704,10 +3704,10 @@ fn class_field_tys(fields: ~[@struct_field]) -> ~[field_ty] { for fields.each |field| { match field.node.kind { named_field(ident, mutability, visibility) => { - vec::push(rslt, {ident: ident, - id: ast_util::local_def(field.node.id), - vis: visibility, - mutability: mutability}); + rslt.push({ident: ident, + id: ast_util::local_def(field.node.id), + vis: visibility, + mutability: mutability}); } unnamed_field => {} } @@ -3747,7 +3747,7 @@ fn class_item_fields(cx:ctxt, for lookup_class_fields(cx, did).each |f| { // consider all instance vars mut, because the // constructor may mutate all vars - vec::push(rslt, {ident: f.ident, mt: + rslt.push({ident: f.ident, mt: {ty: lookup_field_type(cx, did, f.id, substs), mutbl: frob_mutability(f.mutability)}}); } diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index 8d2384cd530..bc7711c059b 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -818,7 +818,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> (ty::t, uint) { if vec::contains(enum_dids, did) { return (t1, autoderefs); } - vec::push(enum_dids, did); + enum_dids.push(did); } _ => { /*ok*/ } } @@ -2029,8 +2029,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, let name = class_field.ident; let (_, seen) = class_field_map.get(name); if !seen { - vec::push(missing_fields, - ~"`" + tcx.sess.str_of(name) + ~"`"); + missing_fields.push( + ~"`" + tcx.sess.str_of(name) + ~"`"); } } @@ -2298,7 +2298,7 @@ fn check_enum_variants(ccx: @crate_ctxt, ccx.tcx.sess.span_err(v.span, ~"discriminator value already exists"); } - vec::push(*disr_vals, *disr_val); + disr_vals.push(*disr_val); let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id); let arg_tys; @@ -2321,7 +2321,8 @@ fn check_enum_variants(ccx: @crate_ctxt, match arg_tys { None => {} Some(arg_tys) => { - vec::push(*variants, @{args: arg_tys, ctor_ty: ctor_ty, + variants.push( + @{args: arg_tys, ctor_ty: ctor_ty, name: v.node.name, id: local_def(v.node.id), disr_val: this_disr_val}); } diff --git a/src/rustc/middle/typeck/check/regionmanip.rs b/src/rustc/middle/typeck/check/regionmanip.rs index d969ce908f0..aec42f77048 100644 --- a/src/rustc/middle/typeck/check/regionmanip.rs +++ b/src/rustc/middle/typeck/check/regionmanip.rs @@ -27,13 +27,13 @@ fn replace_bound_regions_in_fn_ty( let region = ty::re_bound(ty::br_self); let ty = ty::mk_rptr(tcx, region, { ty: ty::mk_self(tcx), mutbl: m }); - vec::push(all_tys, ty); + all_tys.push(ty); } _ => {} } - for self_ty.each |t| { vec::push(all_tys, *t) } + for self_ty.each |t| { all_tys.push(*t) } debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \ all_tys=%?)", diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs index d48f5b9c070..453559e5e42 100644 --- a/src/rustc/middle/typeck/check/vtable.rs +++ b/src/rustc/middle/typeck/check/vtable.rs @@ -51,8 +51,8 @@ fn lookup_vtables(fcx: @fn_ctxt, match *bound { ty::bound_trait(i_ty) => { let i_ty = ty::subst(tcx, substs, i_ty); - vec::push(result, lookup_vtable(fcx, expr, *ty, i_ty, - allow_unsafe, is_early)); + result.push(lookup_vtable(fcx, expr, *ty, i_ty, + allow_unsafe, is_early)); } _ => () } @@ -331,9 +331,9 @@ fn lookup_vtable(fcx: @fn_ctxt, // the impl as well as the resolved list // of type substitutions for the target // trait. - vec::push(found, - vtable_static(im.did, substs_f.tps, - subres)); + found.push( + vtable_static(im.did, substs_f.tps, + subres)); } } } diff --git a/src/rustc/middle/typeck/check/writeback.rs b/src/rustc/middle/typeck/check/writeback.rs index a70e5f600d3..33a26c8daf4 100644 --- a/src/rustc/middle/typeck/check/writeback.rs +++ b/src/rustc/middle/typeck/check/writeback.rs @@ -94,7 +94,7 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id) let mut new_tps = ~[]; for substs.tps.each |subst| { match resolve_type_vars_in_type(fcx, sp, *subst) { - Some(t) => vec::push(new_tps, t), + Some(t) => new_tps.push(t), None => { wbcx.success = false; return None; } } } diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs index 77c665755c3..907cdb4f5ec 100644 --- a/src/rustc/middle/typeck/coherence.rs +++ b/src/rustc/middle/typeck/coherence.rs @@ -198,7 +198,7 @@ impl CoherenceChecker { existing trait", sess.str_of(mi.ident)); let mut method_infos = mis; - push(method_infos, mi); + method_infos.push(mi); pmm.insert(item.id, method_infos); } None => { @@ -547,7 +547,7 @@ impl CoherenceChecker { debug!( "(creating impl) adding provided method `%s` to impl", sess.str_of(provided_method.ident)); - push(methods, *provided_method); + methods.push(*provided_method); } } @@ -559,8 +559,7 @@ impl CoherenceChecker { let mut methods = ~[]; for ast_methods.each |ast_method| { - push(methods, - method_to_MethodInfo(*ast_method)); + methods.push(method_to_MethodInfo(*ast_method)); } // For each trait that the impl implements, see what @@ -619,7 +618,7 @@ impl CoherenceChecker { -> @Impl { let mut methods = ~[]; for struct_def.methods.each |ast_method| { - push(methods, @{ + methods.push(@{ did: local_def(ast_method.id), n_tps: ast_method.tps.len(), ident: ast_method.ident, diff --git a/src/rustc/middle/typeck/infer/region_var_bindings.rs b/src/rustc/middle/typeck/infer/region_var_bindings.rs index c0312872488..8eabb2c0787 100644 --- a/src/rustc/middle/typeck/infer/region_var_bindings.rs +++ b/src/rustc/middle/typeck/infer/region_var_bindings.rs @@ -830,7 +830,7 @@ impl RegionVarBindings { // It would be nice to write this using map(): let mut edges = vec::with_capacity(num_edges); for self.constraints.each_ref |constraint, span| { - vec::push(edges, GraphEdge { + edges.push(GraphEdge { next_edge: [mut uint::max_value, uint::max_value], constraint: *constraint, span: *span @@ -1201,13 +1201,13 @@ impl RegionVarBindings { Outgoing => to_vid }; if set.insert(*vid, ()) { - vec::push(stack, vid); + stack.push(vid); } } ConstrainRegSubVar(region, _) => { assert dir == Incoming; - vec::push(result, SpannedRegion { + result.push(SpannedRegion { region: region, span: edge.span }); @@ -1215,7 +1215,7 @@ impl RegionVarBindings { ConstrainVarSubReg(_, region) => { assert dir == Outgoing; - vec::push(result, SpannedRegion { + result.push(SpannedRegion { region: region, span: edge.span }); diff --git a/src/rustc/middle/typeck/infer/resolve.rs b/src/rustc/middle/typeck/infer/resolve.rs index 5d748efc332..a366a2ef1c7 100644 --- a/src/rustc/middle/typeck/infer/resolve.rs +++ b/src/rustc/middle/typeck/infer/resolve.rs @@ -174,7 +174,7 @@ impl resolve_state { self.err = Some(cyclic_ty(vid)); return ty::mk_var(self.infcx.tcx, vid); } else { - vec::push(self.v_seen, vid); + self.v_seen.push(vid); let tcx = self.infcx.tcx; // Nonobvious: prefer the most specific type diff --git a/src/rustc/middle/typeck/infer/unify.rs b/src/rustc/middle/typeck/infer/unify.rs index 500a4d5b419..7ccbaa40ada 100644 --- a/src/rustc/middle/typeck/infer/unify.rs +++ b/src/rustc/middle/typeck/infer/unify.rs @@ -51,7 +51,7 @@ impl infer_ctxt { +new_v: var_value<V, T>) { let old_v = vb.vals.get(vid.to_uint()); - vec::push(vb.bindings, (vid, old_v)); + vb.bindings.push((vid, old_v)); vb.vals.insert(vid.to_uint(), new_v); debug!("Updating variable %s from %s to %s", diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs index 4c033515b9a..37cc016e8ea 100644 --- a/src/rustc/util/common.rs +++ b/src/rustc/util/common.rs @@ -36,7 +36,7 @@ fn field_expr(f: ast::field) -> @ast::expr { return f.node.expr; } fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] { let mut es = ~[]; - for fields.each |f| { vec::push(es, f.node.expr); } + for fields.each |f| { es.push(f.node.expr); } return es; } diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs index 0498a0f9541..0df5827ed3d 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -286,7 +286,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str { } s += ~"("; let mut strs = ~[]; - for inputs.each |a| { vec::push(strs, fn_input_to_str(cx, *a)); } + for inputs.each |a| { strs.push(fn_input_to_str(cx, *a)); } s += str::connect(strs, ~", "); s += ~")"; if ty::get(output).sty != ty_nil { @@ -342,12 +342,12 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str { ty_type => ~"type", ty_rec(elems) => { let mut strs: ~[~str] = ~[]; - for elems.each |fld| { vec::push(strs, field_to_str(cx, *fld)); } + for elems.each |fld| { strs.push(field_to_str(cx, *fld)); } ~"{" + str::connect(strs, ~",") + ~"}" } ty_tup(elems) => { let mut strs = ~[]; - for elems.each |elem| { vec::push(strs, ty_to_str(cx, *elem)); } + for elems.each |elem| { strs.push(ty_to_str(cx, *elem)); } ~"(" + str::connect(strs, ~",") + ~")" } ty_fn(ref f) => { |
