diff options
Diffstat (limited to 'src/comp')
47 files changed, 479 insertions, 484 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index f93107d6a17..5d58fe21961 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -7,7 +7,7 @@ import metadata::encoder; import middle::trans_common::crate_ctxt; import std::str; import std::fs; -import std::ivec; +import std::vec; import std::option; import option::some; import option::none; @@ -358,8 +358,8 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str, { let os = str::split(fs::basename(output), '.' as u8); - assert (ivec::len(os) >= 2u); - ivec::pop(os); + assert (vec::len(os) >= 2u); + vec::pop(os); str::connect(os, ".") }; warn_missing(sess, "name", name); diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index e6324aa73d6..9a3f528600b 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -27,7 +27,7 @@ import std::option; import std::option::some; import std::option::none; import std::str; -import std::ivec; +import std::vec; import std::int; import std::io; import std::run; @@ -441,8 +441,8 @@ fn opts() -> [getopts::opt] { } fn main(args: vec[str]) { - let args_ivec = ivec::from_vec(args); - let binary = ivec::shift(args_ivec); + let args_ivec = vec::from_vec(args); + let binary = vec::shift(args_ivec); let binary_dir = fs::dirname(binary); let match = alt getopts::getopts(args_ivec, opts()) { @@ -462,7 +462,7 @@ fn main(args: vec[str]) { } let sopts = build_session_options(binary, match, binary_dir); let sess = build_session(sopts); - let n_inputs = ivec::len[str](match.free); + let n_inputs = vec::len[str](match.free); let output_file = getopts::opt_maybe_str(match, "o"); let glue = opt_present(match, "glue"); if glue { @@ -523,7 +523,7 @@ fn main(args: vec[str]) { } else { ~["default", "rs"] }; - ivec::pop(parts); + vec::pop(parts); saved_out_filename = str::connect(parts, "."); let suffix = alt sopts.output_type { link::output_type_none. { "none" } @@ -580,7 +580,7 @@ fn main(args: vec[str]) { }(config, _); fn rmext(filename: str) -> str { let parts = str::split(filename, '.' as u8); - ivec::pop(parts); + vec::pop(parts); ret str::connect(parts, "."); } ret alt config.os { @@ -639,8 +639,6 @@ fn main(args: vec[str]) { #[cfg(test)] mod test { - import std::ivec; - // When the user supplies --test we should implicitly supply --cfg test #[test] fn test_switch_implies_cfg_test() { @@ -666,7 +664,7 @@ mod test { let sess = build_session(sessopts); let cfg = build_configuration(sess, "whatever", "whatever"); let test_items = attr::find_meta_items_by_name(cfg, "test"); - assert (ivec::len(test_items) == 1u); + assert (vec::len(test_items) == 1u); } } diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 6a12972affd..48a33b4dd19 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -1,6 +1,6 @@ // Functions dealing with attributes and meta_items -import std::ivec; +import std::vec; import std::str; import std::map; import std::option; @@ -50,7 +50,7 @@ fn find_attrs_by_name(attrs: &[ast::attribute], name: ast::ident) -> option::some(a) } else { option::none } }(_, name); - ret ivec::filter_map(filter, attrs); + ret vec::filter_map(filter, attrs); } fn get_attr_name(attr: &ast::attribute) -> ast::ident { @@ -66,7 +66,7 @@ fn find_meta_items_by_name(metas: &[@ast::meta_item], name: ast::ident) -> option::some(m) } else { option::none } }(_, name); - ret ivec::filter_map(filter, metas); + ret vec::filter_map(filter, metas); } fn get_meta_item_name(meta: &@ast::meta_item) -> ast::ident { @@ -135,7 +135,7 @@ fn contains(haystack: &[@ast::meta_item], needle: @ast::meta_item) -> bool { fn contains_name(metas: &[@ast::meta_item], name: ast::ident) -> bool { let matches = find_meta_items_by_name(metas, name); - ret ivec::len(matches) > 0u; + ret vec::len(matches) > 0u; } // FIXME: This needs to sort by meta_item variant in addition to the item name @@ -173,7 +173,7 @@ fn remove_meta_items_by_name(items: &[@ast::meta_item], name: str) -> } else { option::none } }(_, name); - ret ivec::filter_map(filter, items); + ret vec::filter_map(filter, items); } fn require_unique_names(sess: &session::session, diff --git a/src/comp/front/config.rs b/src/comp/front/config.rs index b65b221cae4..42d55688c1d 100644 --- a/src/comp/front/config.rs +++ b/src/comp/front/config.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::option; import syntax::ast; import syntax::fold; @@ -32,9 +32,9 @@ fn filter_item(cfg: &ast::crate_cfg, item: &@ast::item) -> fn fold_mod(cfg: &ast::crate_cfg, m: &ast::_mod, fld: fold::ast_fold) -> ast::_mod { let filter = bind filter_item(cfg, _); - let filtered_items = ivec::filter_map(filter, m.items); - ret {view_items: ivec::map(fld.fold_view_item, m.view_items), - items: ivec::map(fld.fold_item, filtered_items)}; + let filtered_items = vec::filter_map(filter, m.items); + ret {view_items: vec::map(fld.fold_view_item, m.view_items), + items: vec::map(fld.fold_item, filtered_items)}; } fn filter_native_item(cfg: &ast::crate_cfg, item: &@ast::native_item) -> @@ -47,10 +47,10 @@ fn filter_native_item(cfg: &ast::crate_cfg, item: &@ast::native_item) -> fn fold_native_mod(cfg: &ast::crate_cfg, nm: &ast::native_mod, fld: fold::ast_fold) -> ast::native_mod { let filter = bind filter_native_item(cfg, _); - let filtered_items = ivec::filter_map(filter, nm.items); + let filtered_items = vec::filter_map(filter, nm.items); ret {native_name: nm.native_name, abi: nm.abi, - view_items: ivec::map(fld.fold_view_item, nm.view_items), + view_items: vec::map(fld.fold_view_item, nm.view_items), items: filtered_items}; } @@ -74,8 +74,8 @@ fn filter_stmt(cfg: &ast::crate_cfg, stmt: &@ast::stmt) -> fn fold_block(cfg: &ast::crate_cfg, b: &ast::blk_, fld: fold::ast_fold) -> ast::blk_ { let filter = bind filter_stmt(cfg, _); - let filtered_stmts = ivec::filter_map(filter, b.stmts); - ret {stmts: ivec::map(fld.fold_stmt, filtered_stmts), + let filtered_stmts = vec::filter_map(filter, b.stmts); + ret {stmts: vec::map(fld.fold_stmt, filtered_stmts), expr: option::map(fld.fold_expr, b.expr), id: b.id}; } @@ -95,7 +95,7 @@ fn in_cfg(cfg: &ast::crate_cfg, attrs: &[ast::attribute]) -> bool { // The "cfg" attributes on the item let item_cfg_attrs = attr::find_attrs_by_name(attrs, "cfg"); - let item_has_cfg_attrs = ivec::len(item_cfg_attrs) > 0u; + let item_has_cfg_attrs = vec::len(item_cfg_attrs) > 0u; if !item_has_cfg_attrs { ret true; } // Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes, @@ -115,7 +115,7 @@ fn in_cfg(cfg: &ast::crate_cfg, attrs: &[ast::attribute]) -> bool { } } let cfg_metas = attr::attr_metas(item_cfg_attrs); - ivec::foldl(extract_metas, ~[], cfg_metas) + vec::foldl(extract_metas, ~[], cfg_metas) }; for cfg_mi: @ast::meta_item in item_cfg_metas { diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 77cf7e3daed..309d2e21777 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -1,7 +1,7 @@ // Code that generates a test runner to run all the tests in a crate import std::option; -import std::ivec; +import std::vec; import syntax::ast; import syntax::fold; import syntax::print::pprust; @@ -69,7 +69,7 @@ fn fold_mod(cx: &test_ctxt, m: &ast::_mod, fld: fold::ast_fold) -> ast::_mod { } let mod_nomain = - {view_items: m.view_items, items: ivec::filter_map(nomain, m.items)}; + {view_items: m.view_items, items: vec::filter_map(nomain, m.items)}; ret fold::noop_fold_mod(mod_nomain, fld); } @@ -93,24 +93,24 @@ fn fold_item(cx: &test_ctxt, i: &@ast::item, fld: fold::ast_fold) -> log "this is a test function"; let test = {path: cx.path, ignore: is_ignored(i)}; cx.testfns += ~[test]; - log #fmt("have %u test functions", ivec::len(cx.testfns)); + log #fmt("have %u test functions", vec::len(cx.testfns)); } let res = fold::noop_fold_item(i, fld); - ivec::pop(cx.path); + vec::pop(cx.path); ret res; } fn is_test_fn(i: &@ast::item) -> bool { let has_test_attr = - ivec::len(attr::find_attrs_by_name(i.attrs, "test")) > 0u; + vec::len(attr::find_attrs_by_name(i.attrs, "test")) > 0u; fn has_test_signature(i: &@ast::item) -> bool { alt i.node { ast::item_fn(f, tps) { - let input_cnt = ivec::len(f.decl.inputs); + let input_cnt = vec::len(f.decl.inputs); let no_output = f.decl.output.node == ast::ty_nil; - let tparm_cnt = ivec::len(tps); + let tparm_cnt = vec::len(tps); input_cnt == 0u && no_output && tparm_cnt == 0u } _ { false } @@ -227,7 +227,7 @@ fn mk_test_desc_ivec_ty(cx: &test_ctxt) -> @ast::ty { } fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr { - log #fmt("building test vector from %u tests", ivec::len(cx.testfns)); + log #fmt("building test vector from %u tests", vec::len(cx.testfns)); let descs = ~[]; for test: test in cx.testfns { let test_ = test; // Satisfy alias analysis diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index cefff79f0b5..3c22299b19c 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::str; import std::str::rustrt::sbuf; @@ -928,8 +928,8 @@ obj builder(B: BuilderRef, terminated: @mutable bool, fn AggregateRet(RetVals: &[ValueRef]) -> ValueRef { assert (!*terminated); *terminated = true; - ret llvm::LLVMBuildAggregateRet(B, ivec::to_ptr(RetVals), - ivec::len(RetVals)); + ret llvm::LLVMBuildAggregateRet(B, vec::to_ptr(RetVals), + vec::len(RetVals)); } fn Br(Dest: BasicBlockRef) -> ValueRef { @@ -961,7 +961,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, Catch: BasicBlockRef) -> ValueRef { assert (!*terminated); *terminated = true; - ret llvm::LLVMBuildInvoke(B, Fn, ivec::to_ptr(Args), ivec::len(Args), + ret llvm::LLVMBuildInvoke(B, Fn, vec::to_ptr(Args), vec::len(Args), Then, Catch, str::buf("")); } @@ -1163,14 +1163,14 @@ obj builder(B: BuilderRef, terminated: @mutable bool, fn GEP(Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef { assert (!*terminated); - ret llvm::LLVMBuildGEP(B, Pointer, ivec::to_ptr(Indices), - ivec::len(Indices), str::buf("")); + ret llvm::LLVMBuildGEP(B, Pointer, vec::to_ptr(Indices), + vec::len(Indices), str::buf("")); } fn InBoundsGEP(Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef { assert (!*terminated); - ret llvm::LLVMBuildInBoundsGEP(B, Pointer, ivec::to_ptr(Indices), - ivec::len(Indices), str::buf("")); + ret llvm::LLVMBuildInBoundsGEP(B, Pointer, vec::to_ptr(Indices), + vec::len(Indices), str::buf("")); } fn StructGEP(Pointer: ValueRef, Idx: uint) -> ValueRef { @@ -1303,29 +1303,29 @@ obj builder(B: BuilderRef, terminated: @mutable bool, ValueRef { assert (!*terminated); let phi = llvm::LLVMBuildPhi(B, Ty, str::buf("")); - assert (ivec::len[ValueRef](vals) == ivec::len[BasicBlockRef](bbs)); - llvm::LLVMAddIncoming(phi, ivec::to_ptr(vals), ivec::to_ptr(bbs), - ivec::len(vals)); + assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs)); + llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs), + vec::len(vals)); ret phi; } fn AddIncomingToPhi(phi: ValueRef, vals: &[ValueRef], bbs: &[BasicBlockRef]) { - assert (ivec::len[ValueRef](vals) == ivec::len[BasicBlockRef](bbs)); - llvm::LLVMAddIncoming(phi, ivec::to_ptr(vals), ivec::to_ptr(bbs), - ivec::len(vals)); + assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs)); + llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs), + vec::len(vals)); } fn Call(Fn: ValueRef, Args: &[ValueRef]) -> ValueRef { assert (!*terminated); - ret llvm::LLVMBuildCall(B, Fn, ivec::to_ptr(Args), ivec::len(Args), + ret llvm::LLVMBuildCall(B, Fn, vec::to_ptr(Args), vec::len(Args), str::buf("")); } fn FastCall(Fn: ValueRef, Args: &[ValueRef]) -> ValueRef { assert (!*terminated); let v = - llvm::LLVMBuildCall(B, Fn, ivec::to_ptr(Args), ivec::len(Args), + llvm::LLVMBuildCall(B, Fn, vec::to_ptr(Args), vec::len(Args), str::buf("")); llvm::LLVMSetInstructionCallConv(v, LLVMFastCallConv); ret v; @@ -1334,7 +1334,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, fn CallWithConv(Fn: ValueRef, Args: &[ValueRef], Conv: uint) -> ValueRef { assert (!*terminated); let v = - llvm::LLVMBuildCall(B, Fn, ivec::to_ptr(Args), ivec::len(Args), + llvm::LLVMBuildCall(B, Fn, vec::to_ptr(Args), vec::len(Args), str::buf("")); llvm::LLVMSetInstructionCallConv(v, Conv); ret v; @@ -1403,7 +1403,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, llvm::LLVMGetNamedFunction(M, str::buf("llvm.trap")); assert (T as int != 0); let Args: [ValueRef] = ~[]; - ret llvm::LLVMBuildCall(B, T, ivec::to_ptr(Args), ivec::len(Args), + ret llvm::LLVMBuildCall(B, T, vec::to_ptr(Args), vec::len(Args), str::buf("")); } @@ -1503,8 +1503,8 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) -> let s = "fn("; let out_ty: TypeRef = llvm::LLVMGetReturnType(ty); let n_args: uint = llvm::LLVMCountParamTypes(ty); - let args: [TypeRef] = ivec::init_elt[TypeRef](0 as TypeRef, n_args); - llvm::LLVMGetParamTypes(ty, ivec::to_ptr(args)); + let args: [TypeRef] = vec::init_elt[TypeRef](0 as TypeRef, n_args); + llvm::LLVMGetParamTypes(ty, vec::to_ptr(args)); s += tys_str(names, outer, args); s += ") -> "; s += type_to_str_inner(names, outer, out_ty); @@ -1515,8 +1515,8 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) -> 9 { let s: str = "{"; let n_elts: uint = llvm::LLVMCountStructElementTypes(ty); - let elts: [TypeRef] = ivec::init_elt[TypeRef](0 as TypeRef, n_elts); - llvm::LLVMGetStructElementTypes(ty, ivec::to_ptr(elts)); + let elts: [TypeRef] = vec::init_elt[TypeRef](0 as TypeRef, n_elts); + llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts)); s += tys_str(names, outer, elts); s += "}"; ret s; @@ -1534,7 +1534,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) -> for tout: TypeRef in outer0 { i += 1u; if tout as int == ty as int { - let n: uint = ivec::len[TypeRef](outer0) - i; + let n: uint = vec::len[TypeRef](outer0) - i; ret "*\\" + std::int::str(n as int); } } @@ -1563,8 +1563,8 @@ fn float_width(llt: TypeRef) -> uint { } fn fn_ty_param_tys(fn_ty: TypeRef) -> [TypeRef] { - let args = ivec::init_elt(0 as TypeRef, llvm::LLVMCountParamTypes(fn_ty)); - llvm::LLVMGetParamTypes(fn_ty, ivec::to_ptr(args)); + let args = vec::init_elt(0 as TypeRef, llvm::LLVMCountParamTypes(fn_ty)); + llvm::LLVMGetParamTypes(fn_ty, vec::to_ptr(args)); ret args; } diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index 38cf9e619f3..e00ddb11be6 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -12,7 +12,7 @@ import syntax::visit; import syntax::codemap::span; import back::x86; import util::common; -import std::ivec; +import std::vec; import std::str; import std::fs; import std::io; @@ -94,7 +94,7 @@ fn metadata_matches(crate_data: &@[u8], metas: &[@ast::meta_item]) -> bool { let linkage_metas = attr::find_linkage_metas(attrs); log #fmt("matching %u metadata requirements against %u items", - ivec::len(metas), ivec::len(linkage_metas)); + vec::len(metas), vec::len(linkage_metas)); for needed: @ast::meta_item in metas { if !attr::contains(linkage_metas, needed) { @@ -126,7 +126,7 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident, // is using the wrong type of meta item let crate_name = { let name_items = attr::find_meta_items_by_name(metas, "name"); - alt ivec::last(name_items) { + alt vec::last(name_items) { some(i) { alt attr::get_meta_item_value_str(i) { some(n) { n } @@ -196,7 +196,7 @@ fn get_metadata_section(filename: str) -> option::t[@[u8]] { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi); let cvbuf: *u8 = std::unsafe::reinterpret_cast(cbuf); - ret option::some[@[u8]](@ivec::unsafe::from_buf(cvbuf, csz)); + ret option::some[@[u8]](@vec::unsafe::from_buf(cvbuf, csz)); } llvm::LLVMMoveToNextSection(si.llsi); } diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs index 1ee1e2d072b..e93b674bc32 100644 --- a/src/comp/metadata/cstore.rs +++ b/src/comp/metadata/cstore.rs @@ -1,7 +1,7 @@ // The crate store - a central repo for information collected about external // crates and libraries -import std::ivec; +import std::vec; import std::map; import std::str; import syntax::ast; @@ -83,7 +83,7 @@ iter iter_crate_data(cstore: &cstore) -> } fn add_used_crate_file(cstore: &cstore, lib: &str) { - if !ivec::member(lib, p(cstore).used_crate_files) { + if !vec::member(lib, p(cstore).used_crate_files) { p(cstore).used_crate_files += ~[lib]; } } @@ -95,7 +95,7 @@ fn get_used_crate_files(cstore: &cstore) -> [str] { fn add_used_library(cstore: &cstore, lib: &str) -> bool { if lib == "" { ret false; } - if ivec::member(lib, p(cstore).used_libraries) { ret false; } + if vec::member(lib, p(cstore).used_libraries) { ret false; } p(cstore).used_libraries += ~[lib]; ret true; diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index 2fadfaab7a7..d365d58fc60 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -1,7 +1,7 @@ // Decoding metadata from a single crate's metadata import std::ebml; -import std::ivec; +import std::vec; import std::option; import std::str; import std::io; @@ -48,7 +48,7 @@ fn lookup_hash(d: &ebml::doc, eq_fn: fn(&[u8]) -> bool , hash: uint) -> let belt = tag_index_buckets_bucket_elt; for each elt: ebml::doc in ebml::tagged_docs(bucket, belt) { let pos = ebml::be_uint_from_bytes(elt.data, elt.start, 4u); - if eq_fn(ivec::slice[u8](*elt.data, elt.start + 4u, elt.end)) { + if eq_fn(vec::slice[u8](*elt.data, elt.start + 4u, elt.end)) { result += ~[ebml::doc_at(d.data, pos)]; } } @@ -62,7 +62,7 @@ fn maybe_find_item(item_id: int, items: &ebml::doc) -> } let eqer = bind eq_item(_, item_id); let found = lookup_hash(items, eqer, hash_node_id(item_id)); - if ivec::len(found) == 0u { + if vec::len(found) == 0u { ret option::none[ebml::doc]; } else { ret option::some[ebml::doc](found.(0)); } } @@ -166,7 +166,7 @@ fn resolve_path(path: &[ast::ident], data: @[u8]) -> [ast::def_id] { // Crate metadata queries fn lookup_defs(data: &@[u8], cnum: ast::crate_num, path: &[ast::ident]) -> [ast::def] { - ret ivec::map(bind lookup_def(cnum, data, _), resolve_path(path, data)); + ret vec::map(bind lookup_def(cnum, data, _), resolve_path(path, data)); } @@ -213,7 +213,7 @@ fn get_type(data: @[u8], def: ast::def_id, tcx: &ty::ctxt, } fn get_type_param_count(data: @[u8], id: ast::node_id) -> uint { - ret ivec::len(get_type_param_kinds(data, id)); + ret vec::len(get_type_param_kinds(data, id)); } fn get_type_param_kinds(data: @[u8], id: ast::node_id) -> [ast::kind] { @@ -269,7 +269,7 @@ fn family_has_type_params(fam_ch: u8) -> bool { fn read_path(d: &ebml::doc) -> {path: str, pos: uint} { let desc = ebml::doc_data(d); let pos = ebml::be_uint_from_bytes(@desc, 0u, 4u); - let pathbytes = ivec::slice[u8](desc, 4u, ivec::len[u8](desc)); + let pathbytes = vec::slice[u8](desc, 4u, vec::len[u8](desc)); let path = str::unsafe_from_bytes(pathbytes); ret {path: path, pos: pos}; } @@ -331,7 +331,7 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] { let meta_items = get_meta_items(attr_doc); // Currently it's only possible to have a single meta item on // an attribute - assert (ivec::len(meta_items) == 1u); + assert (vec::len(meta_items) == 1u); let meta_item = meta_items.(0); attrs += ~[{node: {style: ast::attr_outer, value: *meta_item}, diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index 2976745327f..8cd1380784e 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -1,6 +1,6 @@ // Metadata encoding -import std::ivec; +import std::vec; import std::str; import std::uint; import std::io; @@ -176,7 +176,7 @@ fn def_to_str(did: &def_id) -> str { ret #fmt("%d:%d", did.crate, did.node); } fn encode_type_param_kinds(ebml_w: &ebml::writer, tps: &[ty_param]) { ebml::start_tag(ebml_w, tag_items_data_item_ty_param_kinds); - ebml::write_vint(ebml_w.writer, ivec::len[ty_param](tps)); + ebml::write_vint(ebml_w.writer, vec::len[ty_param](tps)); for tp: ty_param in tps { let c = alt tp.kind { kind_unique. { 'u' } @@ -236,7 +236,7 @@ fn encode_tag_variant_info(ecx: &@encode_ctxt, ebml_w: &ebml::writer, encode_tag_id(ebml_w, local_def(id)); encode_type(ecx, ebml_w, node_id_to_monotype(ecx.ccx.tcx, variant.node.id)); - if ivec::len[variant_arg](variant.node.args) > 0u { + if vec::len[variant_arg](variant.node.args) > 0u { encode_symbol(ecx, ebml_w, variant.node.id); } encode_discriminant(ecx, ebml_w, variant.node.id); @@ -563,9 +563,9 @@ fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) { // Return just the names fn name(kv: &numname) -> str { kv.ident } - // mutable -> immutable hack for ivec::map - let immpairs = ivec::slice(pairs, 0u, ivec::len(pairs)); - ret ivec::map(name, immpairs); + // mutable -> immutable hack for vec::map + let immpairs = vec::slice(pairs, 0u, vec::len(pairs)); + ret vec::map(name, immpairs); } // We're just going to write a list of crate names, with the assumption diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index d72d7b2c869..402855e34da 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -1,6 +1,6 @@ // Type decoding -import std::ivec; +import std::vec; import std::str; import std::uint; import std::option; @@ -409,14 +409,14 @@ fn parse_ty_fn(st: @pstate, sd: str_def) -> // Rust metadata parsing fn parse_def_id(buf: &[u8]) -> ast::def_id { let colon_idx = 0u; - let len = ivec::len[u8](buf); + let len = vec::len[u8](buf); while colon_idx < len && buf.(colon_idx) != ':' as u8 { colon_idx += 1u; } if colon_idx == len { log_err "didn't find ':' when parsing def id"; fail; } - let crate_part = ivec::slice[u8](buf, 0u, colon_idx); - let def_part = ivec::slice[u8](buf, colon_idx + 1u, len); + let crate_part = vec::slice[u8](buf, 0u, colon_idx); + let def_part = vec::slice[u8](buf, colon_idx + 1u, len); let crate_part_vec = ~[]; let def_part_vec = ~[]; diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index e7d15d71a3b..7969977e2b9 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -7,7 +7,7 @@ import ast::def_id; import syntax::codemap::span; import syntax::visit; import visit::vt; -import std::ivec; +import std::vec; import std::str; import std::option; import std::option::some; @@ -218,7 +218,7 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) -> } i += 1u; } - if ivec::len(unsafe_ts) > 0u { + if vec::len(unsafe_ts) > 0u { alt f.node { ast::expr_path(_) { if def_is_local(cx.tcx.def_map.get(f.id), true) { @@ -319,9 +319,9 @@ fn check_alt(cx: &ctx, input: &@ast::expr, arms: &[ast::arm], sc: &scope, for a: ast::arm in arms { let dnums = arm_defnums(a); let new_sc = sc; - if ivec::len(dnums) > 0u { + if vec::len(dnums) > 0u { new_sc = @(*sc + ~[@{root_vars: roots, - block_defnum: dnums.(ivec::len(dnums) - 1u), + block_defnum: dnums.(vec::len(dnums) - 1u), bindings: dnums, tys: forbidden_tp, depends_on: deps(sc, roots), @@ -343,7 +343,7 @@ fn check_for_each(cx: &ctx, local: &@ast::local, call: &@ast::expr, let data = check_call(cx, f, args, sc); let bindings = ast::pat_binding_ids(local.node.pat); let new_sc = @{root_vars: data.root_vars, - block_defnum: bindings.(ivec::len(bindings) - 1u), + block_defnum: bindings.(vec::len(bindings) - 1u), bindings: bindings, tys: data.unsafe_ts, depends_on: deps(sc, data.root_vars), @@ -376,7 +376,7 @@ fn check_for(cx: &ctx, local: &@ast::local, seq: &@ast::expr, blk: &ast::blk, } let bindings = ast::pat_binding_ids(local.node.pat); let new_sc = @{root_vars: root_def, - block_defnum: bindings.(ivec::len(bindings) - 1u), + block_defnum: bindings.(vec::len(bindings) - 1u), bindings: bindings, tys: unsafe, depends_on: deps(sc, root_def), @@ -399,7 +399,7 @@ fn check_var(cx: &ctx, ex: &@ast::expr, p: &ast::path, id: ast::node_id, r.ok = val_taken(ex.span, p); } } - } else if (ivec::member(my_defnum, r.bindings)) { + } else if (vec::member(my_defnum, r.bindings)) { test_scope(cx, sc, r, p); } } @@ -416,14 +416,14 @@ fn check_lval(cx: &@ctx, dest: &@ast::expr, sc: &scope, v: &vt[scope]) { "assigning to immutable obj field"); } for r: restrict in *sc { - if ivec::member(dnum, r.root_vars) { + if vec::member(dnum, r.root_vars) { r.ok = overwritten(dest.span, p); } } } _ { let root = expr_root(*cx, dest, false); - if ivec::len(*root.ds) == 0u { + if vec::len(*root.ds) == 0u { cx.tcx.sess.span_err(dest.span, "assignment to non-lvalue"); } else if (!root.ds.(0).mut) { let name = @@ -456,7 +456,7 @@ fn check_move_rhs(cx: &@ctx, src: &@ast::expr, sc: &scope, v: &vt[scope]) { let root = expr_root(*cx, src, false); // Not a path and no-derefs means this is a temporary. - if ivec::len(*root.ds) != 0u { + if vec::len(*root.ds) != 0u { cx.tcx.sess.span_err(src.span, "moving out of a data structure"); } } @@ -476,7 +476,7 @@ fn is_immutable_alias(cx: &ctx, sc: &scope, dnum: node_id) -> bool { _ { } } for r: restrict in *sc { - if ivec::member(dnum, r.bindings) { ret true; } + if vec::member(dnum, r.bindings) { ret true; } } ret false; } @@ -511,7 +511,7 @@ fn deps(sc: &scope, roots: &[node_id]) -> [uint] { let result = ~[]; for r: restrict in *sc { for dn: node_id in roots { - if ivec::member(dn, r.bindings) { result += ~[i]; } + if vec::member(dn, r.bindings) { result += ~[i]; } } i += 1u; } @@ -546,8 +546,8 @@ fn expr_root(cx: &ctx, ex: @ast::expr, autoderef: bool) -> } ty::ty_tag(did, tps) { let variants = ty::tag_variants(cx.tcx, did); - if ivec::len(variants) != 1u || - ivec::len(variants.(0).args) != 1u { + if vec::len(variants) != 1u || + vec::len(variants.(0).args) != 1u { break; } ds += ~[@{mut: false, kind: unbox, outer_t: t}]; diff --git a/src/comp/middle/check_alt.rs b/src/comp/middle/check_alt.rs index f891b82c453..630a3d6e160 100644 --- a/src/comp/middle/check_alt.rs +++ b/src/comp/middle/check_alt.rs @@ -126,7 +126,7 @@ fn is_refutable(tcx: &ty::ctxt, pat: &@pat) -> bool { } pat_tag(_, args) { let vdef = variant_def_ids(tcx.def_map.get(pat.id)); - if std::ivec::len(ty::tag_variants(tcx, vdef.tg)) != 1u { + if std::vec::len(ty::tag_variants(tcx, vdef.tg)) != 1u { ret true; } for p: @pat in args { diff --git a/src/comp/middle/freevars.rs b/src/comp/middle/freevars.rs index b0c42d5d2ac..12366d2aacb 100644 --- a/src/comp/middle/freevars.rs +++ b/src/comp/middle/freevars.rs @@ -3,7 +3,6 @@ import std::map; import std::map::*; -import std::ivec; import std::option; import std::int; import std::option::*; diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 4ff4e2c846f..e4333aab6f5 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -74,7 +74,7 @@ import syntax::ast; import syntax::visit; -import std::ivec; +import std::vec; import ast::kind; import ast::kind_unique; @@ -145,11 +145,11 @@ fn check_expr(tcx: &ty::ctxt, e: &@ast::expr) { // If we have typarams, we're calling an item; we need to check // that all the types we're supplying as typarams conform to the // typaram kind constraints on that item. - if ivec::len(tpt.params) != 0u { + if vec::len(tpt.params) != 0u { let callee_def = ast::def_id_of_def(tcx.def_map.get(callee.id)); let item_tk = ty::lookup_item_type(tcx, callee_def); let i = 0; - assert ivec::len(item_tk.kinds) == ivec::len(tpt.params); + assert vec::len(item_tk.kinds) == vec::len(tpt.params); for k_need: ast::kind in item_tk.kinds { let t = tpt.params.(i); let k = ty::type_kind(tcx, t); diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 76738fe8737..7a9b59357e4 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -19,7 +19,7 @@ import syntax::ast::respan; import middle::ty::constr_table; import syntax::visit; import visit::vt; -import std::ivec; +import std::vec; import std::int; import std::map::hashmap; import std::list; @@ -401,7 +401,7 @@ fn visit_expr_with_scope(x: &@ast::expr, sc: &scopes, v: &vt[scopes]) { fn follow_import(e: &env, sc: &scopes, path: &[ident], sp: &span) -> option::t[def] { - let path_len = ivec::len(path); + let path_len = vec::len(path); let dcur = lookup_in_scope_strict(e, sc, sp, path.(0), ns_module); let i = 1u; while true && option::is_some(dcur) { @@ -455,7 +455,7 @@ fn resolve_import(e: &env, it: &@ast::view_item, sc_in: &scopes) { } } e.imports.insert(defid.node, resolving(it.span)); - let n_idents = ivec::len(ids); + let n_idents = vec::len(ids); let end_id = ids.(n_idents - 1u); // Ignore the current scope if this import would shadow itself. let sc = @@ -573,7 +573,7 @@ fn mk_unresolved_msg(id: &ident, kind: &str) -> str { // Lookup helpers fn lookup_path_strict(e: &env, sc: &scopes, sp: &span, pth: &ast::path_, ns: namespace) -> option::t[def] { - let n_idents = ivec::len(pth.idents); + let n_idents = vec::len(pth.idents); let headns = if n_idents == 1u { ns } else { ns_module }; let first_scope; @@ -783,7 +783,7 @@ fn lookup_in_obj(name: &ident, ob: &ast::_obj, ty_params: &[ast::ty_param], fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint, ns: namespace) -> option::t[def] { - let i = ivec::len(b.stmts); + let i = vec::len(b.stmts); while i > 0u { i -= 1u; let st = b.stmts.(i); @@ -792,7 +792,7 @@ fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint, alt d.node { ast::decl_local(locs) { if i <= pos { - let j = ivec::len(locs); + let j = vec::len(locs); while j > 0u { j -= 1u; let loc = locs.(j); @@ -998,11 +998,11 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident, } let matches = - ivec::filter_map(bind lookup_in_mod_(e, _, sp, id, ns, dr), + vec::filter_map(bind lookup_in_mod_(e, _, sp, id, ns, dr), { info.glob_imports }); - if ivec::len(matches) == 0u { + if vec::len(matches) == 0u { ret none; - } else if (ivec::len(matches) == 1u) { + } else if (vec::len(matches) == 1u) { ret some(matches.(0).def); } else { for match: glob_imp_def in matches { @@ -1271,7 +1271,7 @@ fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt[()]) { let ch0 = checker(*e, "binding"); check_pat(ch0, a.pats.(0)); let seen0 = ch0.seen; - let i = ivec::len(a.pats); + let i = vec::len(a.pats); while i > 1u { i -= 1u; let ch = checker(*e, "binding"); @@ -1279,12 +1279,12 @@ fn check_arm(e: &@env, a: &ast::arm, x: &(), v: &vt[()]) { // Ensure the bindings introduced in this pattern are the same as in // the first pattern. - if ivec::len(ch.seen) != ivec::len(seen0) { + if vec::len(ch.seen) != vec::len(seen0) { e.sess.span_err(a.pats.(i).span, "inconsistent number of bindings"); } else { for name: ident in ch.seen { - if is_none(ivec::find(bind str::eq(name, _), seen0)) { + if is_none(vec::find(bind str::eq(name, _), seen0)) { // Fight the alias checker let name_ = name; e.sess.span_err(a.pats.(i).span, diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index bcd2dc48bbb..784df07ae4b 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -26,7 +26,7 @@ import syntax::codemap::span; import syntax::util::interner; import util::common; -import std::ivec; +import std::vec; import std::map::hashmap; import std::option::none; import std::option::some; @@ -138,10 +138,10 @@ fn largest_variants(ccx : &@crate_ctxt, tag_id : &ast::def_id) -> [uint] { // Throw out any variant that we know has size and alignment at least as // small as some other variant. let i = 0u; - while i < ivec::len(ranges) - 1u { + while i < vec::len(ranges) - 1u { if candidates.(i) { let j = i + 1u; - while (j < ivec::len(ranges)) { + while (j < vec::len(ranges)) { if candidates.(j) { if ranges.(i).size.bounded && ranges.(i).align.bounded && ranges.(j).size.bounded && @@ -166,7 +166,7 @@ fn largest_variants(ccx : &@crate_ctxt, tag_id : &ast::def_id) -> [uint] { // Return the resulting set. let result = ~[]; i = 0u; - while i < ivec::len(candidates) { + while i < vec::len(candidates) { if candidates.(i) { result += ~[i]; } i += 1u; } @@ -208,7 +208,7 @@ fn compute_static_tag_size(ccx : &@crate_ctxt, largest_variants : &[uint], // Add space for the tag if applicable. // FIXME (issue #792): This is wrong. If the tag starts with an 8 byte // aligned quantity, we don't align it. - if ivec::len(variants) > 1u { + if vec::len(variants) > 1u { max_size += 4u16; max_align = 4u8; } @@ -224,11 +224,11 @@ tag tag_kind { fn tag_kind(ccx : &@crate_ctxt, did : &ast::def_id) -> tag_kind { let variants = ty::tag_variants(ccx.tcx, did); - if ivec::len(variants) == 0u { ret tk_complex; } + if vec::len(variants) == 0u { ret tk_complex; } for v : ty::variant_info in variants { - if ivec::len(v.args) > 0u { ret tk_complex; } + if vec::len(v.args) > 0u { ret tk_complex; } } - if ivec::len(variants) == 1u { ret tk_unit; } + if vec::len(variants) == 1u { ret tk_unit; } ret tk_enum; } @@ -272,7 +272,7 @@ fn add_u16(dest : &mutable [u8], val : u16) { } fn add_substr(dest : &mutable [u8], src : &[u8]) { - add_u16(dest, ivec::len(src) as u16); + add_u16(dest, vec::len(src) as u16); dest += src; } @@ -326,10 +326,10 @@ fn shape_of(ccx : &@crate_ctxt, t : ty::t) -> [u8] { } add_u16(sub, id as u16); - add_u16(sub, ivec::len(tps) as u16); + add_u16(sub, vec::len(tps) as u16); for tp : ty::t in tps { let subshape = shape_of(ccx, tp); - add_u16(sub, ivec::len(subshape) as u16); + add_u16(sub, vec::len(subshape) as u16); sub += subshape; } @@ -388,7 +388,7 @@ fn shape_of(ccx : &@crate_ctxt, t : ty::t) -> [u8] { s += ~[shape_res]; add_u16(s, id as u16); - add_u16(s, ivec::len(tps) as u16); + add_u16(s, vec::len(tps) as u16); let sub = ~[]; for tp : ty::t in tps { add_substr(s, sub); } @@ -429,12 +429,12 @@ fn gen_tag_shapes(ccx : &@crate_ctxt) -> ValueRef { // must do this first. let i = 0u; let data = ~[]; let offsets = ~[]; - while (i < ivec::len(ccx.shape_cx.tag_order)) { + while (i < vec::len(ccx.shape_cx.tag_order)) { let did = ccx.shape_cx.tag_order.(i); let variants = ty::tag_variants(ccx.tcx, did); for v : ty::variant_info in variants { - offsets += ~[ivec::len(data) as u16]; + offsets += ~[vec::len(data) as u16]; let variant_shape = shape_of_variant(ccx, v); add_substr(data, variant_shape); @@ -449,14 +449,14 @@ fn gen_tag_shapes(ccx : &@crate_ctxt) -> ValueRef { let header = ~[]; let info = ~[]; let header_sz = 2u16 * ccx.shape_cx.next_tag_id; - let data_sz = ivec::len(data) as u16; + let data_sz = vec::len(data) as u16; let info_sz = 0u16; for did_ : ast::def_id in ccx.shape_cx.tag_order { let did = did_; // Satisfy alias checker. let variants = ty::tag_variants(ccx.tcx, did); add_u16(header, header_sz + info_sz); - info_sz += 2u16 * ((ivec::len(variants) as u16) + 2u16) + 3u16; + info_sz += 2u16 * ((vec::len(variants) as u16) + 2u16) + 3u16; } // Construct the info tables, which contain offsets to the shape of each @@ -468,14 +468,14 @@ fn gen_tag_shapes(ccx : &@crate_ctxt) -> ValueRef { for did_ : ast::def_id in ccx.shape_cx.tag_order { let did = did_; // Satisfy alias checker. let variants = ty::tag_variants(ccx.tcx, did); - add_u16(info, ivec::len(variants) as u16); + add_u16(info, vec::len(variants) as u16); // Construct the largest-variants table. add_u16(info, header_sz + info_sz + data_sz + - (ivec::len(lv_table) as u16)); + (vec::len(lv_table) as u16)); let lv = largest_variants(ccx, did); - add_u16(lv_table, ivec::len(lv) as u16); + add_u16(lv_table, vec::len(lv) as u16); for v : uint in lv { add_u16(lv_table, v as u16); } // Determine whether the tag has dynamic size. @@ -504,10 +504,10 @@ fn gen_tag_shapes(ccx : &@crate_ctxt) -> ValueRef { } } - assert (i == ivec::len(offsets)); - assert (header_sz == (ivec::len(header) as u16)); - assert (info_sz == (ivec::len(info) as u16)); - assert (data_sz == (ivec::len(data) as u16)); + assert (i == vec::len(offsets)); + assert (header_sz == (vec::len(header) as u16)); + assert (info_sz == (vec::len(info) as u16)); + assert (data_sz == (vec::len(data) as u16)); header += info; header += data; diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index e6f40709f38..c800b9327b0 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -262,7 +262,7 @@ fn type_of_inner(cx: &@crate_ctxt, sp: &span, t: &ty::t) -> TypeRef { fn type_of_tag(cx: &@crate_ctxt, sp: &span, did: &ast::def_id, t: &ty::t) -> TypeRef { - let degen = std::ivec::len(ty::tag_variants(cx.tcx, did)) == 1u; + let degen = std::vec::len(ty::tag_variants(cx.tcx, did)) == 1u; if ty::type_has_dynamic_size(cx.tcx, t) { if degen { ret T_i8(); } else { ret T_opaque_tag(cx.tn); } } else { @@ -279,7 +279,7 @@ fn type_of_ty_param_kinds_and_ty(lcx: @local_ctxt, sp: &span, alt ty::struct(lcx.ccx.tcx, tpt.ty) { ty::ty_fn(_, _, _, _, _) { let llfnty = type_of_fn_from_ty(lcx.ccx, sp, tpt.ty, - std::ivec::len(tpt.kinds)); + std::vec::len(tpt.kinds)); ret T_fn_pair(*lcx.ccx, llfnty); } _ { @@ -382,7 +382,7 @@ fn get_extern_const(externs: &hashmap[str, ValueRef], llmod: ModuleRef, fn get_simple_extern_fn(externs: &hashmap[str, ValueRef], llmod: ModuleRef, name: &str, n_args: int) -> ValueRef { - let inputs = std::ivec::init_elt[TypeRef](T_int(), n_args as uint); + let inputs = std::vec::init_elt[TypeRef](T_int(), n_args as uint); let output = T_int(); let t = T_fn(inputs, output); ret get_extern_fn(externs, llmod, name, lib::llvm::LLVMCCallConv, t); @@ -392,7 +392,7 @@ fn trans_native_call(b: &builder, glues: @glue_fns, lltaskptr: ValueRef, externs: &hashmap[str, ValueRef], tn: &type_names, llmod: ModuleRef, name: &str, pass_task: bool, args: &[ValueRef]) -> ValueRef { - let n: int = std::ivec::len[ValueRef](args) as int; + let n: int = std::vec::len[ValueRef](args) as int; let llnative: ValueRef = get_simple_extern_fn(externs, llmod, name, n); let call_args: [ValueRef] = ~[]; for a: ValueRef in args { call_args += ~[b.ZExtOrBitCast(a, T_int())]; } @@ -607,7 +607,7 @@ fn dynamic_size_of(cx: &@block_ctxt, t: ty::t) -> result { } let max_size_val = bcx.build.Load(max_size); let total_size = - if std::ivec::len(variants) != 1u { + if std::vec::len(variants) != 1u { bcx.build.Add(max_size_val, llsize_of(T_int())) } else { max_size_val }; ret rslt(bcx, total_size); @@ -715,7 +715,7 @@ fn GEP_tup_like(cx: &@block_ctxt, t: &ty::t, base: ValueRef, ixs: &[int]) -> fn split_type(ccx: &@crate_ctxt, t: &ty::t, ixs: &[int], n: uint) -> {prefix: [ty::t], target: ty::t} { - let len: uint = std::ivec::len[int](ixs); + let len: uint = std::vec::len[int](ixs); // We don't support 0-index or 1-index GEPs: The former is nonsense // and the latter would only be meaningful if we supported non-0 // values for the 0th index (we don't). @@ -957,8 +957,8 @@ fn get_derived_tydesc(cx: &@block_ctxt, t: &ty::t, escapes: bool, let bcx = new_raw_block_ctxt(cx.fcx, cx.fcx.llderivedtydescs); let n_params: uint = ty::count_ty_params(bcx_tcx(bcx), t); let tys = linearize_ty_params(bcx, t); - assert (n_params == std::ivec::len[uint](tys.params)); - assert (n_params == std::ivec::len[ValueRef](tys.descs)); + assert (n_params == std::vec::len[uint](tys.params)); + assert (n_params == std::vec::len[ValueRef](tys.descs)); let root_ti = get_static_tydesc(bcx, t, tys.params); static_ti = some[@tydesc_info](root_ti); lazily_emit_all_tydesc_glue(cx, static_ti); @@ -1017,7 +1017,7 @@ fn get_tydesc(cx: &@block_ctxt, orig_t: &ty::t, escapes: bool, // Is the supplied type a type param? If so, return the passed-in tydesc. alt ty::type_param(bcx_tcx(cx), t) { some(id) { - if id < std::ivec::len(cx.fcx.lltydescs) { + if id < std::vec::len(cx.fcx.lltydescs) { ret rslt(cx, cx.fcx.lltydescs.(id)); } else { @@ -1153,7 +1153,7 @@ fn make_generic_glue_inner(cx: &@local_ctxt, sp: &span, t: &ty::t, if ty::type_has_dynamic_size(cx.ccx.tcx, t) { llty = T_ptr(T_i8()); } else { llty = T_ptr(type_of(cx.ccx, sp, t)); } - let ty_param_count = std::ivec::len[uint](ty_params); + let ty_param_count = std::vec::len[uint](ty_params); let lltyparams = llvm::LLVMGetParam(llfn, 3u); let copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs); let lltydescs = ~[mutable]; @@ -1161,7 +1161,7 @@ fn make_generic_glue_inner(cx: &@local_ctxt, sp: &span, t: &ty::t, while p < ty_param_count { let llparam = copy_args_bcx.build.GEP(lltyparams, ~[C_int(p as int)]); llparam = copy_args_bcx.build.Load(llparam); - std::ivec::grow_set(lltydescs, ty_params.(p), 0 as ValueRef, llparam); + std::vec::grow_set(lltydescs, ty_params.(p), 0 as ValueRef, llparam); p += 1u; } @@ -1524,7 +1524,7 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: &ast::def_id, let val_llty = lib::llvm::fn_ty_param_tys(llvm::LLVMGetElementType (llvm::LLVMTypeOf(dtor_addr))) - .(std::ivec::len(args)); + .(std::vec::len(args)); let val_cast = cx.build.BitCast(val.val, val_llty); cx.build.FastCall(dtor_addr, args + ~[val_cast]); @@ -1800,7 +1800,7 @@ fn iter_structural_ty_full(cx: &@block_ctxt, av: ValueRef, t: &ty::t, fn iter_variant(cx: @block_ctxt, a_tup: ValueRef, variant: &ty::variant_info, tps: &[ty::t], tid: &ast::def_id, f: &val_and_ty_fn) -> result { - if std::ivec::len[ty::t](variant.args) == 0u { + if std::vec::len[ty::t](variant.args) == 0u { ret rslt(cx, C_nil()); } let fn_ty = variant.ctor_ty; @@ -1855,7 +1855,7 @@ fn iter_structural_ty_full(cx: &@block_ctxt, av: ValueRef, t: &ty::t, } ty::ty_tag(tid, tps) { let variants = ty::tag_variants(bcx_tcx(cx), tid); - let n_variants = std::ivec::len(variants); + let n_variants = std::vec::len(variants); // Cast the tags to types we can GEP into. if n_variants == 1u { @@ -3309,8 +3309,8 @@ fn autoderef(cx: &@block_ctxt, v: ValueRef, t: &ty::t) -> result_t { } ty::ty_tag(did, tps) { let variants = ty::tag_variants(ccx.tcx, did); - if std::ivec::len(variants) != 1u || - std::ivec::len(variants.(0).args) != 1u { + if std::vec::len(variants) != 1u || + std::vec::len(variants.(0).args) != 1u { break; } t1 = @@ -3387,13 +3387,13 @@ fn join_results(parent_cx: &@block_ctxt, t: TypeRef, ins: &[result]) -> bbs += ~[r.bcx.llbb]; } } - alt std::ivec::len[result](live) { + alt std::vec::len[result](live) { 0u { // No incoming edges are live, so we're in dead-code-land. // Arbitrarily pick the first dead edge, since the caller // is just going to propagate it outward. - assert (std::ivec::len[result](ins) >= 1u); + assert (std::vec::len[result](ins) >= 1u); ret ins.(0); } _ {/* fall through */ } @@ -3517,10 +3517,10 @@ fn build_environment(bcx: @block_ctxt, lltydescs: [ValueRef], // Make a vector that contains ty_param_count copies of tydesc_ty. // (We'll need room for that many tydescs in the closure.) - let ty_param_count = std::ivec::len(lltydescs); + let ty_param_count = std::vec::len(lltydescs); let tydesc_ty: ty::t = ty::mk_type(bcx_tcx(bcx)); let captured_tys: [ty::t] = - std::ivec::init_elt(tydesc_ty, ty_param_count); + std::vec::init_elt(tydesc_ty, ty_param_count); // Get all the types we've got (some of which we synthesized // ourselves) into a vector. The whole things ends up looking @@ -3662,7 +3662,7 @@ fn load_environment(enclosing_cx: &@block_ctxt, fcx: &@fn_ctxt, // Populate the type parameters from the environment. We need to // do this first because the tydescs are needed to index into // the bindings if they are dynamically sized. - let tydesc_count = std::ivec::len(enclosing_cx.fcx.lltydescs); + let tydesc_count = std::vec::len(enclosing_cx.fcx.lltydescs); let lltydescs = find_environment_tydescs(bcx, envty, llclosure); let i = 0u; while i < tydesc_count { @@ -3865,7 +3865,7 @@ fn lval_generic_fn(cx: &@block_ctxt, tpt: &ty::ty_param_kinds_and_ty, lv = lval_val(cx, trans_external_path(cx, fn_id, tpt)); } let tys = ty::node_id_to_type_params(bcx_tcx(cx), id); - if std::ivec::len[ty::t](tys) != 0u { + if std::vec::len[ty::t](tys) != 0u { let bcx = lv.res.bcx; let tydescs: [ValueRef] = ~[]; let tis: [option::t[@tydesc_info]] = ~[]; @@ -3946,7 +3946,7 @@ fn trans_var(cx: &@block_ctxt, sp: &span, id: ast::node_id) -> let lltagty = type_of_tag(ccx, sp, tid, tag_ty); let bcx = alloc_result.bcx; let lltagptr = bcx.build.PointerCast(lltagblob, T_ptr(lltagty)); - if std::ivec::len(ty::tag_variants(ccx.tcx, tid)) != 1u { + if std::vec::len(ty::tag_variants(ccx.tcx, tid)) != 1u { let lldiscrim_gv = lookup_discriminant(bcx.fcx.lcx, tid, vid); let lldiscrim = bcx.build.Load(lldiscrim_gv); let lldiscrimptr = @@ -4165,8 +4165,8 @@ fn trans_lval(cx: &@block_ctxt, e: &@ast::expr) -> lval_result { alt lv.generic { some(gi) { let t = ty::expr_ty(bcx_tcx(cx), e); - let n_args = std::ivec::len(ty::ty_fn_args(bcx_tcx(cx), t)); - let args = std::ivec::init_elt(none[@ast::expr], n_args); + let n_args = std::vec::len(ty::ty_fn_args(bcx_tcx(cx), t)); + let args = std::vec::init_elt(none[@ast::expr], n_args); let bound = trans_bind_1(lv.res.bcx, e, lv, args, e.id); ret lval_val(bound.bcx, bound.val); } @@ -4463,8 +4463,8 @@ fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result, } } - let ty_param_count = std::ivec::len(lltydescs); - if std::ivec::len(bound) == 0u && ty_param_count == 0u { + let ty_param_count = std::vec::len(lltydescs); + if std::vec::len(bound) == 0u && ty_param_count == 0u { // Trivial 'binding': just return the static pair-ptr. ret f_res.res; } @@ -4794,7 +4794,7 @@ fn trans_vec(cx: &@block_ctxt, args: &[@ast::expr], id: ast::node_id) -> let unit_sz = size_of(bcx, unit_ty); bcx = unit_sz.bcx; let data_sz = - bcx.build.Mul(C_uint(std::ivec::len[@ast::expr](args)), unit_sz.val); + bcx.build.Mul(C_uint(std::vec::len[@ast::expr](args)), unit_sz.val); // FIXME: pass tydesc properly. let vec_val = @@ -4807,8 +4807,8 @@ fn trans_vec(cx: &@block_ctxt, args: &[@ast::expr], id: ast::node_id) -> let body = bcx.build.GEP(vec_val, ~[C_int(0), C_int(abi::vec_elt_data)]); let pseudo_tup_ty = ty::mk_tup(bcx_tcx(cx), - std::ivec::init_elt[ty::t](unit_ty, - std::ivec::len(args))); + std::vec::init_elt[ty::t](unit_ty, + std::vec::len(args))); let i: int = 0; for e: @ast::expr in args { let src = trans_lval(bcx, e); @@ -4860,12 +4860,12 @@ fn trans_ivec(bcx: @block_ctxt, args: &[@ast::expr], id: ast::node_id) -> add_clean_temp(bcx, llvecptr, typ); - let lllen = bcx.build.Mul(C_uint(std::ivec::len(args)), unit_sz); + let lllen = bcx.build.Mul(C_uint(std::vec::len(args)), unit_sz); // Allocate the vector pieces and store length and allocated length. let llfirsteltptr; - if std::ivec::len(args) > 0u && - std::ivec::len(args) <= abi::ivec_default_length { + if std::vec::len(args) > 0u && + std::vec::len(args) <= abi::ivec_default_length { // Interior case. bcx.build.Store(lllen, @@ -4890,7 +4890,7 @@ fn trans_ivec(bcx: @block_ctxt, args: &[@ast::expr], id: ast::node_id) -> let llstubptr = bcx.build.PointerCast(llvecptr, T_ptr(llstubty)); bcx.build.Store(C_int(0), bcx.build.InBoundsGEP(llstubptr, stub_z)); let llheapty = T_ivec_heap_part(llunitty); - if std::ivec::len(args) == 0u { + if std::vec::len(args) == 0u { // Null heap pointer indicates a zero-length vector. bcx.build.Store(llalen, bcx.build.InBoundsGEP(llstubptr, stub_a)); @@ -5594,9 +5594,9 @@ fn trans_block_cleanups(cx: &@block_ctxt, cleanup_cx: &@block_ctxt) -> @block_ctxt { let bcx = cx; if cleanup_cx.kind == NON_SCOPE_BLOCK { - assert (std::ivec::len[cleanup](cleanup_cx.cleanups) == 0u); + assert (std::vec::len[cleanup](cleanup_cx.cleanups) == 0u); } - let i = std::ivec::len[cleanup](cleanup_cx.cleanups); + let i = std::vec::len[cleanup](cleanup_cx.cleanups); while i > 0u { i -= 1u; let c = cleanup_cx.cleanups.(i); @@ -5949,7 +5949,7 @@ fn populate_fn_ctxt_from_llself(fcx: @fn_ctxt, llself: val_self_pair) { // its magic. let fields_tup_ty = ty::mk_tup(fcx.lcx.ccx.tcx, field_tys); - let n_typarams = std::ivec::len[ast::ty_param](bcx.fcx.lcx.obj_typarams); + let n_typarams = std::vec::len[ast::ty_param](bcx.fcx.lcx.obj_typarams); let llobj_box_ty: TypeRef = T_obj_ptr(*bcx_ccx(bcx), n_typarams); let box_cell = bcx.build.GEP(llself.v, ~[C_int(0), C_int(abi::obj_field_box)]); @@ -6145,7 +6145,7 @@ fn trans_res_ctor(cx: @local_ctxt, sp: &span, dtor: &ast::_fn, fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id, variant: &ast::variant, index: int, is_degen: bool, ty_params: &[ast::ty_param]) { - if std::ivec::len[ast::variant_arg](variant.node.args) == 0u { + if std::vec::len[ast::variant_arg](variant.node.args) == 0u { ret; // nullary constructors are just constants } @@ -6298,7 +6298,7 @@ fn trans_item(cx: @local_ctxt, item: &ast::item) { } ast::item_tag(variants, tps) { let sub_cx = extend_path(cx, item.ident); - let degen = std::ivec::len(variants) == 1u; + let degen = std::vec::len(variants) == 1u; let i = 0; for variant: ast::variant in variants { trans_tag_variant(sub_cx, item.id, variant, i, degen, tps); @@ -6336,12 +6336,12 @@ fn decl_fn_and_pair_full(ccx: &@crate_ctxt, sp: &span, path: &[str], flav: str, ty_params: &[ast::ty_param], node_id: ast::node_id, node_type: ty::t) { let llfty = type_of_fn_from_ty(ccx, sp, node_type, - std::ivec::len(ty_params)); + std::vec::len(ty_params)); alt ty::struct(ccx.tcx, node_type) { ty::ty_fn(proto, inputs, output, _, _) { llfty = type_of_fn(ccx, sp, proto, inputs, output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); } _ { ccx.sess.bug("decl_fn_and_pair(): fn item doesn't have fn type!"); } } @@ -6374,7 +6374,7 @@ fn create_main_wrapper(ccx: &@crate_ctxt, sp: &span, let main_mode = alt ty::struct(ccx.tcx, main_node_type) { ty::ty_fn(_, args, _ ,_ ,_) { - if std::ivec::len(args) == 0u { + if std::vec::len(args) == 0u { mm_nil } else { alt ty::struct(ccx.tcx, args.(0).ty) { @@ -6550,7 +6550,7 @@ fn native_fn_ty_param_count(cx: &@crate_ctxt, id: ast::node_id) -> uint { actually a fn"); } ast::native_item_fn(_, _, tps) { - count = std::ivec::len[ast::ty_param](tps); + count = std::vec::len[ast::ty_param](tps); } } ret count; @@ -6837,7 +6837,7 @@ fn collect_tag_ctor(ccx: @crate_ctxt, i: &@ast::item, pt: &[str], alt i.node { ast::item_tag(variants, tps) { for variant: ast::variant in variants { - if std::ivec::len(variant.node.args) != 0u { + if std::vec::len(variant.node.args) != 0u { decl_fn_and_pair(ccx, i.span, new_pt + ~[variant.node.name], "tag", tps, variant.node.id); } @@ -6863,7 +6863,7 @@ fn trans_constant(ccx: @crate_ctxt, it: &@ast::item, pt: &[str], alt it.node { ast::item_tag(variants, _) { let i = 0u; - let n_variants = std::ivec::len[ast::variant](variants); + let n_variants = std::vec::len[ast::variant](variants); while i < n_variants { let variant = variants.(i); let p = new_pt + ~[it.ident, variant.node.name, "discrim"]; @@ -7032,7 +7032,7 @@ fn create_crate_map(ccx: &@crate_ctxt) -> ValueRef { mapname = ccx.link_meta.name; } else { mapname = "toplevel"; } let sym_name = "_rust_crate_map_" + mapname; - let arrtype = T_array(T_int(), std::ivec::len[ValueRef](subcrates)); + let arrtype = T_array(T_int(), std::vec::len[ValueRef](subcrates)); let maptype = T_struct(~[T_int(), arrtype]); let map = llvm::LLVMAddGlobal(ccx.llmod, maptype, str::buf(sym_name)); llvm::LLVMSetLinkage(map, diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 5f770b21ca8..0f97432b361 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -1,5 +1,5 @@ import std::str; -import std::ivec; +import std::vec; import std::option; import option::some; import option::none; @@ -85,8 +85,8 @@ fn enter_match(m: &match, col: uint, val: ValueRef, e: &enter_pat) -> match { alt e(br.pats.(col)) { some(sub) { let pats = - ivec::slice(br.pats, 0u, col) + sub + - ivec::slice(br.pats, col + 1u, ivec::len(br.pats)); + vec::slice(br.pats, 0u, col) + sub + + vec::slice(br.pats, col + 1u, vec::len(br.pats)); let new_br = @{pats: pats with *br}; result += ~[new_br]; bind_for_pat(br.pats.(col), new_br, val); @@ -118,7 +118,7 @@ fn enter_opt(ccx: &@crate_ctxt, m: &match, opt: &opt, col: uint, ast::pat_lit(l) { ret if opt_eq(lit(l), opt) { some(~[]) } else { none }; } - _ { ret some(ivec::init_elt(dummy, size)); } + _ { ret some(vec::init_elt(dummy, size)); } } } ret enter_match(m, col, val, bind e(ccx, dummy, opt, tag_size, _)); @@ -141,7 +141,7 @@ fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) -> } ret some(pats); } - _ { ret some(ivec::init_elt(dummy, ivec::len(fields))); } + _ { ret some(vec::init_elt(dummy, vec::len(fields))); } } } ret enter_match(m, col, val, bind e(dummy, fields, _)); @@ -153,7 +153,7 @@ fn enter_tup(m: &match, col: uint, val: ValueRef, n_elts: uint) -> match { -> option::t[[@ast::pat]] { alt p.node { ast::pat_tup(elts) { ret some(elts); } - _ { ret some(ivec::init_elt(dummy, n_elts)); } + _ { ret some(vec::init_elt(dummy, n_elts)); } } } ret enter_match(m, col, val, bind e(dummy, n_elts, _)); @@ -198,8 +198,8 @@ fn extract_variant_args(bcx: @block_ctxt, pat_id: ast::node_id, let variants = ty::tag_variants(ccx.tcx, vdefs.tg); let args = ~[]; let size = - ivec::len(ty::tag_variant_with_id(ccx.tcx, vdefs.tg, vdefs.var).args); - if size > 0u && ivec::len(variants) != 1u { + vec::len(ty::tag_variant_with_id(ccx.tcx, vdefs.tg, vdefs.var).args); + if size > 0u && vec::len(variants) != 1u { let tagptr = bcx.build.PointerCast(val, trans_common::T_opaque_tag_ptr(ccx.tn)); @@ -223,7 +223,7 @@ fn collect_record_fields(m: &match, col: uint) -> [ast::ident] { alt br.pats.(col).node { ast::pat_rec(fs, _) { for f: ast::field_pat in fs { - if !ivec::any(bind str::eq(f.ident, _), fields) { + if !vec::any(bind str::eq(f.ident, _), fields) { fields += ~[f.ident]; } } @@ -252,7 +252,7 @@ type exit_node = {bound: bind_map, from: BasicBlockRef, to: BasicBlockRef}; type mk_fail = fn() -> BasicBlockRef; fn pick_col(m: &match) -> uint { - let scores = ivec::init_elt_mut(0u, ivec::len(m.(0).pats)); + let scores = vec::init_elt_mut(0u, vec::len(m.(0).pats)); for br: match_branch in m { let i = 0u; for p: @ast::pat in br.pats { @@ -283,8 +283,8 @@ fn pick_col(m: &match) -> uint { fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], f: &mk_fail, exits: &mutable [exit_node]) { - if ivec::len(m) == 0u { bcx.build.Br(f()); ret; } - if ivec::len(m.(0).pats) == 0u { + if vec::len(m) == 0u { bcx.build.Br(f()); ret; } + if vec::len(m.(0).pats) == 0u { exits += ~[{bound: m.(0).bound, from: bcx.llbb, to: m.(0).body}]; bcx.build.Br(m.(0).body); ret; @@ -292,8 +292,8 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], let col = pick_col(m); let val = vals.(col); - let vals_left = ivec::slice(vals, 0u, col) + - ivec::slice(vals, col + 1u, ivec::len(vals)); + let vals_left = vec::slice(vals, 0u, col) + + vec::slice(vals, col + 1u, vec::len(vals)); let ccx = bcx.fcx.lcx.ccx; let pat_id = 0; for br: match_branch in m { @@ -304,7 +304,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], let rec_fields = collect_record_fields(m, col); // Separate path for extracting and binding record fields - if ivec::len(rec_fields) > 0u { + if vec::len(rec_fields) > 0u { let rec_ty = ty::node_id_to_monotype(ccx.tcx, pat_id); let fields = alt ty::struct(ccx.tcx, rec_ty) { ty::ty_rec(fields) { fields } }; @@ -324,7 +324,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], if any_tup_pat(m, col) { let tup_ty = ty::node_id_to_monotype(ccx.tcx, pat_id); let n_tup_elts = alt ty::struct(ccx.tcx, tup_ty) { - ty::ty_tup(elts) { ivec::len(elts) } + ty::ty_tup(elts) { vec::len(elts) } }; let tup_vals = ~[], i = 0u; while i < n_tup_elts { @@ -355,10 +355,10 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], tag branch_kind { no_branch; single; switch; compare; } let kind = no_branch; let test_val = val; - if ivec::len(opts) > 0u { + if vec::len(opts) > 0u { alt opts.(0) { var(_, vdef) { - if ivec::len(ty::tag_variants(ccx.tcx, vdef.tg)) == 1u { + if vec::len(ty::tag_variants(ccx.tcx, vdef.tg)) == 1u { kind = single; } else { let tagptr = bcx.build.PointerCast @@ -381,7 +381,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], }; let sw = if kind == switch { - bcx.build.Switch(test_val, else_cx.llbb, ivec::len(opts)) + bcx.build.Switch(test_val, else_cx.llbb, vec::len(opts)) } else { C_int(0) }; // Placeholder for when not using a switch // Compile subtrees for each option @@ -410,7 +410,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef], alt opt { var(_, vdef) { let args = extract_variant_args(opt_cx, pat_id, vdef, val); - size = ivec::len(args.vals); + size = vec::len(args.vals); unpacked = args.vals; opt_cx = args.bcx; } @@ -451,7 +451,7 @@ fn make_phi_bindings(bcx: &@block_ctxt, map: &[exit_node], } } } - if ivec::len(vals) > 0u { + if vec::len(vals) > 0u { let phi = bcx.build.Phi(val_ty(vals.(0)), vals, llbbs); bcx.fcx.lllocals.insert(item.val, phi); } else { success = false; } @@ -537,7 +537,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: &@ast::pat, val: ValueRef, } } ast::pat_tag(_, sub) { - if ivec::len(sub) == 0u { ret bcx; } + if vec::len(sub) == 0u { ret bcx; } let vdefs = ast::variant_def_ids(ccx.tcx.def_map.get(pat.id)); let args = extract_variant_args(bcx, pat.id, vdefs, val); let i = 0; diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 0361535f370..5a045e8fc04 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -4,7 +4,7 @@ */ import std::int; -import std::ivec; +import std::vec; import std::str; import std::uint; import std::str::rustrt::sbuf; @@ -312,9 +312,9 @@ fn revoke_clean(cx: &@block_ctxt, val: ValueRef) { if found == -1 { ret; } // We found the cleanup and remove it sc_cx.cleanups = - std::ivec::slice(sc_cx.cleanups, 0u, found as uint) + - std::ivec::slice(sc_cx.cleanups, (found as uint) + 1u, - std::ivec::len(sc_cx.cleanups)); + std::vec::slice(sc_cx.cleanups, 0u, found as uint) + + std::vec::slice(sc_cx.cleanups, (found as uint) + 1u, + std::vec::len(sc_cx.cleanups)); } fn get_res_dtor(ccx : &@crate_ctxt, sp : &span, did : &ast::def_id, @@ -424,8 +424,8 @@ fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); } fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef { let elt_count = llvm::LLVMCountStructElementTypes(llstructty); assert (n < elt_count); - let elt_tys = std::ivec::init_elt(T_nil(), elt_count); - llvm::LLVMGetStructElementTypes(llstructty, std::ivec::to_ptr(elt_tys)); + let elt_tys = std::vec::init_elt(T_nil(), elt_count); + llvm::LLVMGetStructElementTypes(llstructty, std::vec::to_ptr(elt_tys)); ret llvm::LLVMGetElementType(elt_tys.(n)); } @@ -509,8 +509,8 @@ fn T_size_t() -> TypeRef { } fn T_fn(inputs: &[TypeRef], output: TypeRef) -> TypeRef { - ret llvm::LLVMFunctionType(output, std::ivec::to_ptr(inputs), - std::ivec::len[TypeRef](inputs), False); + ret llvm::LLVMFunctionType(output, std::vec::to_ptr(inputs), + std::vec::len[TypeRef](inputs), False); } fn T_fn_pair(cx: &crate_ctxt, tfn: TypeRef) -> TypeRef { @@ -520,7 +520,7 @@ fn T_fn_pair(cx: &crate_ctxt, tfn: TypeRef) -> TypeRef { fn T_ptr(t: TypeRef) -> TypeRef { ret llvm::LLVMPointerType(t, 0u); } fn T_struct(elts: &[TypeRef]) -> TypeRef { - ret llvm::LLVMStructType(std::ivec::to_ptr(elts), std::ivec::len(elts), + ret llvm::LLVMStructType(std::vec::to_ptr(elts), std::vec::len(elts), False); } @@ -530,7 +530,7 @@ fn T_named_struct(name: &str) -> TypeRef { } fn set_struct_body(t: TypeRef, elts: &[TypeRef]) { - llvm::LLVMStructSetBody(t, std::ivec::to_ptr(elts), std::ivec::len(elts), + llvm::LLVMStructSetBody(t, std::vec::to_ptr(elts), std::vec::len(elts), False); } @@ -570,9 +570,9 @@ fn T_tydesc_field(cx: &crate_ctxt, field: int) -> TypeRef { // Bit of a kludge: pick the fn typeref out of the tydesc.. let tydesc_elts: [TypeRef] = - std::ivec::init_elt[TypeRef](T_nil(), abi::n_tydesc_fields as uint); + std::vec::init_elt[TypeRef](T_nil(), abi::n_tydesc_fields as uint); llvm::LLVMGetStructElementTypes(cx.tydesc_type, - std::ivec::to_ptr[TypeRef](tydesc_elts)); + std::vec::to_ptr[TypeRef](tydesc_elts)); let t = llvm::LLVMGetElementType(tydesc_elts.(field)); ret t; } @@ -742,7 +742,7 @@ fn T_opaque_tag_ptr(tn: &type_names) -> TypeRef { } fn T_captured_tydescs(cx: &crate_ctxt, n: uint) -> TypeRef { - ret T_struct(std::ivec::init_elt[TypeRef](T_ptr(cx.tydesc_type), n)); + ret T_struct(std::vec::init_elt[TypeRef](T_ptr(cx.tydesc_type), n)); } fn T_obj_ptr(cx: &crate_ctxt, n_captured_tydescs: uint) -> TypeRef { @@ -845,28 +845,28 @@ fn C_zero_byte_arr(size: uint) -> ValueRef { let i = 0u; let elts: [ValueRef] = ~[]; while i < size { elts += ~[C_u8(0u)]; i += 1u; } - ret llvm::LLVMConstArray(T_i8(), std::ivec::to_ptr(elts), - std::ivec::len(elts)); + ret llvm::LLVMConstArray(T_i8(), std::vec::to_ptr(elts), + std::vec::len(elts)); } fn C_struct(elts: &[ValueRef]) -> ValueRef { - ret llvm::LLVMConstStruct(std::ivec::to_ptr(elts), std::ivec::len(elts), + ret llvm::LLVMConstStruct(std::vec::to_ptr(elts), std::vec::len(elts), False); } fn C_named_struct(T: TypeRef, elts: &[ValueRef]) -> ValueRef { - ret llvm::LLVMConstNamedStruct(T, std::ivec::to_ptr(elts), - std::ivec::len(elts)); + ret llvm::LLVMConstNamedStruct(T, std::vec::to_ptr(elts), + std::vec::len(elts)); } fn C_array(ty: TypeRef, elts: &[ValueRef]) -> ValueRef { - ret llvm::LLVMConstArray(ty, std::ivec::to_ptr(elts), - std::ivec::len(elts)); + ret llvm::LLVMConstArray(ty, std::vec::to_ptr(elts), + std::vec::len(elts)); } fn C_bytes(bytes : &[u8]) -> ValueRef { - ret llvm::LLVMConstString(unsafe::reinterpret_cast(ivec::to_ptr(bytes)), - ivec::len(bytes), False); + ret llvm::LLVMConstString(unsafe::reinterpret_cast(vec::to_ptr(bytes)), + vec::len(bytes), False); } fn C_shape(ccx : &@crate_ctxt, bytes : &[u8]) -> ValueRef { diff --git a/src/comp/middle/trans_dps.rs b/src/comp/middle/trans_dps.rs index d5020d1fe41..25897669f5b 100644 --- a/src/comp/middle/trans_dps.rs +++ b/src/comp/middle/trans_dps.rs @@ -12,7 +12,7 @@ import syntax::ast; import syntax::codemap::span; import util::ppaux; import trans_common::*; -import std::ivec; +import std::vec; import std::option::none; import std::option::some; import std::str; @@ -466,7 +466,7 @@ fn trans_lit_str_common(ccx: &@crate_ctxt, s: &str, expand: bool) -> llheappartopt = none; } else if (len < abi::ivec_default_length - 1u) { // minus one for the null - while ivec::len(array) < abi::ivec_default_length { + while vec::len(array) < abi::ivec_default_length { array += ~[tc::C_u8(0u)]; } diff --git a/src/comp/middle/trans_objects.rs b/src/comp/middle/trans_objects.rs index 1e9726e9001..f8911869343 100644 --- a/src/comp/middle/trans_objects.rs +++ b/src/comp/middle/trans_objects.rs @@ -95,8 +95,8 @@ fn trans_obj(cx: @local_ctxt, sp: &span, ob: &ast::_obj, // typarams, and fields. let llbox_ty: TypeRef = T_ptr(T_empty_struct()); - if std::ivec::len[ast::ty_param](ty_params) == 0u && - std::ivec::len[ty::arg](arg_tys) == 0u { + if std::vec::len[ast::ty_param](ty_params) == 0u && + std::vec::len[ty::arg](arg_tys) == 0u { // If the object we're translating has no fields or type parameters, // there's not much to do. @@ -235,7 +235,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj, // methods, not inner ones. let wrapper_obj: ast::_obj = {fields: - std::ivec::map(ast::obj_field_from_anon_obj_field, + std::vec::map(ast::obj_field_from_anon_obj_field, additional_fields), methods: anon_obj.methods}; @@ -295,7 +295,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj, // typarams, fields, and a pointer to our inner_obj. let llbox_ty: TypeRef = T_ptr(T_empty_struct()); - if std::ivec::len[ast::anon_obj_field](additional_fields) == 0u && + if std::vec::len[ast::anon_obj_field](additional_fields) == 0u && anon_obj.inner_obj == none { // If the object we're translating has no fields and no inner_obj, @@ -496,7 +496,7 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t, // Filter out any methods that we don't need forwarding slots for // because they're being overridden. let f = bind filtering_fn(cx, _, ob.methods); - meths = std::ivec::filter_map[vtbl_mthd, vtbl_mthd](f, meths); + meths = std::vec::filter_map[vtbl_mthd, vtbl_mthd](f, meths); // And now add the additional ones, both overriding ones and entirely // new ones. These will just be normal methods. @@ -615,7 +615,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method, // Get the backwarding function's type and declare it. let llbackwarding_fn_ty: TypeRef = type_of_fn_full(cx.ccx, sp, m.proto, true, m.inputs, m.output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); let llbackwarding_fn: ValueRef = decl_internal_fastcall_fn(cx.ccx.llmod, s, llbackwarding_fn_ty); @@ -684,7 +684,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method, type_of_fn_full(bcx_ccx(bcx), sp, ty::ty_fn_proto(bcx_tcx(bcx), outer_mthd_ty), true, m.inputs, m.output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); llouter_mthd = bcx.build.PointerCast(llouter_mthd, T_ptr(T_ptr(llouter_mthd_ty))); llouter_mthd = bcx.build.Load(llouter_mthd); @@ -747,7 +747,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method, // Get the forwarding function's type and declare it. let llforwarding_fn_ty: TypeRef = type_of_fn_full(cx.ccx, sp, m.proto, true, m.inputs, m.output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); let llforwarding_fn: ValueRef = decl_internal_fastcall_fn(cx.ccx.llmod, s, llforwarding_fn_ty); @@ -844,7 +844,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method, type_of_fn_full(bcx_ccx(bcx), sp, ty::ty_fn_proto(bcx_tcx(bcx), orig_mthd_ty), true, m.inputs, m.output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); llorig_mthd = bcx.build.PointerCast(llorig_mthd, T_ptr(T_ptr(llorig_mthd_ty))); llorig_mthd = bcx.build.Load(llorig_mthd); @@ -923,7 +923,7 @@ fn process_normal_mthd(cx: @local_ctxt, m: @ast::method, self_ty: ty::t, ty::ty_fn(proto, inputs, output, _, _) { llfnty = type_of_fn_full(cx.ccx, m.span, proto, true, inputs, output, - std::ivec::len[ast::ty_param](ty_params)); + std::vec::len[ast::ty_param](ty_params)); } } let mcx: @local_ctxt = diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index 52600781ed2..aff695c44b8 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::int::str; import std::str; import std::option; @@ -170,8 +170,8 @@ fn log_states_err(pp: &pre_and_post_state) { fn print_ident(i: &ident) { log " " + i + " "; } fn print_idents(idents: &mutable [ident]) { - if ivec::len[ident](idents) == 0u { ret; } - log "an ident: " + ivec::pop[ident](idents); + if vec::len[ident](idents) == 0u { ret; } + log "an ident: " + vec::pop[ident](idents); print_idents(idents); } @@ -311,15 +311,15 @@ fn get_fn_info(ccx: &crate_ctxt, id: node_id) -> fn_info { } fn add_node(ccx: &crate_ctxt, i: node_id, a: &ts_ann) { - let sz = ivec::len(*ccx.node_anns); + let sz = vec::len(*ccx.node_anns); if sz <= i as uint { - ivec::grow_mut(*ccx.node_anns, (i as uint) - sz + 1u, empty_ann(0u)); + vec::grow_mut(*ccx.node_anns, (i as uint) - sz + 1u, empty_ann(0u)); } ccx.node_anns.(i) = a; } fn get_ts_ann(ccx: &crate_ctxt, i: node_id) -> option::t[ts_ann] { - if i as uint < ivec::len(*ccx.node_anns) { + if i as uint < vec::len(*ccx.node_anns) { ret some[ts_ann](ccx.node_anns.(i)); } else { ret none[ts_ann]; } } @@ -690,7 +690,7 @@ fn substitute_constr_args(cx: &ty::ctxt, actuals: &[@expr], c: &@ty::constr) fn substitute_arg(cx: &ty::ctxt, actuals: &[@expr], a: @constr_arg) -> @constr_arg_use { - let num_actuals = ivec::len(actuals); + let num_actuals = vec::len(actuals); alt a.node { carg_ident(i) { if i < num_actuals { @@ -744,7 +744,7 @@ fn find_instances(fcx: &fn_ctxt, subst: &subst, c: &constraint) -> [{from: uint, to: uint}] { let rslt = ~[]; - if ivec::len(subst) == 0u { ret rslt; } + if vec::len(subst) == 0u { ret rslt; } alt c { cinit(_, _, _) {/* this is dealt with separately */ } @@ -822,7 +822,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_[inst]] { } fn path_to_ident(cx: &ty::ctxt, p: &path) -> ident { - alt ivec::last(p.node.idents) { + alt vec::last(p.node.idents) { none. { cx.sess.span_fatal(p.span, "Malformed path"); } some(i) { ret i; } } @@ -1029,7 +1029,7 @@ fn args_mention[T](args: &[@constr_arg_use], q: fn(&[T], node_id) -> bool , case (_) { false } } } - ret ivec::any(bind mentions(s,q,_), args); + ret vec::any(bind mentions(s,q,_), args); */ for a: @constr_arg_use in args { @@ -1040,7 +1040,7 @@ fn args_mention[T](args: &[@constr_arg_use], q: fn(&[T], node_id) -> bool , fn use_var(fcx: &fn_ctxt, v: &node_id) { *fcx.enclosing.used_vars += ~[v]; } -// FIXME: This should be a function in std::ivec::. +// FIXME: This should be a function in std::vec::. fn vec_contains(v: &@mutable [node_id], i: &node_id) -> bool { for d: node_id in *v { if d == i { ret true; } } ret false; @@ -1090,7 +1090,7 @@ fn local_to_bindings(loc : &@local) -> binding { } fn locals_to_bindings(locals : &[@local]) -> [binding] { - ivec::map(local_to_bindings, locals) + vec::map(local_to_bindings, locals) } fn callee_modes(fcx: &fn_ctxt, callee: node_id) -> [ty::mode] { @@ -1120,7 +1120,7 @@ fn callee_arg_init_ops(fcx: &fn_ctxt, callee: node_id) -> [init_op] { _ { init_assign } } } - ivec::map(mode_to_op, callee_modes(fcx, callee)) + vec::map(mode_to_op, callee_modes(fcx, callee)) } fn anon_bindings(ops: &[init_op], es : &[@expr]) -> [binding] { diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index 25e5a27abd8..3e90c08ec19 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -1,6 +1,6 @@ import syntax::ast::*; import syntax::visit; -import std::ivec; +import std::vec; import std::option::*; import aux::*; import tstate::ann::pre_and_post; @@ -77,10 +77,10 @@ fn seq_tritv(p: &postcond, q: &postcond) { } fn seq_postconds(fcx: &fn_ctxt, ps: &[postcond]) -> postcond { - let sz = ivec::len(ps); + let sz = vec::len(ps); if sz >= 1u { let prev = tritv_clone(ps.(0)); - for p: postcond in ivec::slice(ps, 1u, sz) { seq_tritv(prev, p); } + for p: postcond in vec::slice(ps, 1u, sz) { seq_tritv(prev, p); } ret prev; } else { ret ann::empty_poststate(num_constraints(fcx.enclosing)); } } @@ -90,12 +90,12 @@ fn seq_postconds(fcx: &fn_ctxt, ps: &[postcond]) -> postcond { // So, if e0's post is {x} and e1's pre is {x, y, z}, the entire // precondition shouldn't include x. fn seq_preconds(fcx: &fn_ctxt, pps: &[pre_and_post]) -> precond { - let sz: uint = ivec::len(pps); + let sz: uint = vec::len(pps); let num_vars: uint = num_constraints(fcx.enclosing); fn seq_preconds_go(fcx: &fn_ctxt, pps: &[pre_and_post], first: &pre_and_post) -> precond { - let sz: uint = ivec::len(pps); + let sz: uint = vec::len(pps); if sz >= 1u { let second = pps.(0); assert (pps_len(second) == num_constraints(fcx.enclosing)); @@ -105,7 +105,7 @@ fn seq_preconds(fcx: &fn_ctxt, pps: &[pre_and_post]) -> precond { union(next_first, second_pre); let next_first_post = clone(first.postcondition); seq_tritv(next_first_post, second.postcondition); - ret seq_preconds_go(fcx, ivec::slice(pps, 1u, sz), + ret seq_preconds_go(fcx, vec::slice(pps, 1u, sz), @{precondition: next_first, postcondition: next_first_post}); } else { ret first.precondition; } @@ -115,7 +115,7 @@ fn seq_preconds(fcx: &fn_ctxt, pps: &[pre_and_post]) -> precond { if sz >= 1u { let first = pps.(0); assert (pps_len(first) == num_vars); - ret seq_preconds_go(fcx, ivec::slice(pps, 1u, sz), first); + ret seq_preconds_go(fcx, vec::slice(pps, 1u, sz), first); } else { ret true_precond(num_vars); } } @@ -197,7 +197,7 @@ fn kill_poststate(fcx: &fn_ctxt, id: node_id, c: &tsconstr) -> bool { fn clear_in_poststate_expr(fcx: &fn_ctxt, e: &@expr, t: &poststate) { alt e.node { expr_path(p) { - alt ivec::last(p.node.idents) { + alt vec::last(p.node.idents) { some(i) { alt local_node_id_to_def(fcx, e.id) { some(def_local(d_id)) { diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index 35d9d657403..036c931376d 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -1,6 +1,6 @@ import std::uint; import std::int; -import std::ivec; +import std::vec; import syntax::ast::*; import util::ppaux::fn_ident_to_string; import std::option::*; @@ -127,7 +127,7 @@ fn mk_fn_info(ccx: &crate_ctxt, f: &_fn, tp: &[ty_param], f_sp: &span, {constrs: res_map, num_constraints: // add 2 to account for the i_return and i_diverge constraints - ivec::len(*cx.cs) + ivec::len(f.decl.constraints) + 2u, + vec::len(*cx.cs) + vec::len(f.decl.constraints) + 2u, cf: f.decl.cf, i_return: ninit(id, name), i_diverge: ninit(diverges_id, diverges_name), diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 853110275a6..a6541f43c71 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -1,5 +1,5 @@ -import std::ivec; +import std::vec; import std::option; import std::option::none; import std::option::some; @@ -115,7 +115,7 @@ fn find_pre_post_item(ccx: &crate_ctxt, i: &item) { the preconditions for <args>, and the postcondition in a to be the union of all postconditions for <args> */ fn find_pre_post_exprs(fcx: &fn_ctxt, args: &[@expr], id: node_id) { - if ivec::len[@expr](args) > 0u { + if vec::len[@expr](args) > 0u { log "find_pre_post_exprs: oper ="; log_expr(*args.(0)); } @@ -125,10 +125,10 @@ fn find_pre_post_exprs(fcx: &fn_ctxt, args: &[@expr], id: node_id) { fn get_pp(ccx: crate_ctxt, e: &@expr) -> pre_and_post { ret expr_pp(ccx, e); } - let pps = ivec::map[@expr, pre_and_post](bind get_pp(fcx.ccx, _), args); + let pps = vec::map[@expr, pre_and_post](bind get_pp(fcx.ccx, _), args); set_pre_and_post(fcx.ccx, id, seq_preconds(fcx, pps), - seq_postconds(fcx, ivec::map(get_post, pps))); + seq_postconds(fcx, vec::map(get_post, pps))); } fn find_pre_post_loop(fcx: &fn_ctxt, l: &@local, index: &@expr, body: &blk, @@ -525,7 +525,7 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) { postcondition: false_postcond(num_local_vars)}; let g = bind combine_pp(antec_pp, fcx, _, _); let alts_overall_pp = - ivec::foldl[pre_and_post, pre_and_post](g, e_pp, alt_pps); + vec::foldl[pre_and_post, pre_and_post](g, e_pp, alt_pps); set_pre_and_post(fcx.ccx, e.id, alts_overall_pp.precondition, alts_overall_pp.postcondition); } diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index 6ff42167e6a..c990b036cfe 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -1,6 +1,6 @@ import syntax::print::pprust::path_to_str; import util::ppaux::ty_to_str; -import std::ivec; +import std::vec; import std::option; import std::option::get; import std::option::is_none; @@ -165,11 +165,11 @@ fn find_pre_post_state_call(fcx: &fn_ctxt, pres: &prestate, a: &@expr, id: node_id, ops: &[init_op], bs: &[@expr], cf: controlflow) -> bool { let changed = find_pre_post_state_expr(fcx, pres, a); - if ivec::len(bs) != ivec::len(ops) { + if vec::len(bs) != vec::len(ops) { fcx.ccx.tcx.sess.span_bug(a.span, #fmt("mismatched arg lengths: \ %u exprs vs. %u ops", - ivec::len(bs), ivec::len(ops))); + vec::len(bs), vec::len(ops))); } ret find_pre_post_state_exprs(fcx, expr_poststate(fcx.ccx, a), id, ops, bs, cf) @@ -313,8 +313,8 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) -> alt e.node { expr_vec(elts, _, _) { ret find_pre_post_state_exprs(fcx, pres, e.id, - ivec::init_elt(init_assign, - ivec::len(elts)), + vec::init_elt(init_assign, + vec::len(elts)), elts, return); } expr_call(operator, operands) { @@ -372,8 +372,8 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) -> expr_rec(fields, maybe_base) { let changed = find_pre_post_state_exprs(fcx, pres, e.id, - ivec::init_elt(init_assign, - ivec::len(fields)), + vec::init_elt(init_assign, + vec::len(fields)), field_exprs(fields), return); alt maybe_base { @@ -389,8 +389,8 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) -> } expr_tup(elts) { ret find_pre_post_state_exprs(fcx, pres, e.id, - ivec::init_elt(init_assign, - ivec::len(elts)), + vec::init_elt(init_assign, + vec::len(elts)), elts, return); } expr_copy(a) { @@ -554,7 +554,7 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) -> find_pre_post_state_expr(fcx, pres, val); let e_post = expr_poststate(fcx.ccx, val); let a_post; - if ivec::len(alts) > 0u { + if vec::len(alts) > 0u { a_post = false_postcond(num_constrs); for an_alt: arm in alts { changed |= diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 9468b76d7a4..d10ad3d9a08 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -1,5 +1,5 @@ import std::int; -import std::ivec; +import std::vec; import std::str; import std::uint; import std::box; @@ -393,7 +393,7 @@ fn populate_type_store(cx: &ctxt) { intern(cx, ty_task, none); intern(cx, ty_type, none); intern(cx, ty_bot, none); - assert (ivec::len(cx.ts.vect) == idx_first_others); + assert (vec::len(cx.ts.vect) == idx_first_others); } fn mk_rcache() -> creader_cache { @@ -1195,7 +1195,7 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool { ty_istr. { ret false; } ty_tag(_, subtys) { let i = 0u; - while i < ivec::len[t](subtys) { + while i < vec::len[t](subtys) { if type_has_dynamic_size(cx, subtys.(i)) { ret true; } i += 1u; } @@ -1210,7 +1210,7 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool { ty_task. { ret false; } ty_rec(fields) { let i = 0u; - while i < ivec::len[field](fields) { + while i < vec::len[field](fields) { if type_has_dynamic_size(cx, fields.(i).mt.ty) { ret true; } i += 1u; } @@ -1453,7 +1453,7 @@ fn type_autoderef(cx: &ctxt, t: &ty::t) -> ty::t { } ty::ty_tag(did, tps) { let variants = tag_variants(cx, did); - if ivec::len(variants) != 1u || ivec::len(variants.(0).args) != 1u + if vec::len(variants) != 1u || vec::len(variants.(0).args) != 1u { break; } @@ -1643,7 +1643,7 @@ fn constr_eq(c: &@constr, d: &@constr) -> bool { } fn constrs_eq(cs: &[@constr], ds: &[@constr]) -> bool { - if ivec::len(cs) != ivec::len(ds) { ret false; } + if vec::len(cs) != vec::len(ds) { ret false; } let i = 0u; for c: @constr in cs { if !constr_eq(c, ds.(i)) { ret false; } i += 1u; } ret true; @@ -1656,8 +1656,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { fn equal_fn(args_a: &[arg], rty_a: &t, args_b: &[arg], rty_b: &t) -> bool { if !eq_ty(rty_a, rty_b) { ret false; } - let len = ivec::len[arg](args_a); - if len != ivec::len[arg](args_b) { ret false; } + let len = vec::len[arg](args_a); + if len != vec::len[arg](args_b) { ret false; } let i = 0u; while i < len { let arg_a = args_a.(i); @@ -1693,8 +1693,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { alt b { ty_tag(id_b, tys_b) { if !equal_def(id_a, id_b) { ret false; } - let len = ivec::len[t](tys_a); - if len != ivec::len[t](tys_b) { ret false; } + let len = vec::len[t](tys_a); + if len != vec::len[t](tys_b) { ret false; } let i = 0u; while i < len { if !eq_ty(tys_a.(i), tys_b.(i)) { ret false; } @@ -1727,8 +1727,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { ty_rec(flds_a) { alt b { ty_rec(flds_b) { - let len = ivec::len[field](flds_a); - if len != ivec::len[field](flds_b) { ret false; } + let len = vec::len[field](flds_a); + if len != vec::len[field](flds_b) { ret false; } let i = 0u; while i < len { let fld_a = flds_a.(i); @@ -1747,8 +1747,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { ty_tup(ts_a) { alt (b) { ty_tup(ts_b) { - let len = ivec::len(ts_a); - if len != ivec::len(ts_b) { ret false; } + let len = vec::len(ts_a); + if len != vec::len(ts_b) { ret false; } let i = 0u; while i < len { if !eq_ty(ts_a.(i), ts_b.(i)) { ret false; } @@ -1780,8 +1780,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { ty_obj(methods_a) { alt b { ty_obj(methods_b) { - let len = ivec::len[method](methods_a); - if len != ivec::len[method](methods_b) { ret false; } + let len = vec::len[method](methods_a); + if len != vec::len[method](methods_b) { ret false; } let i = 0u; while i < len { let m_a = methods_a.(i); @@ -1898,7 +1898,7 @@ fn node_id_to_type_params(cx: &ctxt, id: &ast::node_id) -> [t] { } fn node_id_has_type_params(cx: &ctxt, id: &ast::node_id) -> bool { - ret ivec::len(node_id_to_type_params(cx, id)) > 0u; + ret vec::len(node_id_to_type_params(cx, id)) > 0u; } @@ -1938,7 +1938,7 @@ fn count_ty_params(cx: &ctxt, ty: t) -> uint { let param_indices: @mutable [uint] = @mutable ~[]; let f = bind counter(cx, param_indices, _); walk_ty(cx, f, ty); - ret ivec::len[uint](*param_indices); + ret vec::len[uint](*param_indices); } fn type_contains_vars(cx: &ctxt, typ: &t) -> bool { @@ -2079,7 +2079,7 @@ fn occurs_check_fails(tcx: &ctxt, sp: &option::t[span], vid: int, rt: &t) ret false; } // Occurs check! - if ivec::member(vid, vars_in_type(tcx, rt)) { + if vec::member(vid, vars_in_type(tcx, rt)) { alt sp { some (s) { // Maybe this should be span_err -- however, there's an @@ -2211,8 +2211,8 @@ mod unify { // pairwise equal. fn unify_constrs(base_t: &t, expected: [@type_constr], actual: &[@type_constr]) -> result { - let expected_len = ivec::len(expected); - let actual_len = ivec::len(actual); + let expected_len = vec::len(expected); + let actual_len = vec::len(actual); if expected_len != actual_len { ret ures_err(terr_constr_len(expected_len, actual_len)); @@ -2231,8 +2231,8 @@ mod unify { let ok_res = ures_ok(base_t); let err_res = ures_err(terr_constr_mismatch(expected, actual_constr)); if expected.node.id != actual_constr.node.id { ret err_res; } - let expected_arg_len = ivec::len(expected.node.args); - let actual_arg_len = ivec::len(actual_constr.node.args); + let expected_arg_len = vec::len(expected.node.args); + let actual_arg_len = vec::len(actual_constr.node.args); if expected_arg_len != actual_arg_len { ret err_res; } let i = 0u; let actual; @@ -2276,8 +2276,8 @@ mod unify { expected_inputs: &[arg], expected_output: &t, actual_inputs: &[arg], actual_output: &t) -> fn_common_res { - let expected_len = ivec::len[arg](expected_inputs); - let actual_len = ivec::len[arg](actual_inputs); + let expected_len = vec::len[arg](expected_inputs); + let actual_len = vec::len[arg](actual_inputs); if expected_len != actual_len { ret fn_common_res_err(ures_err(terr_arg_count)); } @@ -2373,8 +2373,8 @@ mod unify { result { let result_meths: [method] = ~[]; let i: uint = 0u; - let expected_len: uint = ivec::len[method](expected_meths); - let actual_len: uint = ivec::len[method](actual_meths); + let expected_len: uint = vec::len[method](expected_meths); + let actual_len: uint = vec::len[method](actual_meths); if expected_len != actual_len { ret ures_err(terr_meth_count); } while i < expected_len { let e_meth = expected_meths.(i); @@ -2515,7 +2515,7 @@ mod unify { // TODO: factor this cruft out let result_tps: [t] = ~[]; let i = 0u; - let expected_len = ivec::len[t](expected_tps); + let expected_len = vec::len[t](expected_tps); while i < expected_len { let expected_tp = expected_tps.(i); let actual_tp = actual_tps.(i); @@ -2684,8 +2684,8 @@ mod unify { ty::ty_rec(expected_fields) { alt struct(cx.tcx, actual) { ty::ty_rec(actual_fields) { - let expected_len = ivec::len[field](expected_fields); - let actual_len = ivec::len[field](actual_fields); + let expected_len = vec::len[field](expected_fields); + let actual_len = vec::len[field](actual_fields); if expected_len != actual_len { let err = terr_record_size(expected_len, actual_len); ret ures_err(err); @@ -2730,8 +2730,8 @@ mod unify { ty::ty_tup(expected_elems) { alt struct(cx.tcx, actual) { ty::ty_tup(actual_elems) { - let expected_len = ivec::len(expected_elems); - let actual_len = ivec::len(actual_elems); + let expected_len = vec::len(expected_elems); + let actual_len = vec::len(actual_elems); if (expected_len != actual_len) { let err = terr_tuple_size(expected_len, actual_len); ret ures_err(err); @@ -2825,10 +2825,10 @@ mod unify { } fn dump_var_bindings(tcx: ty_ctxt, vb: @var_bindings) { let i = 0u; - while i < ivec::len[ufind::node](vb.sets.nodes) { + while i < vec::len[ufind::node](vb.sets.nodes) { let sets = ""; let j = 0u; - while j < ivec::len[option::t[uint]](vb.sets.nodes) { + while j < vec::len[option::t[uint]](vb.sets.nodes) { if ufind::find(vb.sets, j) == i { sets += #fmt(" %u", j); } @@ -2951,7 +2951,7 @@ fn bind_params_in_type(sp: &span, cx: &ctxt, next_ty_var: fn() -> int , while i < ty_param_count { *param_var_ids += ~[next_ty_var()]; i += 1u; } fn binder(sp: span, cx: ctxt, param_var_ids: @mutable [int], next_ty_var: fn() -> int , index: uint, kind: ast::kind) -> t { - if index < ivec::len(*param_var_ids) { + if index < vec::len(*param_var_ids) { ret mk_var(cx, param_var_ids.(index)); } else { cx.sess.span_fatal(sp, "Unbound type parameter in callee's type"); @@ -3015,7 +3015,7 @@ fn tag_variants(cx: &ctxt, id: &ast::def_id) -> [variant_info] { for variant: ast::variant in variants { let ctor_ty = node_id_to_monotype(cx, variant.node.id); let arg_tys: [t] = ~[]; - if std::ivec::len(variant.node.args) > 0u { + if std::vec::len(variant.node.args) > 0u { for a: arg in ty_fn_args(cx, ctor_ty) { arg_tys += ~[a.ty]; } @@ -3039,7 +3039,7 @@ fn tag_variant_with_id(cx: &ctxt, tag_id: &ast::def_id, variant_id: &ast::def_id) -> variant_info { let variants = tag_variants(cx, tag_id); let i = 0u; - while i < ivec::len[variant_info](variants) { + while i < vec::len[variant_info](variants) { let variant = variants.(i); if def_eq(variant.id, variant_id) { ret variant; } i += 1u; diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index b2a232c33c7..f73138b65f1 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -34,7 +34,7 @@ import middle::ty::unify::fixup_result; import middle::ty::unify::fix_ok; import middle::ty::unify::fix_err; import std::int; -import std::ivec; +import std::vec; import std::str; import std::uint; import std::map; @@ -158,15 +158,15 @@ fn ty_param_kinds_and_ty_for_def(fcx: &@fn_ctxt, sp: &span, defn: &ast::def) fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path, tpt: &ty_param_kinds_and_ty, sp: &span) -> ty_param_substs_opt_and_ty { - let ty_param_count = ivec::len(tpt.kinds); + let ty_param_count = vec::len(tpt.kinds); let bind_result = bind_params_in_type(sp, fcx.ccx.tcx, bind next_ty_var_id(fcx), tpt.ty, ty_param_count); let ty_param_vars = bind_result.ids; let ty_substs_opt; - let ty_substs_len = ivec::len[@ast::ty](pth.node.types); + let ty_substs_len = vec::len[@ast::ty](pth.node.types); if ty_substs_len > 0u { - let param_var_len = ivec::len(ty_param_vars); + let param_var_len = vec::len(ty_param_vars); if param_var_len == 0u { fcx.ccx.tcx.sess.span_fatal (sp, "this item does not take type parameters"); @@ -287,7 +287,7 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> // "foo = int" like OCaml? let ty_param_kinds_and_ty = getter(id); - if ivec::len(ty_param_kinds_and_ty.kinds) == 0u { + if vec::len(ty_param_kinds_and_ty.kinds) == 0u { ret ty_param_kinds_and_ty.ty; } // The typedef is type-parametric. Do the type substitution. @@ -297,8 +297,8 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> for ast_ty: @ast::ty in args { param_bindings += ~[ast_ty_to_ty(tcx, getter, ast_ty)]; } - if ivec::len(param_bindings) != - ivec::len(ty_param_kinds_and_ty.kinds) { + if vec::len(param_bindings) != + vec::len(ty_param_kinds_and_ty.kinds) { tcx.sess.span_fatal(sp, "Wrong number of type arguments for a \ polymorphic type"); @@ -341,7 +341,7 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> typ = ty::mk_chan(tcx, ast_ty_to_ty(tcx, getter, t)); } ast::ty_tup(fields) { - let flds = ivec::map(bind ast_ty_to_ty(tcx, getter, _), fields); + let flds = vec::map(bind ast_ty_to_ty(tcx, getter, _), fields); typ = ty::mk_tup(tcx, flds); } ast::ty_rec(fields) { @@ -752,7 +752,7 @@ mod collect { // constructors get turned into functions. let result_ty; - if ivec::len[ast::variant_arg](variant.node.args) == 0u { + if vec::len[ast::variant_arg](variant.node.args) == 0u { result_ty = ty::mk_tag(cx.tcx, tag_id, ty_param_tys); } else { // As above, tell ast_ty_to_ty() that trans_ty_item_to_ty() @@ -813,7 +813,7 @@ mod collect { // ty_of_obj().) let method_types = get_obj_method_types(cx, object); let i = 0u; - while i < ivec::len[@ast::method](object.methods) { + while i < vec::len[@ast::method](object.methods) { write::ty_only(cx.tcx, object.methods.(i).node.id, ty::method_ty_to_fn_ty(cx.tcx, method_types.(i))); @@ -825,7 +825,7 @@ mod collect { // an assertion in trans. let args = ty::ty_fn_args(cx.tcx, tpt.ty); i = 0u; - while i < ivec::len[ty::arg](args) { + while i < vec::len[ty::arg](args) { let fld = object.fields.(i); write::ty_only(cx.tcx, fld.id, args.(i).ty); i += 1u; @@ -919,7 +919,7 @@ fn do_autoderef(fcx: &@fn_ctxt, sp: &span, t: &ty::t) -> ty::t { } ty::ty_tag(did, tps) { let variants = ty::tag_variants(fcx.ccx.tcx, did); - if ivec::len(variants) != 1u || ivec::len(variants.(0).args) != 1u + if vec::len(variants) != 1u || vec::len(variants.(0).args) != 1u { ret t1; } @@ -1370,11 +1370,11 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, let arg_types = variant_arg_types(fcx.ccx, pat.span, v_def_ids.var, expected_tps); - let subpats_len = std::ivec::len[@ast::pat](subpats); - if std::ivec::len[ty::t](arg_types) > 0u { + let subpats_len = std::vec::len[@ast::pat](subpats); + if std::vec::len[ty::t](arg_types) > 0u { // N-ary variant. - let arg_len = ivec::len[ty::t](arg_types); + let arg_len = vec::len[ty::t](arg_types); if arg_len != subpats_len { // TODO: note definition of tag variant // TODO (issue #448): Wrap a #fmt string over multiple @@ -1388,7 +1388,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, fcx.ccx.tcx.sess.span_fatal(pat.span, s); } - // TODO: ivec::iter2 + // TODO: vec::iter2 let i = 0u; for subpat: @ast::pat in subpats { @@ -1431,8 +1431,8 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, expected))); } } - let f_count = ivec::len(fields); - let ex_f_count = ivec::len(ex_fields); + let f_count = vec::len(fields); + let ex_f_count = vec::len(ex_fields); if ex_f_count < f_count || !etc && ex_f_count > f_count { fcx.ccx.tcx.sess.span_fatal (pat.span, #fmt("mismatched types: expected a record \ @@ -1443,7 +1443,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, ret str::eq(name, f.ident); } for f: ast::field_pat in fields { - alt ivec::find(bind matches(f.ident, _), ex_fields) { + alt vec::find(bind matches(f.ident, _), ex_fields) { some(field) { check_pat(fcx, map, f.pat, field.mt.ty); } none. { fcx.ccx.tcx.sess.span_fatal(pat.span, @@ -1466,12 +1466,12 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, expected))); } } - let e_count = ivec::len(elts); - if e_count != ivec::len(ex_elts) { + let e_count = vec::len(elts); + if e_count != vec::len(ex_elts) { fcx.ccx.tcx.sess.span_fatal (pat.span, #fmt("mismatched types: expected a tuple \ with %u fields, found one with %u \ - fields", ivec::len(ex_elts), e_count)); + fields", vec::len(ex_elts), e_count)); } let i = 0u; for elt in elts { @@ -1593,8 +1593,8 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } // Check that the correct number of arguments were supplied. - let expected_arg_count = ivec::len[ty::arg](arg_tys); - let supplied_arg_count = ivec::len[option::t[@ast::expr]](args); + let expected_arg_count = vec::len[ty::arg](arg_tys); + let supplied_arg_count = vec::len[option::t[@ast::expr]](args); if expected_arg_count != supplied_arg_count { fcx.ccx.tcx.sess.span_fatal(sp, #fmt("this function takes %u \ @@ -1828,8 +1828,8 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, ty::ty_res(_, inner, _) { oper_t = inner; } ty::ty_tag(id, tps) { let variants = ty::tag_variants(tcx, id); - if ivec::len(variants) != 1u || - ivec::len(variants.(0).args) != 1u { + if vec::len(variants) != 1u || + vec::len(variants.(0).args) != 1u { tcx.sess.span_fatal (expr.span, "can only dereference tags " + "with a single variant which has a " @@ -1877,7 +1877,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } else { // The definition doesn't take type parameters. If the programmer // supplied some, that's an error. - if ivec::len[@ast::ty](pth.node.types) > 0u { + if vec::len[@ast::ty](pth.node.types) > 0u { tcx.sess.span_fatal(expr.span, "this kind of value does not \ take type parameters"); @@ -2116,7 +2116,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, // For each blank argument, add the type of that argument // to the resulting function type. let i = 0u; - while i < ivec::len[option::t[@ast::expr]](args) { + while i < vec::len[option::t[@ast::expr]](args) { alt args.(i) { some(_) {/* no-op */ } none. { arg_tys_1 += ~[arg_tys.(i)]; } @@ -2239,7 +2239,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } ast::expr_tup(elts) { let elt_ts = ~[]; - ivec::reserve(elt_ts, ivec::len(elts)); + vec::reserve(elt_ts, vec::len(elts)); for e in elts { check_expr(fcx, e); let ety = expr_ty(fcx.ccx.tcx, e); @@ -2264,7 +2264,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, alt base { none. { fn get_node(f: &spanned[field]) -> field { f.node } - let typ = ty::mk_rec(tcx, ivec::map(get_node, fields_t)); + let typ = ty::mk_rec(tcx, vec::map(get_node, fields_t)); write::ty_only_fixup(fcx, id, typ); } some(bexpr) { @@ -2304,7 +2304,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, ty::ty_rec(fields) { let ix: uint = ty::field_idx(tcx.sess, expr.span, field, fields); - if ix >= ivec::len[ty::field](fields) { + if ix >= vec::len[ty::field](fields) { tcx.sess.span_fatal(expr.span, "bad index on record"); } write::ty_only_fixup(fcx, id, fields.(ix).mt.ty); @@ -2312,7 +2312,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, ty::ty_obj(methods) { let ix: uint = ty::method_idx(tcx.sess, expr.span, field, methods); - if ix >= ivec::len[ty::method](methods) { + if ix >= vec::len[ty::method](methods) { tcx.sess.span_fatal(expr.span, "bad index on obj"); } let meth = methods.(ix); @@ -2444,7 +2444,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } fcx.ccx.obj_infos += - ~[anon_obj(ivec::map(ast::obj_field_from_anon_obj_field, + ~[anon_obj(vec::map(ast::obj_field_from_anon_obj_field, fields), inner_obj_sty)]; // Whenever an outer method overrides an inner, we need to remove @@ -2474,7 +2474,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, let f = bind filtering_fn(fcx.ccx, _, ao.methods); inner_obj_methods = - std::ivec::filter_map[ty::method, + std::vec::filter_map[ty::method, ty::method](f, inner_obj_methods); method_types += inner_obj_methods; @@ -2487,7 +2487,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, // Write the methods into the node type table. (This happens in // collect::convert for regular objects.) let i = 0u; - while i < ivec::len[@ast::method](ao.methods) { + while i < vec::len[@ast::method](ao.methods) { write::ty_only(tcx, ao.methods.(i).node.id, ty::method_ty_to_fn_ty(tcx, method_types.(i))); @@ -2500,7 +2500,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } // Now remove the info from the stack. - ivec::pop[obj_info](fcx.ccx.obj_infos); + vec::pop[obj_info](fcx.ccx.obj_infos); } ast::expr_uniq(x) { let t = next_ty_var(fcx); @@ -2528,7 +2528,7 @@ fn next_ty_var(fcx: &@fn_ctxt) -> ty::t { } fn get_obj_info(ccx: &@crate_ctxt) -> option::t[obj_info] { - ret ivec::last[obj_info](ccx.obj_infos); + ret vec::last[obj_info](ccx.obj_infos); } fn check_decl_initializer(fcx: &@fn_ctxt, nid: ast::node_id, @@ -2707,7 +2707,7 @@ fn check_item(ccx: @crate_ctxt, it: &@ast::item) { for method: @ast::method in ob.methods { check_method(ccx, method); } // Now remove the info from the stack. - ivec::pop[obj_info](ccx.obj_infos); + vec::pop[obj_info](ccx.obj_infos); } _ {/* nothing to do */ } } @@ -2738,9 +2738,9 @@ fn check_main_fn_ty(tcx: &ty::ctxt, main_id: &ast::node_id) { let main_t = ty::node_id_to_monotype(tcx, main_id); alt ty::struct(tcx, main_t) { ty::ty_fn(ast::proto_fn., args, rs, ast::return., constrs) { - let ok = ivec::len(constrs) == 0u; + let ok = vec::len(constrs) == 0u; ok &= ty::type_is_nil(tcx, rs); - let num_args = ivec::len(args); + let num_args = vec::len(args); ok &= num_args == 0u || num_args == 1u && arg_is_argv_ty(tcx, args.(0)); if !ok { diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index ce20360e9ec..bed8ce31c4c 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -1,6 +1,5 @@ // The Rust abstract syntax tree. -import std::ivec; import std::option; import std::str; import codemap::span; diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index 7e41865afa4..10bf7f478b7 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::uint; import std::str; import std::term; @@ -40,14 +40,14 @@ type lookup_fn = fn(file_pos) -> uint ; fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc { let a = 0u; - let b = ivec::len(map.files); + let b = vec::len(map.files); while b - a > 1u { let m = (a + b) / 2u; if lookup(map.files.(m).start_pos) > pos { b = m; } else { a = m; } } let f = map.files.(a); a = 0u; - b = ivec::len(f.lines); + b = vec::len(f.lines); while b - a > 1u { let m = (a + b) / 2u; if lookup(f.lines.(m)) > pos { b = m; } else { a = m; } @@ -137,8 +137,8 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap, let max_lines = 6u; let elided = false; let display_lines = lines.lines; - if ivec::len(display_lines) > max_lines { - display_lines = ivec::slice(display_lines, 0u, max_lines); + if vec::len(display_lines) > max_lines { + display_lines = vec::slice(display_lines, 0u, max_lines); elided = true; } // Print the offending lines @@ -149,7 +149,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap, io::stdout().write_str(s); } if elided { - let last_line = display_lines.(ivec::len(display_lines) - 1u); + let last_line = display_lines.(vec::len(display_lines) - 1u); let s = #fmt("%s:%u ", fm.name, last_line + 1u); let indent = str::char_len(s); let out = ""; @@ -160,7 +160,7 @@ fn maybe_highlight_lines(sp: &option::t[span], cm: &codemap, // If there's one line at fault we can easily point to the problem - if ivec::len(lines.lines) == 1u { + if vec::len(lines.lines) == 1u { let lo = lookup_char_pos(cm, option::get(sp).lo); let digits = 0u; let num = lines.lines.(0) / 10u; @@ -212,7 +212,7 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines { fn get_line(fm: filemap, line: int, file: &str) -> str { let begin: uint = fm.lines.(line).byte - fm.start_pos.byte; let end: uint; - if line as uint < ivec::len(fm.lines) - 1u { + if line as uint < vec::len(fm.lines) - 1u { end = fm.lines.(line + 1).byte - fm.start_pos.byte; } else { // If we're not done parsing the file, we're at the limit of what's diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 9ad3d8d1b2e..47048ed1951 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::option; import std::map::hashmap; import driver::session::session; @@ -113,7 +113,7 @@ fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: str) -> str { fn expr_to_ident(cx: &ext_ctxt, expr: @ast::expr, error: str) -> ast::ident { alt expr.node { ast::expr_path(p) { - if ivec::len(p.node.types) > 0u || ivec::len(p.node.idents) != 1u { + if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u { cx.span_fatal(expr.span, error); } else { ret p.node.idents.(0); } } diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index 0106f76982b..f21af93668f 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -1,4 +1,3 @@ -import std::ivec; import std::option; import base::*; import syntax::ast; diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index 2a897b570dd..5a53f26a007 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -4,7 +4,7 @@ * should all get sucked into either the compiler syntax extension plugin * interface. */ -import std::ivec; +import std::vec; import std::option; import std::generic_os; import base::*; @@ -16,7 +16,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#env requires arguments of the form `[...]`.") } }; - if ivec::len[@ast::expr](args) != 1u { + if vec::len[@ast::expr](args) != 1u { cx.span_fatal(sp, "malformed #env call"); } // FIXME: if this was more thorough it would manufacture an diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs index 790e892cec2..d5e9fda2c84 100644 --- a/src/comp/syntax/ext/expand.rs +++ b/src/comp/syntax/ext/expand.rs @@ -4,7 +4,7 @@ import std::option::none; import std::option::some; import std::map::hashmap; -import std::ivec; +import std::vec; import syntax::ast::crate; import syntax::ast::expr_; @@ -21,7 +21,7 @@ fn expand_expr(exts: &hashmap[str, syntax_extension], cx: &ext_ctxt, expr_mac(mac) { alt mac.node { mac_invoc(pth, args, body) { - assert (ivec::len(pth.node.idents) > 0u); + assert (vec::len(pth.node.idents) > 0u); let extname = pth.node.idents.(0); alt exts.find(extname) { none. { diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 369fc7be0c3..b8ab57303df 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -5,7 +5,7 @@ * should all get sucked into either the standard library extfmt module or the * compiler syntax extension plugin interface. */ -import std::ivec; +import std::vec; import std::str; import std::option; import std::option::none; @@ -21,7 +21,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr, ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#fmt requires arguments of the form `[...]`.") } }; - if ivec::len[@ast::expr](args) == 0u { + if vec::len[@ast::expr](args) == 0u { cx.span_fatal(sp, "#fmt requires a format string"); } let fmt = @@ -130,7 +130,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], // through the rec that these flags are a member of, so // this is a hack placeholder flag - if ivec::len[@ast::expr](flagexprs) == 0u { + if vec::len[@ast::expr](flagexprs) == 0u { flagexprs += ~[make_rt_path_expr(cx, sp, "flag_none")]; } ret make_vec_expr(cx, sp, flagexprs); @@ -307,7 +307,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], let fmt_sp = args.(0).span; let n = 0u; let tmp_expr = make_new_str(cx, sp, ""); - let nargs = ivec::len[@ast::expr](args); + let nargs = vec::len[@ast::expr](args); for pc: piece in pieces { alt pc { piece_string(s) { diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index 9399f2e8fd4..c32acaf05b3 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::option; import base::*; import syntax::ast; @@ -9,7 +9,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#ident_to_str requires a vector argument .") } }; - if ivec::len[@ast::expr](args) != 1u { + if vec::len[@ast::expr](args) != 1u { cx.span_fatal(sp, "malformed #ident_to_str call"); } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 543cd8b4644..29f474b7878 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -1,7 +1,7 @@ use std; import codemap::span; -import std::ivec; +import std::vec; import std::option; import std::map::hashmap; import std::map::new_str_hash; @@ -33,7 +33,7 @@ import ast::mac_invoc; export add_new_extension; fn path_to_ident(pth: &path) -> option::t[ident] { - if ivec::len(pth.node.idents) == 1u && ivec::len(pth.node.types) == 0u { + if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u { ret some(pth.node.idents.(0u)); } ret none; @@ -103,10 +103,10 @@ fn elts_to_ell(cx: &ext_ctxt, elts: &[@expr]) if res != none { cx.span_fatal(m.span, "only one ellipsis allowed"); } - res = some({pre: ivec::slice(elts, 0u, idx - 1u), + res = some({pre: vec::slice(elts, 0u, idx - 1u), rep: some(elts.(idx - 1u)), - post: ivec::slice(elts, idx + 1u, - ivec::len(elts))}); + post: vec::slice(elts, idx + 1u, + vec::len(elts))}); } _ { } } @@ -286,7 +286,7 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], -> [@expr] { alt elts_to_ell(cx, exprs) { {pre: pre, rep: repeat_me_maybe, post: post} { - let res = ivec::map(recur, pre); + let res = vec::map(recur, pre); alt repeat_me_maybe { none. {} some(repeat_me) { @@ -300,10 +300,10 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], seq(ms, _) { alt repeat { none. { - repeat = some({rep_count: ivec::len(*ms), name: fv}); + repeat = some({rep_count: vec::len(*ms), name: fv}); } some({rep_count: old_len, name: old_name}) { - let len = ivec::len(*ms); + let len = vec::len(*ms); if old_len != len { let msg = #fmt("'%s' occurs %u times, but ", fv, len) + #fmt("'%s' occurs %u times", @@ -327,14 +327,14 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], while idx < rc { *idx_path += ~[idx]; res += ~[recur(repeat_me)]; // whew! - ivec::pop(*idx_path); + vec::pop(*idx_path); idx += 1u; } } } } } - res += ivec::map(recur, post); + res += vec::map(recur, post); ret res; } } @@ -356,7 +356,7 @@ fn transcribe_ident(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], fn transcribe_path(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], p: &path_, fld: ast_fold) -> path_ { // Don't substitute into qualified names. - if ivec::len(p.types) > 0u || ivec::len(p.idents) != 1u { ret p; } + if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret p; } ret alt follow_for_trans(cx, b.find(p.idents.(0)), idx_path) { some(match_ident(id)) { {global: false, idents: ~[id.node], types: ~[]} @@ -375,7 +375,7 @@ fn transcribe_expr(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], ret alt e { expr_path(p) { // Don't substitute into qualified names. - if ivec::len(p.node.types) > 0u || ivec::len(p.node.idents) != 1u + if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u { e } @@ -452,14 +452,14 @@ fn p_t_s_rec(cx: &ext_ctxt, m: &matchable, s: &selector, b: &binders) { expr_vec(p_elts, _, _) { alt elts_to_ell(cx, p_elts) { {pre: pre, rep: some(repeat_me), post: post} { - p_t_s_r_length(cx, ivec::len(pre) + ivec::len(post), + p_t_s_r_length(cx, vec::len(pre) + vec::len(post), true, s, b); - if(ivec::len(pre) > 0u) { + if(vec::len(pre) > 0u) { p_t_s_r_actual_vector(cx, pre, true, s, b); } - p_t_s_r_ellipses(cx, repeat_me, ivec::len(pre), s, b); + p_t_s_r_ellipses(cx, repeat_me, vec::len(pre), s, b); - if(ivec::len(post) > 0u) { + if(vec::len(post) > 0u) { cx.span_unimpl(e.span, "matching after `...` not yet supported"); } @@ -468,7 +468,7 @@ fn p_t_s_rec(cx: &ext_ctxt, m: &matchable, s: &selector, b: &binders) { if post != ~[] { cx.bug("elts_to_ell provided an invalid result"); } - p_t_s_r_length(cx, ivec::len(pre), false, s, b); + p_t_s_r_length(cx, vec::len(pre), false, s, b); p_t_s_r_actual_vector(cx, pre, false, s, b); } } @@ -534,7 +534,7 @@ fn p_t_s_r_path(cx: &ext_ctxt, p: &path, s: &selector, b: &binders) { } fn block_to_ident(blk: &blk_) -> option::t[ident] { - if ivec::len(blk.stmts) != 0u { ret none; } + if vec::len(blk.stmts) != 0u { ret none; } ret alt blk.expr { some(expr) { alt expr.node { expr_path(pth) { path_to_ident(pth) } _ { none } } @@ -610,7 +610,7 @@ fn p_t_s_r_ellipses(cx: &ext_ctxt, repeat_me: @expr, offset: uint, expr_vec(arg_elts, _, _) { let elts = ~[]; let idx = offset; - while idx < ivec::len(arg_elts) { + while idx < vec::len(arg_elts) { elts += ~[leaf(match_expr(arg_elts.(idx)))]; idx += 1u; } @@ -637,7 +637,7 @@ fn p_t_s_r_length(cx: &ext_ctxt, len: uint, at_least: bool, s: selector, match_expr(e) { alt e.node { expr_vec(arg_elts, _, _) { - let actual_len = ivec::len(arg_elts); + let actual_len = vec::len(arg_elts); if (at_least && actual_len >= len) || actual_len == len { some(leaf(match_exact)) } else { none } @@ -655,7 +655,7 @@ fn p_t_s_r_length(cx: &ext_ctxt, len: uint, at_least: bool, s: selector, fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], repeat_after: bool, s: &selector, b: &binders) { let idx: uint = 0u; - while idx < ivec::len(elts) { + while idx < vec::len(elts) { fn select(cx: &ext_ctxt, m: &matchable, idx: uint) -> match_result { ret alt m { match_expr(e) { @@ -689,7 +689,7 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr, for arg: @expr in args { alt arg.node { expr_vec(elts, mut, seq_kind) { - if ivec::len(elts) != 2u { + if vec::len(elts) != 2u { cx.span_fatal((*arg).span, "extension clause must consist of [" + "macro invocation, expansion body]"); diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index 944915384ee..94dca5ef4cf 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -1,7 +1,7 @@ import syntax::codemap::span; import ast::*; -import std::ivec; +import std::vec; import std::option; export ast_fold_precursor; @@ -111,7 +111,7 @@ fn fold_meta_item_(mi: &@meta_item, fld: ast_fold) -> @meta_item { meta_word(id) { meta_word(fld.fold_ident(id)) } meta_list(id, mis) { let fold_meta_item = bind fold_meta_item_(_, fld); - meta_list(id, ivec::map(fold_meta_item, mis)) + meta_list(id, vec::map(fold_meta_item, mis)) } meta_name_value(id, s) { meta_name_value(fld.fold_ident(id), s) @@ -154,10 +154,10 @@ fn noop_fold_crate(c: &crate_, fld: ast_fold) -> crate_ { let fold_meta_item = bind fold_meta_item_(_, fld); let fold_attribute = bind fold_attribute_(_, fold_meta_item); - ret {directives: ivec::map(fld.fold_crate_directive, c.directives), + ret {directives: vec::map(fld.fold_crate_directive, c.directives), module: fld.fold_mod(c.module), - attrs: ivec::map(fold_attribute, c.attrs), - config: ivec::map(fold_meta_item, c.config)}; + attrs: vec::map(fold_attribute, c.attrs), + config: vec::map(fold_meta_item, c.config)}; } fn noop_fold_crate_directive(cd: &crate_directive_, fld: ast_fold) -> @@ -168,7 +168,7 @@ fn noop_fold_crate_directive(cd: &crate_directive_, fld: ast_fold) -> } cdir_dir_mod(id, fname, cds, attrs) { cdir_dir_mod(fld.fold_ident(id), fname, - ivec::map(fld.fold_crate_directive, cds), attrs) + vec::map(fld.fold_crate_directive, cds), attrs) } cdir_view_item(vi) { cdir_view_item(fld.fold_view_item(vi)) } cdir_syntax(_) { cd } @@ -187,19 +187,19 @@ fn noop_fold_native_item(ni: &@native_item, fld: ast_fold) -> @native_item { let fold_attribute = bind fold_attribute_(_, fold_meta_item); ret @{ident: fld.fold_ident(ni.ident), - attrs: ivec::map(fold_attribute, ni.attrs), + attrs: vec::map(fold_attribute, ni.attrs), node: alt ni.node { native_item_ty. { native_item_ty } native_item_fn(st, fdec, typms) { native_item_fn(st, - {inputs: ivec::map(fold_arg, fdec.inputs), + {inputs: vec::map(fold_arg, fdec.inputs), output: fld.fold_ty(fdec.output), purity: fdec.purity, il: fdec.il, cf: fdec.cf, constraints: - ivec::map(fld.fold_constr, + vec::map(fld.fold_constr, fdec.constraints)}, typms) } }, @@ -212,7 +212,7 @@ fn noop_fold_item(i: &@item, fld: ast_fold) -> @item { let fold_attribute = bind fold_attribute_(_, fold_meta_item); ret @{ident: fld.fold_ident(i.ident), - attrs: ivec::map(fold_attribute, i.attrs), + attrs: vec::map(fold_attribute, i.attrs), id: i.id, node: fld.fold_item_underscore(i.node), span: i.span}; @@ -234,11 +234,11 @@ fn noop_fold_item_underscore(i: &item_, fld: ast_fold) -> item_ { item_native_mod(nm) { item_native_mod(fld.fold_native_mod(nm)) } item_ty(t, typms) { item_ty(fld.fold_ty(t), typms) } item_tag(variants, typms) { - item_tag(ivec::map(fld.fold_variant, variants), typms) + item_tag(vec::map(fld.fold_variant, variants), typms) } item_obj(o, typms, d) { - item_obj({fields: ivec::map(fold_obj_field, o.fields), - methods: ivec::map(fld.fold_method, o.methods)}, + item_obj({fields: vec::map(fold_obj_field, o.fields), + methods: vec::map(fld.fold_method, o.methods)}, typms, d) } item_res(dtor, did, typms, cid) { @@ -253,7 +253,7 @@ fn noop_fold_method(m: &method_, fld: ast_fold) -> method_ { fn noop_fold_block(b: &blk_, fld: ast_fold) -> blk_ { - ret {stmts: ivec::map(fld.fold_stmt, b.stmts), + ret {stmts: vec::map(fld.fold_stmt, b.stmts), expr: option::map(fld.fold_expr, b.expr), id: b.id}; } @@ -269,7 +269,7 @@ fn noop_fold_stmt(s: &stmt_, fld: ast_fold) -> stmt_ { } fn noop_fold_arm(a: &arm, fld: ast_fold) -> arm { - ret {pats: ivec::map(fld.fold_pat, a.pats), + ret {pats: vec::map(fld.fold_pat, a.pats), body: fld.fold_block(a.body)}; } @@ -279,7 +279,7 @@ fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ { pat_bind(ident) { pat_bind(fld.fold_ident(ident)) } pat_lit(_) { p } pat_tag(pth, pats) { - pat_tag(fld.fold_path(pth), ivec::map(fld.fold_pat, pats)) + pat_tag(fld.fold_path(pth), vec::map(fld.fold_pat, pats)) } pat_rec(fields, etc) { let fs = ~[]; @@ -289,7 +289,7 @@ fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ { pat_rec(fs, etc) } pat_tup(elts) { - pat_tup(ivec::map(fld.fold_pat, elts)) + pat_tup(vec::map(fld.fold_pat, elts)) } pat_box(inner) { pat_box(fld.fold_pat(inner)) } }; @@ -297,7 +297,7 @@ fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ { fn noop_fold_decl(d: &decl_, fld: ast_fold) -> decl_ { ret alt d { - decl_local(ls) { decl_local(ivec::map(fld.fold_local, ls)) } + decl_local(ls) { decl_local(vec::map(fld.fold_local, ls)) } decl_item(it) { decl_item(fld.fold_item(it)) } } } @@ -327,10 +327,10 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ { alt ao.fields { option::none. { ao.fields } option::some(v) { - option::some(ivec::map(fold_anon_obj_field, v)) + option::some(vec::map(fold_anon_obj_field, v)) } }, - methods: ivec::map(fld.fold_method, ao.methods), + methods: vec::map(fld.fold_method, ao.methods), inner_obj: option::map(fld.fold_expr, ao.inner_obj)} } let fold_anon_obj = bind fold_anon_obj_(_, fld); @@ -343,11 +343,11 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ { expr_vec(fld.map_exprs(fld.fold_expr, exprs), mut, seq_kind) } expr_rec(fields, maybe_expr) { - expr_rec(ivec::map(fold_field, fields), + expr_rec(vec::map(fold_field, fields), option::map(fld.fold_expr, maybe_expr)) } expr_tup(elts) { - expr_tup(ivec::map(fld.fold_expr, elts)) + expr_tup(vec::map(fld.fold_expr, elts)) } expr_call(f, args) { expr_call(fld.fold_expr(f), fld.map_exprs(fld.fold_expr, args)) @@ -355,7 +355,7 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ { expr_self_method(id) { expr_self_method(fld.fold_ident(id)) } expr_bind(f, args) { let opt_map_se = bind option::map(fld.fold_expr, _); - expr_bind(fld.fold_expr(f), ivec::map(opt_map_se, args)) + expr_bind(fld.fold_expr(f), vec::map(opt_map_se, args)) } expr_spawn(spawn_dom, name, f, args) { expr_spawn(spawn_dom, name, fld.fold_expr(f), @@ -390,7 +390,7 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ { expr_do_while(fld.fold_block(blk), fld.fold_expr(expr)) } expr_alt(expr, arms) { - expr_alt(fld.fold_expr(expr), ivec::map(fld.fold_arm, arms)) + expr_alt(fld.fold_expr(expr), vec::map(fld.fold_arm, arms)) } expr_fn(f) { expr_fn(fld.fold_fn(f)) } expr_block(blk) { expr_block(fld.fold_block(blk)) } @@ -459,27 +459,27 @@ fn noop_fold_fn(f: &_fn, fld: ast_fold) -> _fn { let fold_arg = bind fold_arg_(_, fld); ret {decl: - {inputs: ivec::map(fold_arg, f.decl.inputs), + {inputs: vec::map(fold_arg, f.decl.inputs), output: fld.fold_ty(f.decl.output), purity: f.decl.purity, il: f.decl.il, cf: f.decl.cf, - constraints: ivec::map(fld.fold_constr, f.decl.constraints)}, + constraints: vec::map(fld.fold_constr, f.decl.constraints)}, proto: f.proto, body: fld.fold_block(f.body)}; } // ...nor do modules fn noop_fold_mod(m: &_mod, fld: ast_fold) -> _mod { - ret {view_items: ivec::map(fld.fold_view_item, m.view_items), - items: ivec::map(fld.fold_item, m.items)}; + ret {view_items: vec::map(fld.fold_view_item, m.view_items), + items: vec::map(fld.fold_item, m.items)}; } fn noop_fold_native_mod(nm: &native_mod, fld: ast_fold) -> native_mod { ret {native_name: nm.native_name, abi: nm.abi, - view_items: ivec::map(fld.fold_view_item, nm.view_items), - items: ivec::map(fld.fold_native_item, nm.items)} + view_items: vec::map(fld.fold_view_item, nm.view_items), + items: vec::map(fld.fold_native_item, nm.items)} } fn noop_fold_variant(v: &variant_, fld: ast_fold) -> variant_ { @@ -487,15 +487,15 @@ fn noop_fold_variant(v: &variant_, fld: ast_fold) -> variant_ { ret {ty: fld.fold_ty(va.ty), id: va.id}; } let fold_variant_arg = bind fold_variant_arg_(_, fld); - ret {name: v.name, args: ivec::map(fold_variant_arg, v.args), id: v.id}; + ret {name: v.name, args: vec::map(fold_variant_arg, v.args), id: v.id}; } fn noop_fold_ident(i: &ident, fld: ast_fold) -> ident { ret i; } fn noop_fold_path(p: &path_, fld: ast_fold) -> path_ { ret {global: p.global, - idents: ivec::map(fld.fold_ident, p.idents), - types: ivec::map(fld.fold_ty, p.types)}; + idents: vec::map(fld.fold_ident, p.idents), + types: vec::map(fld.fold_ty, p.types)}; } fn noop_fold_local(l: &local_, fld: ast_fold) -> local_ { @@ -514,7 +514,7 @@ fn noop_fold_local(l: &local_, fld: ast_fold) -> local_ { /* temporarily eta-expand because of a compiler bug with using `fn[T]` as a value */ fn noop_map_exprs(f: fn(&@expr) -> @expr , es: [@expr]) -> [@expr] { - ret ivec::map(f, es); + ret vec::map(f, es); } fn noop_id(i: node_id) -> node_id { ret i; } diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index edeb6df407b..8b7eaee1534 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -1,7 +1,7 @@ import std::io; import std::int; -import std::ivec; +import std::vec; import std::str; import std::map; import std::map::hashmap; @@ -669,7 +669,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt { } let style = if code_to_the_left { trailing } else { isolated }; consume_non_eol_whitespace(rdr); - if !rdr.is_eof() && rdr.curr() != '\n' && ivec::len(lines) == 1u { + if !rdr.is_eof() && rdr.curr() != '\n' && vec::len(lines) == 1u { style = mixed; } log "<<< block comment"; diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 4569fe7d485..2d61f6b214a 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1,6 +1,6 @@ import std::io; -import std::ivec; +import std::vec; import std::str; import std::option; import std::option::some; @@ -87,18 +87,18 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: lexer::reader, fn peek() -> token::token { ret tok; } fn bump() { last_tok_span = tok_span; - if ivec::len(buffer) == 0u { + if vec::len(buffer) == 0u { let next = lexer::next_token(rdr); tok = next.tok; tok_span = ast::mk_sp(next.chpos, rdr.get_chpos()); } else { - let next = ivec::pop(buffer); + let next = vec::pop(buffer); tok = next.tok; tok_span = next.span; } } fn look_ahead(distance: uint) -> token::token { - while ivec::len(buffer) < distance { + while vec::len(buffer) < distance { let next = lexer::next_token(rdr); let sp = ast::mk_sp(next.chpos, rdr.get_chpos()); buffer = ~[{tok: next.tok, span: sp}] + buffer; @@ -523,7 +523,7 @@ fn parse_ty(p: &parser, colons_before_params: bool) -> @ast::ty { p.bump(); ts += ~[parse_ty(p, false)]; } - if ivec::len(ts) == 1u { + if vec::len(ts) == 1u { t = ts.(0).node; } else { t = ast::ty_tup(ts); @@ -791,7 +791,7 @@ fn parse_bottom_expr(p: &parser) -> @ast::expr { } hi = p.get_hi_pos(); expect(p, token::RPAREN); - if ivec::len(es) == 1u { + if vec::len(es) == 1u { ret mk_expr(p, lo, hi, es.(0).node); } else { ret mk_expr(p, lo, hi, ast::expr_tup(es)); @@ -1023,7 +1023,7 @@ fn parse_syntax_ext(p: &parser) -> @ast::expr { fn parse_syntax_ext_naked(p: &parser, lo: uint) -> @ast::expr { let pth = parse_path(p); - if ivec::len(pth.node.idents) == 0u { + if vec::len(pth.node.idents) == 0u { p.fatal("expected a syntax expander name"); } //temporary for a backwards-compatible cycle: @@ -1474,7 +1474,7 @@ fn parse_pat(p: &parser) -> @ast::pat { p.bump(); fields += ~[parse_pat(p)]; } - if ivec::len(fields) == 1u { expect(p, token::COMMA); } + if vec::len(fields) == 1u { expect(p, token::COMMA); } hi = p.get_hi_pos(); expect(p, token::RPAREN); pat = ast::pat_tup(fields); @@ -1570,7 +1570,7 @@ fn parse_source_stmt(p: &parser) -> @ast::stmt { let maybe_item = parse_item(p, item_attrs); // If we have attributes then we should have an item - if ivec::len(item_attrs) > 0u { + if vec::len(item_attrs) > 0u { alt maybe_item { some(_) {/* fallthrough */ } _ { ret p.fatal("expected item"); } @@ -1899,7 +1899,7 @@ fn parse_mod_items(p: &parser, term: token::token, first_item_attrs: &[ast::attribute]) -> ast::_mod { // Shouldn't be any view items since we've already parsed an item attr let view_items = - if ivec::len(first_item_attrs) == 0u { parse_view(p) } else { ~[] }; + if vec::len(first_item_attrs) == 0u { parse_view(p) } else { ~[] }; let items: [@ast::item] = ~[]; let initial_attrs = first_item_attrs; while p.peek() != term { @@ -1982,7 +1982,7 @@ fn parse_native_mod_items(p: &parser, native_name: &str, abi: ast::native_abi, -> ast::native_mod { // Shouldn't be any view items since we've already parsed an item attr let view_items = - if ivec::len(first_item_attrs) == 0u { + if vec::len(first_item_attrs) == 0u { parse_native_view(p) } else { ~[] }; let items: [@ast::native_item] = ~[]; @@ -2287,7 +2287,7 @@ fn parse_rest_import_name(p: &parser, first: ast::ident, if glob { ret ast::view_item_import_glob(identifiers, p.get_id()); } else { - let len = ivec::len(identifiers); + let len = vec::len(identifiers); ret ast::view_item_import(identifiers.(len - 1u), identifiers, p.get_id()); } @@ -2412,7 +2412,7 @@ fn parse_crate_directive(p: &parser, first_outer_attr: &[ast::attribute]) -> // Collect the next attributes let outer_attrs = first_outer_attr + parse_outer_attributes(p); // In a crate file outer attributes are only going to apply to mods - let expect_mod = ivec::len(outer_attrs) > 0u; + let expect_mod = vec::len(outer_attrs) > 0u; let lo = p.get_lo_pos(); if expect_mod || is_word(p, "mod") { @@ -2467,7 +2467,7 @@ fn parse_crate_directives(p: &parser, term: token::token, // This is pretty ugly. If we have an outer attribute then we can't accept // seeing the terminator next, so if we do see it then fail the same way // parse_crate_directive would - if ivec::len(first_outer_attr) > 0u && p.peek() == term { + if vec::len(first_outer_attr) > 0u && p.peek() == term { expect_word(p, "mod"); } diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index 98770cf0e46..bd67c552cbb 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -1,6 +1,6 @@ import std::io; -import std::ivec; +import std::vec; import std::str; @@ -76,8 +76,8 @@ fn tok_str(t: token) -> str { fn buf_str(toks: &[mutable token], szs: &[mutable int], left: uint, right: uint, lim: uint) -> str { - let n = ivec::len(toks); - assert (n == ivec::len(szs)); + let n = vec::len(toks); + assert (n == vec::len(szs)); let i = left; let L = lim; let s = "["; @@ -104,9 +104,9 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer { let n: uint = 3u * linewidth; log #fmt("mk_printer %u", linewidth); - let token: [mutable token] = ivec::init_elt_mut(EOF, n); - let size: [mutable int] = ivec::init_elt_mut(0, n); - let scan_stack: [mutable uint] = ivec::init_elt_mut(0u, n); + let token: [mutable token] = vec::init_elt_mut(EOF, n); + let size: [mutable int] = vec::init_elt_mut(0, n); + let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n); let print_stack: [print_stack_elt] = ~[]; ret printer(out, n, linewidth as int, // margin linewidth as int, // space @@ -403,7 +403,7 @@ obj printer(out: io::writer, pending_indentation += amount; } fn top() -> print_stack_elt { - let n = ivec::len(print_stack); + let n = vec::len(print_stack); let top: print_stack_elt = {offset: 0, pbreak: broken(inconsistent)}; if n != 0u { top = print_stack.(n - 1u); } ret top; @@ -432,8 +432,8 @@ obj printer(out: io::writer, } END. { log "print END -> pop END"; - assert (ivec::len(print_stack) != 0u); - ivec::pop(print_stack); + assert (vec::len(print_stack) != 0u); + vec::pop(print_stack); } BREAK(b) { let top = self.top(); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index e0389c47874..437b9652261 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1,5 +1,5 @@ -import std::ivec; +import std::vec; import std::int; import std::io; import std::str; @@ -50,7 +50,7 @@ type ps = fn ibox(s: &ps, u: uint) { s.boxes += ~[pp::inconsistent]; pp::ibox(s.s, u); } -fn end(s: &ps) { ivec::pop(s.boxes); pp::end(s.s); } +fn end(s: &ps) { vec::pop(s.boxes); pp::end(s.s); } fn rust_printer(writer: io::writer) -> ps { let boxes: [pp::breaks] = ~[]; @@ -229,7 +229,7 @@ fn commasep[IN](s: &ps, b: breaks, elts: &[IN], op: fn(&ps, &IN) ) { fn commasep_cmnt[IN](s: &ps, b: breaks, elts: &[IN], op: fn(&ps, &IN) , get_span: fn(&IN) -> codemap::span ) { box(s, 0u, b); - let len = ivec::len[IN](elts); + let len = vec::len[IN](elts); let i = 0u; for elt: IN in elts { maybe_print_comment(s, get_span(elt).hi); @@ -454,9 +454,9 @@ fn print_item(s: &ps, item: &@ast::item) { } ast::item_tag(variants, params) { let newtype = - ivec::len(variants) == 1u && + vec::len(variants) == 1u && str::eq(item.ident, variants.(0).node.name) && - ivec::len(variants.(0).node.args) == 1u; + vec::len(variants.(0).node.args) == 1u; if newtype { ibox(s, indent_unit); word_space(s, "tag"); @@ -475,7 +475,7 @@ fn print_item(s: &ps, item: &@ast::item) { space(s.s); maybe_print_comment(s, v.span.lo); word(s.s, v.node.name); - if ivec::len(v.node.args) > 0u { + if vec::len(v.node.args) > 0u { popen(s); fn print_variant_arg(s: &ps, arg: &ast::variant_arg) { print_type(s, arg.ty); @@ -725,7 +725,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) { } if mut == ast::mut { word(s.s, "mutable"); - if ivec::len(exprs) > 0u { nbsp(s); } + if vec::len(exprs) > 0u { nbsp(s); } } commasep_exprs(s, inconsistent, exprs); word(s.s, "]"); @@ -745,7 +745,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) { commasep_cmnt(s, consistent, fields, print_field, get_span); alt wth { some(expr) { - if ivec::len(fields) > 0u { space(s.s); } + if vec::len(fields) > 0u { space(s.s); } ibox(s, indent_unit); word_space(s, "with"); print_expr(s, expr); @@ -1130,7 +1130,7 @@ fn print_path(s: &ps, path: &ast::path) { if first { first = false; } else { word(s.s, "::"); } word(s.s, id); } - if ivec::len(path.node.types) > 0u { + if vec::len(path.node.types) > 0u { word(s.s, "["); commasep(s, inconsistent, path.node.types, print_type); word(s.s, "]"); @@ -1147,7 +1147,7 @@ fn print_pat(s: &ps, pat: &@ast::pat) { ast::pat_lit(lit) { print_literal(s, lit); } ast::pat_tag(path, args) { print_path(s, path); - if ivec::len(args) > 0u { + if vec::len(args) > 0u { popen(s); commasep(s, inconsistent, args, print_pat); pclose(s); @@ -1165,7 +1165,7 @@ fn print_pat(s: &ps, pat: &@ast::pat) { fn get_span(f: &ast::field_pat) -> codemap::span { ret f.pat.span; } commasep_cmnt(s, consistent, fields, print_field, get_span); if etc { - if ivec::len(fields) != 0u { word_space(s, ","); } + if vec::len(fields) != 0u { word_space(s, ","); } word(s.s, "_"); } word(s.s, "}"); @@ -1243,7 +1243,7 @@ fn print_kind(s: &ps, kind: ast::kind) { } fn print_type_params(s: &ps, params: &[ast::ty_param]) { - if ivec::len(params) > 0u { + if vec::len(params) > 0u { word(s.s, "["); fn printParam(s: &ps, param: &ast::ty_param) { print_kind(s, param.kind); @@ -1280,7 +1280,7 @@ fn print_view_item(s: &ps, item: &@ast::view_item) { ast::view_item_use(id, mta, _) { head(s, "use"); word(s.s, id); - if ivec::len(mta) > 0u { + if vec::len(mta) > 0u { popen(s); commasep(s, consistent, mta, print_meta_item); pclose(s); @@ -1288,7 +1288,7 @@ fn print_view_item(s: &ps, item: &@ast::view_item) { } ast::view_item_import(id, ids, _) { head(s, "import"); - if !str::eq(id, ids.(ivec::len(ids) - 1u)) { + if !str::eq(id, ids.(vec::len(ids) - 1u)) { word_space(s, id); word_space(s, "="); } @@ -1419,7 +1419,7 @@ fn print_remaining_comments(s: &ps) { } fn in_cbox(s: &ps) -> bool { - let len = ivec::len(s.boxes); + let len = vec::len(s.boxes); if len == 0u { ret false; } ret s.boxes.(len - 1u) == pp::consistent; } @@ -1465,7 +1465,7 @@ fn lit_to_str(l: &@ast::lit) -> str { be to_str(l, print_literal); } fn next_lit(s: &ps) -> option::t[lexer::lit] { alt s.literals { some(lits) { - if s.cur_lit < ivec::len(lits) { + if s.cur_lit < vec::len(lits) { ret some(lits.(s.cur_lit)); } else { ret none[lexer::lit]; } } @@ -1490,7 +1490,7 @@ fn maybe_print_comment(s: &ps, pos: uint) { fn print_comment(s: &ps, cmnt: lexer::cmnt) { alt cmnt.style { lexer::mixed. { - assert (ivec::len(cmnt.lines) == 1u); + assert (vec::len(cmnt.lines) == 1u); zerobreak(s.s); word(s.s, cmnt.lines.(0)); zerobreak(s.s); @@ -1501,7 +1501,7 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) { } lexer::trailing. { word(s.s, " "); - if ivec::len(cmnt.lines) == 1u { + if vec::len(cmnt.lines) == 1u { word(s.s, cmnt.lines.(0)); hardbreak(s.s); } else { @@ -1557,7 +1557,7 @@ fn to_str[T](t: &T, f: fn(&ps, &T) ) -> str { fn next_comment(s: &ps) -> option::t[lexer::cmnt] { alt s.comments { some(cmnts) { - if s.cur_cmnt < ivec::len(cmnts) { + if s.cur_cmnt < vec::len(cmnts) { ret some(cmnts.(s.cur_cmnt)); } else { ret none[lexer::cmnt]; } } diff --git a/src/comp/syntax/untyped_ast.rs b/src/comp/syntax/untyped_ast.rs index 4ae7ef38f8d..39982ec4ca4 100644 --- a/src/comp/syntax/untyped_ast.rs +++ b/src/comp/syntax/untyped_ast.rs @@ -1,5 +1,5 @@ import std::ivec; -import std::ivec::map; +import std::vec::map; import std::option; import std::option::some; import std::option::none; diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 7f95d0ef0e7..3dbda76f5d9 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -1,7 +1,7 @@ // An "interner" is a data structure that associates values with uint tags and // allows bidirectional lookup; i.e. given a value, one can easily find the // type, and vice versa. -import std::ivec; +import std::vec; import std::map; import std::map::hashmap; import std::map::hashfn; @@ -25,7 +25,7 @@ fn intern[@T](itr: &interner[T], val: &T) -> uint { alt itr.map.find(val) { some(idx) { ret idx; } none. { - let new_idx = ivec::len[T](itr.vect); + let new_idx = vec::len[T](itr.vect); itr.map.insert(val, new_idx); itr.vect += ~[val]; ret new_idx; @@ -35,5 +35,5 @@ fn intern[@T](itr: &interner[T], val: &T) -> uint { fn get[T](itr: &interner[T], idx: uint) -> T { ret itr.vect.(idx); } -fn len[T](itr : &interner[T]) -> uint { ret ivec::len(itr.vect); } +fn len[T](itr : &interner[T]) -> uint { ret vec::len(itr.vect); } diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index fe6fc00ae6f..b61dad50dad 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -154,7 +154,7 @@ fn call_kind_str(c: call_kind) -> str { } fn is_main_name(path: &[str]) -> bool { - str::eq(option::get(std::ivec::last(path)), "main") + str::eq(option::get(std::vec::last(path)), "main") } // FIXME mode this to std::float when editing the stdlib no longer diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index faa9195b35b..016056152a2 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -1,4 +1,4 @@ -import std::ivec; +import std::vec; import std::str; import std::int; import std::option; @@ -112,7 +112,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str { // The user should never see this if the cname is set properly! s += "<tag#" + int::str(id.crate) + ":" + int::str(id.node) + ">"; - if ivec::len[t](tps) > 0u { + if vec::len[t](tps) > 0u { let strs: [str] = ~[]; for typ: t in tps { strs += ~[ty_to_str(cx, typ)]; } s += "[" + str::connect(strs, ",") + "]"; |
