diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index b2ae862dc74..28ad53f7555 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -150,9 +150,9 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str, time(time_passes, "freevar finding", bind freevars::annotate_freevars(sess, d, crate)); let ty_cx = ty::mk_ctxt(sess, d, ast_map, freevars); - time[()](time_passes, "typechecking", + time::<()>(time_passes, "typechecking", bind typeck::check_crate(ty_cx, crate)); - time[()](time_passes, "alt checking", + time::<()>(time_passes, "alt checking", bind middle::check_alt::check_crate(ty_cx, crate)); if sess.get_opts().run_typestate { time(time_passes, "typestate checking", @@ -160,15 +160,15 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str, } time(time_passes, "alias checking", bind middle::alias::check_crate(ty_cx, crate)); - time[()](time_passes, "kind checking", + time::<()>(time_passes, "kind checking", bind kind::check_crate(ty_cx, crate)); if sess.get_opts().no_trans { ret; } let llmod = - time[llvm::llvm::ModuleRef](time_passes, "translation", + time::(time_passes, "translation", bind trans::trans_crate(sess, crate, ty_cx, output, ast_map)); - time[()](time_passes, "LLVM passes", + time::<()>(time_passes, "LLVM passes", bind link::write::run_passes(sess, llmod, output)); } @@ -459,14 +459,14 @@ fn main(args: vec) { } let sopts = build_session_options(binary, match, binary_dir); let sess = build_session(sopts); - let n_inputs = vec::len[str](match.free); + let n_inputs = vec::len::(match.free); let output_file = getopts::opt_maybe_str(match, "o"); let glue = opt_present(match, "glue"); if glue { if n_inputs > 0u { sess.fatal("No input files allowed with --glue."); } - let out = option::from_maybe[str]("glue.bc", output_file); + let out = option::from_maybe::("glue.bc", output_file); middle::trans::make_common_glue(sess, out); ret; } @@ -479,26 +479,28 @@ fn main(args: vec) { let saved_out_filename: str = ""; let cfg = build_configuration(sess, binary, ifile); let expand = - option::map[str, - pp_mode](bind parse_pretty(sess, _), - getopts::opt_default(match, "expand", "normal")); + option::map::(bind parse_pretty(sess, _), + getopts::opt_default(match, "expand", + "normal")); alt expand { - some[pp_mode](ppm) { + some::(ppm) { pretty_print_input(sess, cfg, ifile, ppm, true); ret; } - none[pp_mode]. {/* continue */ } + none::. {/* continue */ } } let pretty = - option::map[str, - pp_mode](bind parse_pretty(sess, _), - getopts::opt_default(match, "pretty", "normal")); + option::map::(bind parse_pretty(sess, _), + getopts::opt_default(match, "pretty", + "normal")); alt pretty { - some[pp_mode](ppm) { + some::(ppm) { pretty_print_input(sess, cfg, ifile, ppm, false); ret; } - none[pp_mode]. {/* continue */ } + none::. {/* continue */ } } let ls = opt_present(match, "ls"); if ls { diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 6e6b0095400..c06e1810497 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -178,7 +178,7 @@ fn remove_meta_items_by_name(items: &[@ast::meta_item], name: str) -> fn require_unique_names(sess: &session::session, metas: &[@ast::meta_item]) { - let map = map::mk_hashmap[str, ()](str::hash, str::eq); + let map = map::mk_hashmap::(str::hash, str::eq); for meta: @ast::meta_item in metas { let name = get_meta_item_name(meta); if map.contains_key(name) { diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index 12bcb5ad5fa..4b8653088ee 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -1303,7 +1303,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, ValueRef { assert (!*terminated); let phi = llvm::LLVMBuildPhi(B, Ty, str::buf("")); - assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs)); + assert (vec::len::(vals) == vec::len::(bbs)); llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs), vec::len(vals)); ret phi; @@ -1311,7 +1311,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, fn AddIncomingToPhi(phi: ValueRef, vals: &[ValueRef], bbs: &[BasicBlockRef]) { - assert (vec::len[ValueRef](vals) == vec::len[BasicBlockRef](bbs)); + assert (vec::len::(vals) == vec::len::(bbs)); llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs), vec::len(vals)); } @@ -1440,7 +1440,7 @@ obj type_names(type_names: std::map::hashmap, } fn mk_type_names() -> type_names { - let nt = std::map::new_str_hash[TypeRef](); + let nt = std::map::new_str_hash::(); fn hash(t: &TypeRef) -> uint { ret t as uint; } @@ -1448,7 +1448,7 @@ fn mk_type_names() -> type_names { let hasher: std::map::hashfn = hash; let eqer: std::map::eqfn = eq; - let tn = std::map::mk_hashmap[TypeRef, str](hasher, eqer); + let tn = std::map::mk_hashmap::(hasher, eqer); ret type_names(tn, nt); } @@ -1503,7 +1503,7 @@ 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] = vec::init_elt[TypeRef](0 as TypeRef, n_args); + let args: [TypeRef] = vec::init_elt::(0 as TypeRef, n_args); llvm::LLVMGetParamTypes(ty, vec::to_ptr(args)); s += tys_str(names, outer, args); s += ") -> "; @@ -1515,7 +1515,7 @@ 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] = vec::init_elt[TypeRef](0 as TypeRef, n_elts); + let elts: [TypeRef] = vec::init_elt::(0 as TypeRef, n_elts); llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts)); s += tys_str(names, outer, elts); 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 = vec::len[TypeRef](outer0) - i; + let n: uint = vec::len::(outer0) - i; ret "*\\" + std::int::str(n as int); } } diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index 58e85e90440..4adceacdfde 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -32,7 +32,7 @@ export list_file_metadata; fn read_crates(sess: session::session, crate: &ast::crate) { let e = @{sess: sess, - crate_cache: @std::map::new_str_hash[int](), + crate_cache: @std::map::new_str_hash::(), library_search_paths: sess.get_opts().library_search_paths, mutable next_crate_num: 1}; let v = @@ -186,7 +186,7 @@ fn find_library_crate_aux(nn: &{prefix: str, suffix: str}, crate_name: str, fn get_metadata_section(filename: str) -> option::t<@[u8]> { let b = str::buf(filename); let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(b); - if mb as int == 0 { ret option::none[@[u8]]; } + if mb as int == 0 { ret option::none::<@[u8]>; } let of = mk_object_file(mb); let si = mk_section_iter(of.llof); while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False { @@ -196,11 +196,11 @@ 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]](@vec::unsafe::from_buf(cvbuf, csz)); + ret option::some::<@[u8]>(@vec::unsafe::from_buf(cvbuf, csz)); } llvm::LLVMMoveToNextSection(si.llsi); } - ret option::none[@[u8]]; + ret option::none::<@[u8]>; } fn load_library_crate(sess: &session::session, span: span, ident: &ast::ident, @@ -249,7 +249,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map { log "resolving deps of external crate"; // The map from crate numbers in the crate we're resolving to local crate // numbers - let cnum_map = new_int_hash[ast::crate_num](); + let cnum_map = new_int_hash::(); for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) { let extrn_cnum = dep.cnum; let cname = dep.ident; diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs index 70e7ab1169d..155597f94fa 100644 --- a/src/comp/metadata/cstore.rs +++ b/src/comp/metadata/cstore.rs @@ -52,8 +52,8 @@ type use_crate_map = map::hashmap; fn p(cstore: &cstore) -> cstore_private { alt cstore { private(p) { p } } } fn mk_cstore() -> cstore { - let meta_cache = map::new_int_hash[crate_metadata](); - let crate_map = map::new_int_hash[ast::crate_num](); + let meta_cache = map::new_int_hash::(); + let crate_map = map::new_int_hash::(); ret private(@{metas: meta_cache, use_crate_map: crate_map, mutable used_crate_files: ~[], diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index b4203bd08e2..03a65dfd44c 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -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(vec::slice[u8](*elt.data, elt.start + 4u, elt.end)) { + if eq_fn(vec::slice::(*elt.data, elt.start + 4u, elt.end)) { result += ~[ebml::doc_at(d.data, pos)]; } } @@ -63,8 +63,8 @@ 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 vec::len(found) == 0u { - ret option::none[ebml::doc]; - } else { ret option::some[ebml::doc](found.(0)); } + ret option::none::; + } else { ret option::some::(found.(0)); } } fn find_item(item_id: int, items: &ebml::doc) -> ebml::doc { @@ -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 = vec::slice[u8](desc, 4u, vec::len[u8](desc)); + let pathbytes = vec::slice::(desc, 4u, vec::len::(desc)); let path = str::unsafe_from_bytes(pathbytes); ret {path: path, pos: pos}; } diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index ca5f5af98c6..32c21d116a9 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -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, vec::len[ty_param](tps)); + ebml::write_vint(ebml_w.writer, vec::len::(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 vec::len[variant_arg](variant.node.args) > 0u { + if vec::len::(variant.node.args) > 0u { encode_symbol(ecx, ebml_w, variant.node.id); } encode_discriminant(ecx, ebml_w, variant.node.id); diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 4adbfb279c7..05e01d8af63 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -71,7 +71,7 @@ fn parse_constrs(st: @pstate, sd: str_def) -> [@ty::constr] { do { next(st); let one: @ty::constr = - parse_constr[uint](st, sd, parse_constr_arg); + parse_constr::(st, sd, parse_constr_arg); rslt += ~[one]; } while peek(st) as char == ';' } @@ -88,7 +88,7 @@ fn parse_ty_constrs(st: @pstate, sd: str_def) -> [@ty::type_constr] { do { next(st); let one: @ty::type_constr = - parse_constr[path](st, sd, parse_ty_constr_arg); + parse_constr::(st, sd, parse_ty_constr_arg); rslt += ~[one]; } while peek(st) as char == ';' } @@ -406,14 +406,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 = vec::len[u8](buf); + let len = vec::len::(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 = vec::slice[u8](buf, 0u, colon_idx); - let def_part = vec::slice[u8](buf, colon_idx + 1u, len); + let crate_part = vec::slice::(buf, 0u, colon_idx); + let def_part = vec::slice::(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 e3c31698955..a9cd0a869b0 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -46,7 +46,7 @@ fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) { visit_item: bind visit_item(cx, _, _, _), visit_expr: bind visit_expr(cx, _, _, _), visit_decl: bind visit_decl(cx, _, _, _) - with *visit::default_visitor[scope]()}; + with *visit::default_visitor::()}; visit::visit_crate(*crate, @~[], visit::mk_vt(v)); tcx.sess.abort_if_errors(); } diff --git a/src/comp/middle/ast_map.rs b/src/comp/middle/ast_map.rs index 5af6d04a649..a348787c761 100644 --- a/src/comp/middle/ast_map.rs +++ b/src/comp/middle/ast_map.rs @@ -18,13 +18,13 @@ fn map_crate(c: &crate) -> map { // FIXME: This is using an adapter to convert the smallintmap // interface to the hashmap interface. It would be better to just // convert everything to use the smallintmap. - let map = new_smallintmap_int_adapter[ast_node](); + let map = new_smallintmap_int_adapter::(); let v_map = @{visit_item: bind map_item(map, _, _, _), visit_native_item: bind map_native_item(map, _, _, _), visit_expr: bind map_expr(map, _, _, _) - with *visit::default_visitor[()]()}; + with *visit::default_visitor::<()>()}; visit::visit_crate(c, (), visit::mk_vt(v_map)); ret map; } @@ -110,7 +110,7 @@ fn new_smallintmap_adapter<@K, } } - let map = smallintmap::mk[V](); + let map = smallintmap::mk::(); ret adapter(map, key_idx, idx_key); } diff --git a/src/comp/middle/check_alt.rs b/src/comp/middle/check_alt.rs index 54017c6e282..29be298aad1 100644 --- a/src/comp/middle/check_alt.rs +++ b/src/comp/middle/check_alt.rs @@ -5,7 +5,7 @@ fn check_crate(tcx: &ty::ctxt, crate: &@crate) { let v = @{visit_expr: bind check_expr(tcx, _, _, _), visit_local: bind check_local(tcx, _, _, _) - with *visit::default_visitor[()]()}; + with *visit::default_visitor::<()>()}; visit::visit_crate(*crate, (), visit::mk_vt(v)); tcx.sess.abort_if_errors(); } diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index f919520a097..b87f3bbda4b 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -86,7 +86,7 @@ fn new_ext_hash() -> ext_hash { ret util::common::def_eq(v1.did, v2.did) && str::eq(v1.ident, v2.ident) && v1.ns == v2.ns; } - ret std::map::mk_hashmap[key, def](hash, eq); + ret std::map::mk_hashmap::(hash, eq); } tag mod_index_entry { @@ -135,11 +135,11 @@ fn resolve_crate(sess: session, amap: &ast_map::map, crate: @ast::crate) -> def_map { let e = @{cstore: sess.get_cstore(), - def_map: new_int_hash[def](), + def_map: new_int_hash::(), ast_map: amap, - imports: new_int_hash[import_state](), - mod_map: new_int_hash[@indexed_mod](), - ext_map: new_def_hash[[ident]](), + imports: new_int_hash::(), + mod_map: new_int_hash::<@indexed_mod>(), + ext_map: new_def_hash::<[ident]>(), ext_cache: new_ext_hash(), mutable reported: ~[], sess: sess}; @@ -159,7 +159,7 @@ fn map_crate(e: &@env, c: &@ast::crate) { let v_map_mod = @{visit_view_item: bind index_vi(e, _, _, _), visit_item: bind index_i(e, _, _, _) - with *visit::default_visitor[scopes]()}; + with *visit::default_visitor::()}; visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v_map_mod)); // Register the top-level mod @@ -167,7 +167,7 @@ fn map_crate(e: &@env, c: &@ast::crate) { @{m: some(c.node.module), index: index_mod(c.node.module), mutable glob_imports: ~[], - glob_imported_names: new_str_hash[import_state]()}); + glob_imported_names: new_str_hash::()}); fn index_vi(e: @env, i: &@ast::view_item, sc: &scopes, v: &vt) { alt i.node { ast::view_item_import(_, ids, id) { @@ -180,7 +180,7 @@ fn map_crate(e: &@env, c: &@ast::crate) { visit_item_with_scope(i, sc, v); alt i.node { ast::item_mod(md) { - let s = new_str_hash[import_state](); + let s = new_str_hash::(); e.mod_map.insert(i.id, @{m: some(md), index: index_mod(md), @@ -188,9 +188,9 @@ fn map_crate(e: &@env, c: &@ast::crate) { glob_imported_names: s}); } ast::item_native_mod(nmd) { - let s = new_str_hash[import_state](); + let s = new_str_hash::(); e.mod_map.insert(i.id, - @{m: none[ast::_mod], + @{m: none::, index: index_nmod(nmd), mutable glob_imports: ~[], glob_imported_names: s}); @@ -203,7 +203,7 @@ fn map_crate(e: &@env, c: &@ast::crate) { let v_link_glob = @{visit_view_item: bind link_glob(e, _, _, _), visit_item: visit_item_with_scope - with *visit::default_visitor[scopes]()}; + with *visit::default_visitor::()}; visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v_link_glob)); fn link_glob(e: @env, vi: &@ast::view_item, sc: &scopes, v: &vt) { @@ -387,7 +387,7 @@ fn visit_arm_with_scope(a: &ast::arm, sc: &scopes, v: &vt) { fn visit_expr_with_scope(x: &@ast::expr, sc: &scopes, v: &vt) { alt x.node { ast::expr_for(decl, coll, blk) | ast::expr_for_each(decl, coll, blk) { - let new_sc = cons[scope](scope_loop(decl), @sc); + let new_sc = cons::(scope_loop(decl), @sc); v.visit_expr(coll, sc, v); v.visit_local(decl, new_sc, v); v.visit_block(blk, new_sc, v); @@ -684,7 +684,7 @@ fn lookup_in_scope(e: &env, sc: scopes, sp: &span, name: &ident, } } } - ret none[def]; + ret none::; } let left_fn = false; // Used to determine whether obj fields are in scope @@ -692,7 +692,7 @@ fn lookup_in_scope(e: &env, sc: scopes, sp: &span, name: &ident, let left_fn_level2 = false; while true { alt { sc } { - nil. { ret none[def]; } + nil. { ret none::; } cons(hd, tl) { let fnd = in_scope(e, sp, name, hd, ns); if !is_none(fnd) { @@ -734,7 +734,7 @@ fn lookup_in_ty_params(name: &ident, ty_params: &[ast::ty_param]) -> if str::eq(tp.ident, name) { ret some(ast::def_ty_arg(i,tp.kind)); } i += 1u; } - ret none[def]; + ret none::; } fn lookup_in_pat(name: &ident, pat: &@ast::pat) -> option::t { @@ -758,10 +758,10 @@ fn lookup_in_fn(name: &ident, decl: &ast::fn_decl, ret some(ast::def_arg(local_def(a.id))); } } - ret none[def]; + ret none::; } ns_type. { ret lookup_in_ty_params(name, ty_params); } - _ { ret none[def]; } + _ { ret none::; } } } @@ -774,10 +774,10 @@ fn lookup_in_obj(name: &ident, ob: &ast::_obj, ty_params: &[ast::ty_param], ret some(ast::def_obj_field(local_def(f.id))); } } - ret none[def]; + ret none::; } ns_type. { ret lookup_in_ty_params(name, ty_params); } - _ { ret none[def]; } + _ { ret none::; } } } @@ -835,7 +835,7 @@ fn lookup_in_block(name: &ident, b: &ast::blk_, pos: uint, loc_pos: uint, _ { } } } - ret none[def]; + ret none::; } fn found_def_item(i: &@ast::item, ns: namespace) -> option::t { @@ -880,7 +880,7 @@ fn found_def_item(i: &@ast::item, ns: namespace) -> option::t { } _ { } } - ret none[def]; + ret none::; } fn lookup_in_mod_strict(e: &env, sc: &scopes, m: def, sp: &span, name: &ident, @@ -929,7 +929,7 @@ fn found_view_item(e: &env, vi: @ast::view_item, ns: namespace) -> ret lookup_import(e, local_def(id), ns); } ast::view_item_import_glob(_, defid) { - ret none[def]; //will be handled in the fallback glob pass + ret none::; //will be handled in the fallback glob pass } } @@ -959,7 +959,7 @@ fn lookup_in_local_mod(e: &env, node_id: node_id, sp: &span, id: &ident, if dr == outside && !ast::is_exported(id, option::get(info.m)) { // if we're in a native mod, then dr==inside, so info.m is some _mod - ret none[def]; // name is not visible + ret none::; // name is not visible } alt info.index.find(id) { @@ -1027,7 +1027,7 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident, alt info.glob_imported_names.get(id) { todo(_, _) { e.sess.bug("Shouldn't've put a todo in."); } resolving(sp) { - ret none[def]; //circularity is okay in import globs + ret none::; //circularity is okay in import globs } resolved(val, typ, md) { @@ -1052,7 +1052,7 @@ fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) -> let vid = variants.(variant_idx).node.id; ret some(ast::def_variant(local_def(item.id), local_def(vid))); - } else { ret none[def]; } + } else { ret none::; } } } } @@ -1072,7 +1072,7 @@ fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) -> } _ { } } - ret none[def]; + ret none::; } @@ -1080,13 +1080,13 @@ fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) -> fn add_to_index(index: &hashmap>, id: &ident, ent: &mod_index_entry) { alt index.find(id) { - none. { index.insert(id, cons(ent, @nil[mod_index_entry])); } + none. { index.insert(id, cons(ent, @nil::)); } some(prev) { index.insert(id, cons(ent, @prev)); } } } fn index_mod(md: &ast::_mod) -> mod_index { - let index = new_str_hash[list](); + let index = new_str_hash::>(); for it: @ast::view_item in md.view_items { alt it.node { ast::view_item_import(ident, _, _) | ast::view_item_use(ident, _, _) @@ -1121,7 +1121,7 @@ fn index_mod(md: &ast::_mod) -> mod_index { } fn index_nmod(md: &ast::native_mod) -> mod_index { - let index = new_str_hash[list](); + let index = new_str_hash::>(); for it: @ast::view_item in md.view_items { alt it.node { ast::view_item_use(ident, _, _) | ast::view_item_import(ident, _, _) @@ -1163,7 +1163,7 @@ fn lookup_external(e: &env, cnum: int, ids: &[ident], ns: namespace) -> e.ext_map.insert(ast::def_id_of_def(d), ids); if ns == ns_for_def(d) { ret some(d); } } - ret none[def]; + ret none::; } diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 3beef789129..ed9a4120c62 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -379,7 +379,7 @@ fn get_extern_const(externs: &hashmap, llmod: ModuleRef, fn get_simple_extern_fn(externs: &hashmap, llmod: ModuleRef, name: &str, n_args: int) -> ValueRef { - let inputs = std::vec::init_elt[TypeRef](T_int(), n_args as uint); + let inputs = std::vec::init_elt::(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); @@ -389,7 +389,7 @@ fn trans_native_call(b: &builder, glues: @glue_fns, lltaskptr: ValueRef, externs: &hashmap, tn: &type_names, llmod: ModuleRef, name: &str, pass_task: bool, args: &[ValueRef]) -> ValueRef { - let n: int = std::vec::len[ValueRef](args) as int; + let n: int = std::vec::len::(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())]; } @@ -712,7 +712,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::vec::len[int](ixs); + let len: uint = std::vec::len::(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). @@ -878,7 +878,7 @@ fn trans_malloc_boxed(cx: &@block_ctxt, t: ty::t) -> // tydesc if necessary. fn field_of_tydesc(cx: &@block_ctxt, t: &ty::t, escapes: bool, field: int) -> result { - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let tydesc = get_tydesc(cx, t, escapes, ti); ret rslt(tydesc.bcx, tydesc.bcx.build.GEP(tydesc.val, ~[C_int(0), C_int(field)])); @@ -954,10 +954,10 @@ 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::vec::len[uint](tys.params)); - assert (n_params == std::vec::len[ValueRef](tys.descs)); + assert (n_params == std::vec::len::(tys.params)); + assert (n_params == std::vec::len::(tys.descs)); let root_ti = get_static_tydesc(bcx, t, tys.params); - static_ti = some[@tydesc_info](root_ti); + static_ti = some::<@tydesc_info>(root_ti); lazily_emit_all_tydesc_glue(cx, static_ti); let root = root_ti.tydesc; let sz = size_of(bcx, t); @@ -1033,7 +1033,7 @@ fn get_tydesc(cx: &@block_ctxt, orig_t: &ty::t, escapes: bool, // Otherwise, generate a tydesc if necessary, and return it. let info = get_static_tydesc(cx, t, ~[]); - static_ti = some[@tydesc_info](info); + static_ti = some::<@tydesc_info>(info); ret rslt(cx, info.tydesc); } @@ -1110,10 +1110,10 @@ fn declare_tydesc(cx: &@local_ctxt, sp: &span, t: &ty::t, ty_params: &[uint]) tydesc: gvar, size: llsize, align: llalign, - mutable copy_glue: none[ValueRef], - mutable drop_glue: none[ValueRef], - mutable free_glue: none[ValueRef], - mutable cmp_glue: none[ValueRef], + mutable copy_glue: none::, + mutable drop_glue: none::, + mutable free_glue: none::, + mutable cmp_glue: none::, ty_params: ty_params}; log "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t); ret info; @@ -1150,7 +1150,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::vec::len[uint](ty_params); + let ty_param_count = std::vec::len::(ty_params); let lltyparams = llvm::LLVMGetParam(llfn, 3u); let copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs); let lltydescs = ~[mutable]; @@ -1341,7 +1341,7 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) { cx.build.GEP(body, ~[C_int(0), C_int(abi::obj_body_elt_tydesc)]); let tydesc = cx.build.Load(tydescptr); - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; call_tydesc_glue_full(cx, body, tydesc, abi::tydesc_field_drop_glue, ti); if (!bcx_ccx(cx).sess.get_opts().do_gc) { @@ -1362,7 +1362,7 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) { let tydescptr = cx.build.GEP(body, ~[C_int(0), C_int(abi::closure_elt_tydesc)]); - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; call_tydesc_glue_full(cx, bindings, cx.build.Load(tydescptr), abi::tydesc_field_drop_glue, ti); if (!bcx_ccx(cx).sess.get_opts().do_gc) { @@ -1571,7 +1571,7 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, ret rslt(new_sub_block_ctxt(cx, "after_fail_dummy"), C_bool(false)); } ty::ty_native(_) { - trans_fail(cx, none[span], + trans_fail(cx, none::, "attempt to compare values of type native"); ret rslt(new_sub_block_ctxt(cx, "after_fail_dummy"), C_bool(false)); } @@ -1757,7 +1757,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::vec::len[ty::t](variant.args) == 0u { + if std::vec::len::(variant.args) == 0u { ret rslt(cx, C_nil()); } let fn_ty = variant.ctor_ty; @@ -2012,7 +2012,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, let glue_fn = declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx), "copy"); - ti.copy_glue = some[ValueRef](glue_fn); + ti.copy_glue = some::(glue_fn); make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, make_copy_glue, ti.ty_params, "take"); @@ -2030,7 +2030,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, let glue_fn = declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx), "drop"); - ti.drop_glue = some[ValueRef](glue_fn); + ti.drop_glue = some::(glue_fn); make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, make_drop_glue, ti.ty_params, "drop"); @@ -2048,7 +2048,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, let glue_fn = declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx), "free"); - ti.free_glue = some[ValueRef](glue_fn); + ti.free_glue = some::(glue_fn); make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, make_free_glue, ti.ty_params, "free"); @@ -2114,7 +2114,7 @@ fn call_tydesc_glue_full(cx: &@block_ctxt, v: ValueRef, tydesc: ValueRef, fn call_tydesc_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t, field: int) -> result { - let ti: option::t<@tydesc_info> = none[@tydesc_info]; + let ti: option::t<@tydesc_info> = none::<@tydesc_info>; let td = get_tydesc(cx, t, false, ti); call_tydesc_glue_full(td.bcx, spill_if_immediate(td.bcx, v, t), td.val, field, ti); @@ -2130,7 +2130,7 @@ fn call_cmp_glue(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: &ty::t, let llrhs = spill_if_immediate(cx, rhs, t); let llrawlhsptr = cx.build.BitCast(lllhs, T_ptr(T_i8())); let llrawrhsptr = cx.build.BitCast(llrhs, T_ptr(T_i8())); - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let r = get_tydesc(cx, t, false, ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_cmp_glue, ti); let lltydesc = r.val; @@ -2545,10 +2545,10 @@ fn trans_vec_append(cx: &@block_ctxt, t: &ty::t, lhs: ValueRef, rhs: ValueRef) _ { } } let bcx = cx; - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let llvec_tydesc = get_tydesc(bcx, t, false, ti); bcx = llvec_tydesc.bcx; - ti = none[@tydesc_info]; + ti = none::<@tydesc_info>; let llelt_tydesc = get_tydesc(bcx, elt_ty, false, ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, ti); @@ -3346,13 +3346,13 @@ fn join_results(parent_cx: &@block_ctxt, t: TypeRef, ins: &[result]) -> bbs += ~[r.bcx.llbb]; } } - alt std::vec::len[result](live) { + alt std::vec::len::(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::vec::len[result](ins) >= 1u); + assert (std::vec::len::(ins) >= 1u); ret ins.(0); } _ {/* fall through */ } @@ -3427,7 +3427,8 @@ fn trans_for(cx: &@block_ctxt, local: &@ast::local, seq: &@ast::expr, body: &ast::blk, outer_next_cx: @block_ctxt) -> result { let next_cx = new_sub_block_ctxt(cx, "next"); let scope_cx = - new_loop_scope_block_ctxt(cx, option::some[@block_ctxt](next_cx), + new_loop_scope_block_ctxt(cx, + option::some::<@block_ctxt>(next_cx), outer_next_cx, "for loop scope"); cx.build.Br(scope_cx.llbb); let local_res = alloc_local(scope_cx, local); @@ -3728,7 +3729,7 @@ fn trans_for_each(cx: &@block_ctxt, local: &@ast::local, seq: &@ast::expr, ast::expr_call(f, args) { let pair = create_real_fn_pair(cx, iter_body_llty, lliterbody, llenv.ptr); - r = trans_call(cx, f, some[ValueRef](cx.build.Load(pair)), args, + r = trans_call(cx, f, some::(cx.build.Load(pair)), args, seq.id); ret rslt(r.bcx, C_nil()); } @@ -3740,7 +3741,7 @@ fn trans_while(cx: &@block_ctxt, cond: &@ast::expr, body: &ast::blk) -> let cond_cx = new_scope_block_ctxt(cx, "while cond"); let next_cx = new_sub_block_ctxt(cx, "next"); let body_cx = - new_loop_scope_block_ctxt(cx, option::none[@block_ctxt], next_cx, + new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>, next_cx, "while loop body"); let body_res = trans_block(body_cx, body, return); let cond_res = trans_expr(cond_cx, cond); @@ -3755,7 +3756,7 @@ fn trans_do_while(cx: &@block_ctxt, body: &ast::blk, cond: &@ast::expr) -> result { let next_cx = new_sub_block_ctxt(cx, "next"); let body_cx = - new_loop_scope_block_ctxt(cx, option::none[@block_ctxt], next_cx, + new_loop_scope_block_ctxt(cx, option::none::<@block_ctxt>, next_cx, "do-while loop body"); let body_res = trans_block(body_cx, body, return); if is_terminated(body_res.bcx) { @@ -3791,17 +3792,17 @@ type lval_result = fn lval_mem(cx: &@block_ctxt, val: ValueRef) -> lval_result { ret {res: rslt(cx, val), is_mem: true, - generic: none[generic_info], - llobj: none[ValueRef], - method_ty: none[ty::t]}; + generic: none::, + llobj: none::, + method_ty: none::}; } fn lval_val(cx: &@block_ctxt, val: ValueRef) -> lval_result { ret {res: rslt(cx, val), is_mem: false, - generic: none[generic_info], - llobj: none[ValueRef], - method_ty: none[ty::t]}; + generic: none::, + llobj: none::, + method_ty: none::}; } fn trans_external_path(cx: &@block_ctxt, did: &ast::def_id, @@ -3824,14 +3825,14 @@ 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::vec::len[ty::t](tys) != 0u { + if std::vec::len::(tys) != 0u { let bcx = lv.res.bcx; let tydescs: [ValueRef] = ~[]; let tis: [option::t<@tydesc_info>] = ~[]; for t: ty::t in tys { // TODO: Doesn't always escape. - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let td = get_tydesc(bcx, t, true, ti); tis += ~[ti]; bcx = td.bcx; @@ -3972,7 +3973,7 @@ fn trans_field(cx: &@block_ctxt, sp: &span, v: ValueRef, t0: &ty::t, ty::ty_fn_ret(tcx, fn_ty), 0u); v = r.bcx.build.PointerCast(v, T_ptr(T_ptr(ll_fn_ty))); let lvo = lval_mem(r.bcx, v); - ret {llobj: some[ValueRef](r.val), method_ty: some[ty::t](fn_ty) + ret {llobj: some::(r.val), method_ty: some::(fn_ty) with lvo}; } _ { bcx_ccx(cx).sess.unimpl("field variant in trans_field"); } @@ -4027,7 +4028,7 @@ fn trans_index(cx: &@block_ctxt, sp: &span, base: &@ast::expr, bcx.build.CondBr(bounds_check, next_cx.llbb, fail_cx.llbb); // fail: bad bounds check. - trans_fail(fail_cx, some[span](sp), "bounds check"); + trans_fail(fail_cx, some::(sp), "bounds check"); let body; alt interior_len_and_data { some(lad) { body = lad.data; } @@ -4126,7 +4127,7 @@ fn trans_lval(cx: &@block_ctxt, e: &@ast::expr) -> lval_result { some(gi) { let t = ty::expr_ty(bcx_tcx(cx), e); 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 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); } @@ -4768,7 +4769,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::vec::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 = @@ -4781,7 +4782,7 @@ 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::vec::init_elt[ty::t](unit_ty, + std::vec::init_elt::(unit_ty, std::vec::len(args))); let i: int = 0; for e: @ast::expr in args { @@ -5100,7 +5101,7 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) -> } ast::expr_bind(f, args) { ret trans_bind(cx, f, args, e.id); } ast::expr_call(f, args) { - ret trans_call(cx, f, none[ValueRef], args, e.id); + ret trans_call(cx, f, none::, args, e.id); } ast::expr_cast(val, _) { ret trans_cast(cx, val, e.id); } ast::expr_vec(args, _, ast::sk_rc.) { ret trans_vec(cx, args, e.id); } @@ -5237,7 +5238,7 @@ fn trans_log(lvl: int, cx: &@block_ctxt, e: &@ast::expr) -> result { let e_ty = ty::expr_ty(bcx_tcx(cx), e); let log_bcx = sub.bcx; - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let r = get_tydesc(log_bcx, e_ty, false, ti); log_bcx = r.bcx; @@ -5257,7 +5258,7 @@ fn trans_check_expr(cx: &@block_ctxt, e: &@ast::expr, s: &str) -> result { let cond_res = trans_expr(cx, e); let expr_str = s + " " + expr_to_str(e) + " failed"; let fail_cx = new_sub_block_ctxt(cx, "fail"); - trans_fail(fail_cx, some[span](e.span), expr_str); + trans_fail(fail_cx, some::(e.span), expr_str); let next_cx = new_sub_block_ctxt(cx, "next"); cond_res.bcx.build.CondBr(cond_res.val, next_cx.llbb, fail_cx.llbb); ret rslt(next_cx, C_nil()); @@ -5587,9 +5588,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::vec::len[cleanup](cleanup_cx.cleanups) == 0u); + assert (std::vec::len::(cleanup_cx.cleanups) == 0u); } - let i = std::vec::len[cleanup](cleanup_cx.cleanups); + let i = std::vec::len::(cleanup_cx.cleanups); while i > 0u { i -= 1u; let c = cleanup_cx.cleanups.(i); @@ -5788,13 +5789,15 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: &span, llfndecl: ValueRef, let llretptr: ValueRef = llvm::LLVMGetParam(llfndecl, 0u); let lltaskptr: ValueRef = llvm::LLVMGetParam(llfndecl, 1u); let llenv: ValueRef = llvm::LLVMGetParam(llfndecl, 2u); - let llargs: hashmap = new_int_hash[ValueRef](); + let llargs: hashmap = new_int_hash::(); let llobjfields: hashmap = - new_int_hash[ValueRef](); - let lllocals: hashmap = new_int_hash[ValueRef](); - let llupvars: hashmap = new_int_hash[ValueRef](); + new_int_hash::(); + let lllocals: hashmap = + new_int_hash::(); + let llupvars: hashmap = + new_int_hash::(); let derived_tydescs = - map::mk_hashmap[ty::t, derived_tydesc_info](ty::hash_ty, ty::eq_ty); + map::mk_hashmap::(ty::hash_ty, ty::eq_ty); let llbbs = mk_standard_basic_blocks(llfndecl); ret @{llfn: llfndecl, lltaskptr: lltaskptr, @@ -5805,9 +5808,9 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: &span, llfndecl: ValueRef, mutable llderivedtydescs_first: llbbs.dt, mutable llderivedtydescs: llbbs.dt, mutable lldynamicallocas: llbbs.da, - mutable llself: none[val_self_pair], - mutable lliterbody: none[ValueRef], - mutable iterbodyty: none[ty::t], + mutable llself: none::, + mutable lliterbody: none::, + mutable iterbodyty: none::, llargs: llargs, llobjfields: llobjfields, lllocals: lllocals, @@ -5845,7 +5848,7 @@ fn create_llargs_for_fn_args(cx: &@fn_ctxt, proto: ast::proto, // way. let arg_n = 3u; alt ty_self { - some(tt) { cx.llself = some[val_self_pair]({v: cx.llenv, t: tt}); } + some(tt) { cx.llself = some::({v: cx.llenv, t: tt}); } none. { let i = 0u; for tp: ast::ty_param in ty_params { @@ -5865,7 +5868,7 @@ fn create_llargs_for_fn_args(cx: &@fn_ctxt, proto: ast::proto, cx.iterbodyty = some(ty::mk_iter_body_fn(fcx_tcx(cx), ret_ty)); let llarg = llvm::LLVMGetParam(cx.llfn, arg_n); assert (llarg as int != 0); - cx.lliterbody = some[ValueRef](llarg); + cx.lliterbody = some::(llarg); arg_n += 1u; } @@ -5942,7 +5945,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::vec::len[ast::ty_param](bcx.fcx.lcx.obj_typarams); + let n_typarams = std::vec::len::(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)]); @@ -6100,7 +6103,7 @@ fn trans_res_ctor(cx: @local_ctxt, sp: &span, dtor: &ast::_fn, } let fcx = new_fn_ctxt(cx, sp, llctor_decl); let ret_t = ty::ret_ty_of_fn(cx.ccx.tcx, ctor_id); - create_llargs_for_fn_args(fcx, ast::proto_fn, none[ty::t], ret_t, + create_llargs_for_fn_args(fcx, ast::proto_fn, none::, ret_t, dtor.decl.inputs, ty_params); let bcx = new_top_block_ctxt(fcx); let lltop = bcx.llbb; @@ -6132,7 +6135,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::vec::len[ast::variant_arg](variant.node.args) == 0u { + if std::vec::len::(variant.node.args) == 0u { ret; // nullary constructors are just constants } @@ -6157,7 +6160,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id, } } let fcx = new_fn_ctxt(cx, variant.span, llfndecl); - create_llargs_for_fn_args(fcx, ast::proto_fn, none[ty::t], + create_llargs_for_fn_args(fcx, ast::proto_fn, none::, ty::ret_ty_of_fn(cx.ccx.tcx, variant.node.id), fn_args, ty_params); let ty_param_substs: [ty::t] = ~[]; @@ -6328,7 +6331,7 @@ fn decl_fn_and_pair_full(ccx: &@crate_ctxt, sp: &span, path: &[str], ty::ty_fn(proto, inputs, output, _, _) { llfty = type_of_fn(ccx, sp, proto, inputs, output, - std::vec::len[ast::ty_param](ty_params)); + std::vec::len::(ty_params)); } _ { ccx.sess.bug("decl_fn_and_pair(): fn item doesn't have fn type!"); } } @@ -6349,7 +6352,7 @@ fn decl_fn_and_pair_full(ccx: &@crate_ctxt, sp: &span, path: &[str], fn create_main_wrapper(ccx: &@crate_ctxt, sp: &span, main_llfn: ValueRef, main_node_type: ty::t) { - if ccx.main_fn != none[ValueRef] { + if ccx.main_fn != none:: { ccx.sess.span_fatal(sp, "multiple 'main' functions"); } @@ -6537,7 +6540,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::vec::len[ast::ty_param](tps); + count = std::vec::len::(tps); } } ret count; @@ -6850,7 +6853,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::vec::len[ast::variant](variants); + let n_variants = std::vec::len::(variants); while i < n_variants { let variant = variants.(i); let p = new_pt + ~[it.ident, variant.node.name, "discrim"]; @@ -6917,7 +6920,7 @@ fn declare_intrinsics(llmod: ModuleRef) -> hashmap { decl_cdecl_fn(llmod, "llvm.memset.p0i8.i64", T_fn(T_memset64_args, T_void())); let trap = decl_cdecl_fn(llmod, "llvm.trap", T_fn(T_trap_args, T_void())); - let intrinsics = new_str_hash[ValueRef](); + let intrinsics = new_str_hash::(); intrinsics.insert("llvm.gcread", gcread); intrinsics.insert("llvm.memmove.p0i8.p0i8.i32", memmove32); intrinsics.insert("llvm.memmove.p0i8.p0i8.i64", memmove64); @@ -7019,7 +7022,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::vec::len[ValueRef](subcrates)); + let arrtype = T_array(T_int(), std::vec::len::(subcrates)); let maptype = T_struct(~[T_int(), arrtype]); let map = llvm::LLVMAddGlobal(ccx.llmod, maptype, str::buf(sym_name)); llvm::LLVMSetLinkage(map, @@ -7073,32 +7076,32 @@ fn trans_crate(sess: &session::session, crate: &@ast::crate, tcx: &ty::ctxt, let glues = make_glues(llmod, taskptr_type); let hasher = ty::hash_ty; let eqer = ty::eq_ty; - let tag_sizes = map::mk_hashmap[ty::t, uint](hasher, eqer); - let tydescs = map::mk_hashmap[ty::t, @tydesc_info](hasher, eqer); - let lltypes = map::mk_hashmap[ty::t, TypeRef](hasher, eqer); - let sha1s = map::mk_hashmap[ty::t, str](hasher, eqer); - let short_names = map::mk_hashmap[ty::t, str](hasher, eqer); + let tag_sizes = map::mk_hashmap::(hasher, eqer); + let tydescs = map::mk_hashmap::(hasher, eqer); + let lltypes = map::mk_hashmap::(hasher, eqer); + let sha1s = map::mk_hashmap::(hasher, eqer); + let short_names = map::mk_hashmap::(hasher, eqer); let sha = std::sha1::mk_sha1(); let ccx = @{sess: sess, llmod: llmod, td: td, tn: tn, - externs: new_str_hash[ValueRef](), + externs: new_str_hash::(), intrinsics: intrinsics, - item_ids: new_int_hash[ValueRef](), + item_ids: new_int_hash::(), ast_map: amap, - item_symbols: new_int_hash[str](), - mutable main_fn: none[ValueRef], + item_symbols: new_int_hash::(), + mutable main_fn: none::, link_meta: link::build_link_meta(sess, *crate, output, sha), tag_sizes: tag_sizes, - discrims: new_int_hash[ValueRef](), - discrim_symbols: new_int_hash[str](), - fn_pairs: new_int_hash[ValueRef](), - consts: new_int_hash[ValueRef](), - obj_methods: new_int_hash[()](), + discrims: new_int_hash::(), + discrim_symbols: new_int_hash::(), + fn_pairs: new_int_hash::(), + consts: new_int_hash::(), + obj_methods: new_int_hash::<()>(), tydescs: tydescs, - module_data: new_str_hash[ValueRef](), + module_data: new_str_hash::(), lltypes: lltypes, glues: glues, names: namegen(0), diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index fbec26fc646..1c7be7a3583 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -250,7 +250,7 @@ type fn_ctxt = { // For convenience, a vector of the incoming tydescs for each of // this functions type parameters, fetched via llvm::LLVMGetParam. - // For example, for a function foo[A, B, C](), lltydescs contains + // For example, for a function foo::(), lltydescs contains // the ValueRefs for the tydescs for A, B, and C. mutable lltydescs: [ValueRef], @@ -510,7 +510,7 @@ fn T_size_t() -> TypeRef { fn T_fn(inputs: &[TypeRef], output: TypeRef) -> TypeRef { ret llvm::LLVMFunctionType(output, std::vec::to_ptr(inputs), - std::vec::len[TypeRef](inputs), False); + std::vec::len::(inputs), False); } fn T_fn_pair(cx: &crate_ctxt, tfn: TypeRef) -> TypeRef { @@ -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::vec::init_elt[TypeRef](T_nil(), abi::n_tydesc_fields as uint); + std::vec::init_elt::(T_nil(), abi::n_tydesc_fields as uint); llvm::LLVMGetStructElementTypes(cx.tydesc_type, - std::vec::to_ptr[TypeRef](tydesc_elts)); + std::vec::to_ptr::(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::vec::init_elt[TypeRef](T_ptr(cx.tydesc_type), n)); + ret T_struct(std::vec::init_elt::(T_ptr(cx.tydesc_type), n)); } fn T_obj_ptr(cx: &crate_ctxt, n_captured_tydescs: uint) -> TypeRef { diff --git a/src/comp/middle/trans_objects.rs b/src/comp/middle/trans_objects.rs index d8f08f7fc2b..4b2e8f20738 100644 --- a/src/comp/middle/trans_objects.rs +++ b/src/comp/middle/trans_objects.rs @@ -51,7 +51,7 @@ fn trans_obj(cx: @local_ctxt, sp: &span, ob: &ast::_obj, let fcx = new_fn_ctxt(cx, sp, llctor_decl); // Both regular arguments and type parameters are handled here. - create_llargs_for_fn_args(fcx, ast::proto_fn, none[ty::t], + create_llargs_for_fn_args(fcx, ast::proto_fn, none::, ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args, ty_params); let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id); @@ -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::vec::len[ast::ty_param](ty_params) == 0u && - std::vec::len[ty::arg](arg_tys) == 0u { + if std::vec::len::(ty_params) == 0u && + std::vec::len::(arg_tys) == 0u { // If the object we're translating has no fields or type parameters, // there's not much to do. @@ -132,7 +132,7 @@ fn trans_obj(cx: @local_ctxt, sp: &span, ob: &ast::_obj, GEP_tup_like(bcx, body_ty, body, ~[0, abi::obj_body_elt_tydesc]); bcx = body_tydesc.bcx; - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let body_td = get_tydesc(bcx, body_ty, true, ti); lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, ti); lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, ti); @@ -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::vec::len[ast::anon_obj_field](additional_fields) == 0u && + if std::vec::len::(additional_fields) == 0u && anon_obj.inner_obj == none { // If the object we're translating has no fields and no inner_obj, @@ -326,7 +326,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj, GEP_tup_like(bcx, body_ty, body, ~[0, abi::obj_body_elt_tydesc]); bcx = body_tydesc.bcx; - let ti = none[@tydesc_info]; + let ti = none::<@tydesc_info>; let body_td = get_tydesc(bcx, body_ty, true, ti); lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, ti); lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, ti); @@ -460,7 +460,7 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t, // Sort and process all the methods. let meths = - std::sort::merge_sort[@ast::method] + std::sort::merge_sort::<@ast::method> (bind ast_mthd_lteq(_, _), ob.methods); for m: @ast::method in meths { @@ -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::vec::filter_map[vtbl_mthd, vtbl_mthd](f, meths); + meths = std::vec::filter_map::(f, meths); // And now add the additional ones, both overriding ones and entirely // new ones. These will just be normal methods. @@ -504,7 +504,7 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t, // Sort all the methods and process them. meths = - std::sort::merge_sort[vtbl_mthd] + std::sort::merge_sort:: (bind vtbl_mthd_lteq(_, _), meths); // To create forwarding methods, we'll need a "backwarding" vtbl. See @@ -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::vec::len[ast::ty_param](ty_params)); + std::vec::len::(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::vec::len[ast::ty_param](ty_params)); + std::vec::len::(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::vec::len[ast::ty_param](ty_params)); + std::vec::len::(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::vec::len[ast::ty_param](ty_params)); + std::vec::len::(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::vec::len[ast::ty_param](ty_params)); + std::vec::len::(ty_params)); } } let mcx: @local_ctxt = diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index f213dc9feb8..30799bdbc95 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -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 vec::len[ident](idents) == 0u { ret; } - log "an ident: " + vec::pop[ident](idents); + if vec::len::(idents) == 0u { ret; } + log "an ident: " + vec::pop::(idents); print_idents(idents); } @@ -320,8 +320,8 @@ fn add_node(ccx: &crate_ctxt, i: node_id, a: &ts_ann) { fn get_ts_ann(ccx: &crate_ctxt, i: node_id) -> option::t { if i as uint < vec::len(*ccx.node_anns) { - ret some[ts_ann](ccx.node_anns.(i)); - } else { ret none[ts_ann]; } + ret some::(ccx.node_anns.(i)); + } else { ret none::; } } @@ -508,7 +508,7 @@ fn num_constraints(m: fn_info) -> uint { ret m.num_constraints; } fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt { let na: [mutable ts_ann] = ~[mutable]; - ret {tcx: cx, node_anns: @mutable na, fm: @new_int_hash[fn_info]()}; + ret {tcx: cx, node_anns: @mutable na, fm: @new_int_hash::()}; } /* Use e's type to determine whether it returns. diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index f61604e1ec4..7ead3a9d836 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -160,7 +160,7 @@ fn relax_precond_block_inner(b: &blk, cx: &relax_ctxt, fn relax_precond_block(fcx: &fn_ctxt, i: node_id, b:&blk) { let cx = {fcx: fcx, i: i}; - let visitor = visit::default_visitor[relax_ctxt](); + let visitor = visit::default_visitor::(); visitor = @{visit_block: relax_precond_block_inner, visit_expr: relax_precond_expr, diff --git a/src/comp/middle/tstate/ck.rs b/src/comp/middle/tstate/ck.rs index 061ccd4811d..00b5ba3d7ec 100644 --- a/src/comp/middle/tstate/ck.rs +++ b/src/comp/middle/tstate/ck.rs @@ -131,7 +131,7 @@ fn check_states_against_conditions(fcx: &fn_ctxt, f: &_fn, because we want the smallest possible erroneous statement or expression. */ - let visitor = visit::default_visitor[fn_ctxt](); + let visitor = visit::default_visitor::(); visitor = @{visit_stmt: check_states_stmt, @@ -205,7 +205,7 @@ fn check_crate(cx: ty::ctxt, crate: @crate) { annotate_crate(ccx, *crate); /* Compute the pre and postcondition for every subexpression */ - let vtor = visit::default_visitor[crate_ctxt](); + let vtor = visit::default_visitor::(); vtor = @{visit_fn: fn_pre_post with *vtor}; visit::visit_crate(*crate, ccx, visit::mk_vt(vtor)); diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index 912bf1bd5e8..ad975f54216 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -46,7 +46,7 @@ fn collect_pred(e: &@expr, cx: &ctxt, v: &visit::vt) { fn find_locals(tcx: &ty::ctxt, f: &_fn, tps: &[ty_param], sp: &span, i: &fn_ident, id: node_id) -> ctxt { let cx: ctxt = {cs: @mutable ~[], tcx: tcx}; - let visitor = visit::default_visitor[ctxt](); + let visitor = visit::default_visitor::(); visitor = @{visit_local: collect_local, @@ -91,7 +91,7 @@ fn add_constraint(tcx: &ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) fn mk_fn_info(ccx: &crate_ctxt, f: &_fn, tp: &[ty_param], f_sp: &span, f_name: &fn_ident, id: node_id) { let name = fn_ident_to_string(id, f_name); - let res_map = @new_def_hash[constraint](); + let res_map = @new_def_hash::(); let next: uint = 0u; let cx: ctxt = find_locals(ccx.tcx, f, tp, f_sp, f_name, id); diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 9f7678878df..5f6d0dcdf01 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -75,7 +75,7 @@ fn find_pre_post_item(ccx: &crate_ctxt, i: &item) { let v: @mutable [node_id] = @mutable ~[]; let fake_fcx = {enclosing: - {constrs: @new_def_hash[constraint](), + {constrs: @new_def_hash::(), num_constraints: 0u, cf: return, // just bogus @@ -115,7 +115,7 @@ fn find_pre_post_item(ccx: &crate_ctxt, i: &item) { the preconditions for , and the postcondition in a to be the union of all postconditions for */ fn find_pre_post_exprs(fcx: &fn_ctxt, args: &[@expr], id: node_id) { - if vec::len[@expr](args) > 0u { + if vec::len::<@expr>(args) > 0u { log "find_pre_post_exprs: oper ="; log_expr(*args.(0)); } @@ -125,7 +125,7 @@ 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 = vec::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, vec::map(get_post, pps))); @@ -509,7 +509,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 = - vec::foldl[pre_and_post, pre_and_post](g, e_pp, alt_pps); + vec::foldl::(g, e_pp, alt_pps); set_pre_and_post(fcx.ccx, e.id, alts_overall_pp.precondition, alts_overall_pp.postcondition); } @@ -680,7 +680,7 @@ fn find_pre_post_block(fcx: &fn_ctxt, b: blk) { for s: @stmt in b.node.stmts { do_one_(fcx, s); } fn do_inner_(fcx: fn_ctxt, e: &@expr) { find_pre_post_expr(fcx, e); } let do_inner = bind do_inner_(fcx, _); - option::map[@expr, ()](do_inner, b.node.expr); + option::map::<@expr, ()>(do_inner, b.node.expr); let pps: [pre_and_post] = ~[]; for s: @stmt in b.node.stmts { pps += ~[stmt_pp(fcx.ccx, *s)]; } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 001505b4b28..c7de964bb8d 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -398,9 +398,9 @@ fn mk_rcache() -> creader_cache { fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, freevars: freevars::freevar_map) -> ctxt { let ntt: node_type_table = - @smallintmap::mk[ty::ty_param_substs_opt_and_ty](); - let tcache = new_def_hash[ty::ty_param_kinds_and_ty](); - let ts = @interner::mk[@raw_t](hash_raw_ty, eq_raw_ty); + @smallintmap::mk::(); + let tcache = new_def_hash::(); + let ts = @interner::mk::<@raw_t>(hash_raw_ty, eq_raw_ty); let cx = @{ts: ts, sess: s, @@ -428,7 +428,7 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t) -> @raw_t { let has_vars: bool = false; fn derive_flags_t(cx: &ctxt, has_params: &mutable bool, has_vars: &mutable bool, tt: &t) { - let rt = interner::get[@raw_t](*cx.ts, tt); + let rt = interner::get::<@raw_t>(*cx.ts, tt); has_params = has_params || rt.has_params; has_vars = has_vars || rt.has_vars; } @@ -1148,7 +1148,7 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool { ty_istr. { ret false; } ty_tag(_, subtys) { let i = 0u; - while i < vec::len[t](subtys) { + while i < vec::len::(subtys) { if type_has_dynamic_size(cx, subtys.(i)) { ret true; } i += 1u; } @@ -1160,7 +1160,7 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool { ty_ptr(_) { ret false; } ty_rec(fields) { let i = 0u; - while i < vec::len[field](fields) { + while i < vec::len::(fields) { if type_has_dynamic_size(cx, fields.(i).mt.ty) { ret true; } i += 1u; } @@ -1599,8 +1599,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 = vec::len[arg](args_a); - if len != vec::len[arg](args_b) { ret false; } + let len = vec::len::(args_a); + if len != vec::len::(args_b) { ret false; } let i = 0u; while i < len { let arg_a = args_a.(i); @@ -1636,8 +1636,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 = vec::len[t](tys_a); - if len != vec::len[t](tys_b) { ret false; } + let len = vec::len::(tys_a); + if len != vec::len::(tys_b) { ret false; } let i = 0u; while i < len { if !eq_ty(tys_a.(i), tys_b.(i)) { ret false; } @@ -1663,8 +1663,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { ty_rec(flds_a) { alt b { ty_rec(flds_b) { - let len = vec::len[field](flds_a); - if len != vec::len[field](flds_b) { ret false; } + let len = vec::len::(flds_a); + if len != vec::len::(flds_b) { ret false; } let i = 0u; while i < len { let fld_a = flds_a.(i); @@ -1716,8 +1716,8 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool { ty_obj(methods_a) { alt b { ty_obj(methods_b) { - let len = vec::len[method](methods_a); - if len != vec::len[method](methods_b) { ret false; } + let len = vec::len::(methods_a); + if len != vec::len::(methods_b) { ret false; } let i = 0u; while i < len { let m_a = methods_a.(i); @@ -1874,7 +1874,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 vec::len[uint](*param_indices); + ret vec::len::(*param_indices); } fn type_contains_vars(cx: &ctxt, typ: &t) -> bool { @@ -1995,7 +1995,7 @@ fn sort_methods(meths: &[method]) -> [method] { fn method_lteq(a: &method, b: &method) -> bool { ret str::lteq(a.ident, b.ident); } - ret std::sort::merge_sort[method](bind method_lteq(_, _), meths); + ret std::sort::merge_sort::(bind method_lteq(_, _), meths); } fn is_lval(expr: &@ast::expr) -> bool { @@ -2071,7 +2071,7 @@ mod unify { type ctxt = {vb: @var_bindings, tcx: ty_ctxt}; fn mk_var_bindings() -> @var_bindings { - ret @{sets: ufind::make(), types: smallintmap::mk[t]()}; + ret @{sets: ufind::make(), types: smallintmap::mk::()}; } // Unifies two sets. @@ -2084,7 +2084,7 @@ mod unify { bind fn (cx: &@ctxt, t: t, set_a: uint, set_b: uint) { ufind::union(cx.vb.sets, set_a, set_b); let root_c: uint = ufind::find(cx.vb.sets, set_a); - smallintmap::insert[t](cx.vb.types, root_c, t); + smallintmap::insert::(cx.vb.types, root_c, t); }(_, _, set_a, set_b); @@ -2115,7 +2115,7 @@ mod unify { ufind::grow(cx.vb.sets, (key as uint) + 1u); let root = ufind::find(cx.vb.sets, key as uint); let result_type = typ; - alt smallintmap::find[t](cx.vb.types, root) { + alt smallintmap::find::(cx.vb.types, root) { some(old_type) { alt unify_step(cx, old_type, typ) { ures_ok(unified_type) { result_type = unified_type; } @@ -2124,7 +2124,7 @@ mod unify { } none. {/* fall through */ } } - smallintmap::insert[t](cx.vb.types, root, result_type); + smallintmap::insert::(cx.vb.types, root, result_type); ret ures_ok(typ); } @@ -2212,8 +2212,8 @@ mod unify { expected_inputs: &[arg], expected_output: &t, actual_inputs: &[arg], actual_output: &t) -> fn_common_res { - let expected_len = vec::len[arg](expected_inputs); - let actual_len = vec::len[arg](actual_inputs); + let expected_len = vec::len::(expected_inputs); + let actual_len = vec::len::(actual_inputs); if expected_len != actual_len { ret fn_common_res_err(ures_err(terr_arg_count)); } @@ -2309,8 +2309,8 @@ mod unify { result { let result_meths: [method] = ~[]; let i: uint = 0u; - let expected_len: uint = vec::len[method](expected_meths); - let actual_len: uint = vec::len[method](actual_meths); + let expected_len: uint = vec::len::(expected_meths); + let actual_len: uint = vec::len::(actual_meths); if expected_len != actual_len { ret ures_err(terr_meth_count); } while i < expected_len { let e_meth = expected_meths.(i); @@ -2350,7 +2350,7 @@ mod unify { ret fix_err(vid); } let root_id = ufind::find(vb.sets, vid as uint); - alt smallintmap::find[t](vb.types, root_id) { + alt smallintmap::find::(vb.types, root_id) { none. { ret fix_err(vid); } some(rt) { ret fix_ok(rt); } } @@ -2451,7 +2451,7 @@ mod unify { // TODO: factor this cruft out let result_tps: [t] = ~[]; let i = 0u; - let expected_len = vec::len[t](expected_tps); + let expected_len = vec::len::(expected_tps); while i < expected_len { let expected_tp = expected_tps.(i); let actual_tp = actual_tps.(i); @@ -2592,8 +2592,8 @@ mod unify { ty::ty_rec(expected_fields) { alt struct(cx.tcx, actual) { ty::ty_rec(actual_fields) { - let expected_len = vec::len[field](expected_fields); - let actual_len = vec::len[field](actual_fields); + let expected_len = vec::len::(expected_fields); + let actual_len = vec::len::(actual_fields); if expected_len != actual_len { let err = terr_record_size(expected_len, actual_len); ret ures_err(err); @@ -2733,17 +2733,17 @@ mod unify { } fn dump_var_bindings(tcx: ty_ctxt, vb: @var_bindings) { let i = 0u; - while i < vec::len[ufind::node](vb.sets.nodes) { + while i < vec::len::(vb.sets.nodes) { let sets = ""; let j = 0u; - while j < vec::len[option::t](vb.sets.nodes) { + while j < vec::len::>(vb.sets.nodes) { if ufind::find(vb.sets, j) == i { sets += #fmt(" %u", j); } j += 1u; } let typespec; - alt smallintmap::find[t](vb.types, i) { + alt smallintmap::find::(vb.types, i) { none. { typespec = ""; } some(typ) { typespec = " =" + ty_to_str(tcx, typ); } } @@ -2767,7 +2767,7 @@ mod unify { ret ty::mk_var(tcx, vid); } let root_id = ufind::find(vb.sets, vid as uint); - alt smallintmap::find[t](vb.types, root_id) { + alt smallintmap::find::(vb.types, root_id) { none. { *unresolved = some(vid); ret ty::mk_var(tcx, vid); } some(rt) { if occurs_check_fails(tcx, sp, vid, rt) { @@ -2779,7 +2779,7 @@ mod unify { } } } - let unresolved = @mutable none[int]; + let unresolved = @mutable none::; let rty = fold_ty(tcx, fm_var(bind subst_vars(tcx, sp, vb, unresolved, _)), typ); @@ -2794,7 +2794,7 @@ mod unify { fixup_result { if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); } let root_id = ufind::find(vb.sets, vid as uint); - alt smallintmap::find[t](vb.types, root_id) { + alt smallintmap::find::(vb.types, root_id) { none. { ret fix_err(vid); } some(rt) { ret fixup_vars(tcx, sp, vb, rt); } } @@ -2947,7 +2947,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 < vec::len[variant_info](variants) { + while i < vec::len::(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 4dcd6e7dc67..13d5fef9ded 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -164,7 +164,7 @@ fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path, ty_param_count); let ty_param_vars = bind_result.ids; let ty_substs_opt; - let ty_substs_len = vec::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 = vec::len(ty_param_vars); if param_var_len == 0u { @@ -186,7 +186,7 @@ fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path, ty_substs += ~[res_ty]; i += 1u; } - ty_substs_opt = some[[ty::t]](ty_substs); + ty_substs_opt = some::<[ty::t]>(ty_substs); if ty_param_count == 0u { fcx.ccx.tcx.sess.span_fatal(sp, "this item does not take type \ @@ -200,7 +200,7 @@ fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path, ty_substs += ~[ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i))]; i += 1u; } - ty_substs_opt = some[[ty::t]](ty_substs); + ty_substs_opt = some::<[ty::t]>(ty_substs); } ret {substs: ty_substs_opt, ty: tpt.ty}; } @@ -271,7 +271,7 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> none. { } } /* go on */ - tcx.ast_ty_to_ty_cache.insert(ast_ty, none[ty::t]); + tcx.ast_ty_to_ty_cache.insert(ast_ty, none::); fn ast_arg_to_arg(tcx: &ty::ctxt, getter: &ty_getter, arg: &ast::ty_arg) -> {mode: ty::mode, ty: ty::t} { let ty_mode = ast_mode_to_mode(arg.node.mode); @@ -309,7 +309,7 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> ret typ; } let typ; - let cname = none[str]; + let cname = none::; alt ast_ty.node { ast::ty_nil. { typ = ty::mk_nil(tcx); } ast::ty_bot. { typ = ty::mk_bot(tcx); } @@ -476,23 +476,23 @@ mod write { // Writes a type with no type parameters into the node type table. fn ty_only(tcx: &ty::ctxt, node_id: ast::node_id, typ: ty::t) { - ty(tcx, node_id, {substs: none[[ty::t]], ty: typ}); + ty(tcx, node_id, {substs: none::<[ty::t]>, ty: typ}); } // Writes a type with no type parameters into the node type table. This // function allows for the possibility of type variables. fn ty_only_fixup(fcx: @fn_ctxt, node_id: ast::node_id, typ: ty::t) { - ret ty_fixup(fcx, node_id, {substs: none[[ty::t]], ty: typ}); + ret ty_fixup(fcx, node_id, {substs: none::<[ty::t]>, ty: typ}); } // Writes a nil type into the node type table. fn nil_ty(tcx: &ty::ctxt, node_id: ast::node_id) { - ret ty(tcx, node_id, {substs: none[[ty::t]], ty: ty::mk_nil(tcx)}); + ret ty(tcx, node_id, {substs: none::<[ty::t]>, ty: ty::mk_nil(tcx)}); } // Writes the bottom type into the node type table. fn bot_ty(tcx: &ty::ctxt, node_id: ast::node_id) { - ret ty(tcx, node_id, {substs: none[[ty::t]], ty: ty::mk_bot(tcx)}); + ret ty(tcx, node_id, {substs: none::<[ty::t]>, ty: ty::mk_bot(tcx)}); } } @@ -745,7 +745,7 @@ mod collect { // constructors get turned into functions. let result_ty; - if vec::len[ast::variant_arg](variant.node.args) == 0u { + if vec::len::(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() @@ -784,7 +784,7 @@ mod collect { ast::item_native_mod(native_mod) { // Propagate the native ABI down to convert_native() below, // but otherwise do nothing, as native modules have no types. - *abi = some[ast::native_abi](native_mod.abi); + *abi = some::(native_mod.abi); } ast::item_tag(variants, ty_params) { let tpt = ty_of_item(cx, it); @@ -806,7 +806,7 @@ mod collect { // ty_of_obj().) let method_types = get_obj_method_types(cx, object); let i = 0u; - while i < vec::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))); @@ -818,7 +818,7 @@ mod collect { // an assertion in trans. let args = ty::ty_fn_args(cx.tcx, tpt.ty); i = 0u; - while i < vec::len[ty::arg](args) { + while i < vec::len::(args) { let fld = object.fields.(i); write::ty_only(cx.tcx, fld.id, args.(i).ty); i += 1u; @@ -856,7 +856,8 @@ mod collect { // type of the native item. We simply write it into the node type // table. let tpt = - ty_of_native_item(cx, i, option::get[ast::native_abi]({ *abi })); + ty_of_native_item(cx, i, + option::get::({ *abi })); alt i.node { ast::native_item_ty. { // FIXME: Native types have no annotation. Should they? --pcw @@ -869,7 +870,7 @@ mod collect { fn collect_item_types(tcx: &ty::ctxt, crate: &@ast::crate) { // We have to propagate the surrounding ABI to the native items // contained within the native module. - let abi = @mutable none[ast::native_abi]; + let abi = @mutable none::; let cx = @{tcx: tcx}; let visit = visit::mk_simple_visitor (@{visit_item: bind convert(cx, abi, _), @@ -1101,8 +1102,8 @@ mod writeback { }; let new_substs_opt; alt tpot.substs { - none[[ty::t]]. { new_substs_opt = none[[ty::t]]; } - some[[ty::t]](substs) { + none::<[ty::t]>. { new_substs_opt = none::<[ty::t]>; } + some::<[ty::t]>(substs) { let new_substs: [ty::t] = ~[]; for subst: ty::t in substs { alt resolve_type_vars_in_type(fcx, sp, subst) { @@ -1110,7 +1111,7 @@ mod writeback { none. { wbcx.success = false; ret; } } } - new_substs_opt = some[[ty::t]](new_substs); + new_substs_opt = some::<[ty::t]>(new_substs); } } write::ty(fcx.ccx.tcx, id, {substs: new_substs_opt, ty: new_ty}); @@ -1207,8 +1208,8 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id, let {vb, locals, local_names, nvi} = alt old_fcx { none. { { vb: ty::unify::mk_var_bindings(), - locals: new_int_hash[int](), - local_names: new_int_hash[ast::ident](), + locals: new_int_hash::(), + local_names: new_int_hash::(), nvi: @mutable 0 } } some(fcx) { @@ -1357,17 +1358,17 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, demand::with_substs(fcx, pat.span, expected, ctor_ty, expected_tps); path_tpot = - {substs: some[[ty::t]](path_tpt.substs), ty: path_tpt.ty}; + {substs: some::<[ty::t]>(path_tpt.substs), ty: path_tpt.ty}; // Get the number of arguments in this tag variant. let arg_types = variant_arg_types(fcx.ccx, pat.span, v_def_ids.var, expected_tps); - let subpats_len = std::vec::len[@ast::pat](subpats); - if std::vec::len[ty::t](arg_types) > 0u { + let subpats_len = std::vec::len::<@ast::pat>(subpats); + if std::vec::len::(arg_types) > 0u { // N-ary variant. - let arg_len = vec::len[ty::t](arg_types); + let arg_len = vec::len::(arg_types); if arg_len != subpats_len { // TODO: note definition of tag variant // TODO (issue #448): Wrap a #fmt string over multiple @@ -1586,8 +1587,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 = vec::len[ty::arg](arg_tys); - let supplied_arg_count = vec::len[option::t<@ast::expr>](args); + let expected_arg_count = vec::len::(arg_tys); + let supplied_arg_count = vec::len::>(args); if expected_arg_count != supplied_arg_count { fcx.ccx.tcx.sess.span_fatal(sp, #fmt("this function takes %u \ @@ -1649,7 +1650,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, args: &[@ast::expr], call_kind: call_kind) -> bool { let args_opt_0: [option::t<@ast::expr>] = ~[]; for arg: @ast::expr in args { - args_opt_0 += ~[some[@ast::expr](arg)]; + args_opt_0 += ~[some::<@ast::expr>(arg)]; } // Call the generic checker. @@ -1870,7 +1871,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 vec::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"); @@ -2093,7 +2094,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 < vec::len[option::t<@ast::expr>](args) { + while i < vec::len::>(args) { alt args.(i) { some(_) {/* no-op */ } none. { arg_tys_1 += ~[arg_tys.(i)]; } @@ -2259,7 +2260,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 >= vec::len[ty::field](fields) { + if ix >= vec::len::(fields) { tcx.sess.span_fatal(expr.span, "bad index on record"); } write::ty_only_fixup(fcx, id, fields.(ix).mt.ty); @@ -2267,7 +2268,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 >= vec::len[ty::method](methods) { + if ix >= vec::len::(methods) { tcx.sess.span_fatal(expr.span, "bad index on obj"); } let meth = methods.(ix); @@ -2420,8 +2421,8 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, let f = bind filtering_fn(fcx.ccx, _, ao.methods); inner_obj_methods = - std::vec::filter_map[ty::method, - ty::method](f, inner_obj_methods); + std::vec::filter_map::(f, inner_obj_methods); method_types += inner_obj_methods; } @@ -2433,7 +2434,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 < vec::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))); @@ -2446,7 +2447,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } // Now remove the info from the stack. - vec::pop[obj_info](fcx.ccx.obj_infos); + vec::pop::(fcx.ccx.obj_infos); } ast::expr_uniq(x) { let t = next_ty_var(fcx); @@ -2474,7 +2475,7 @@ fn next_ty_var(fcx: &@fn_ctxt) -> ty::t { } fn get_obj_info(ccx: &@crate_ctxt) -> option::t { - ret vec::last[obj_info](ccx.obj_infos); + ret vec::last::(ccx.obj_infos); } fn check_decl_initializer(fcx: &@fn_ctxt, nid: ast::node_id, @@ -2569,8 +2570,8 @@ fn check_const(ccx: &@crate_ctxt, sp: &span, e: &@ast::expr, purity: ast::pure_fn, proto: ast::proto_fn, var_bindings: ty::unify::mk_var_bindings(), - locals: new_int_hash[int](), - local_names: new_int_hash[ast::ident](), + locals: new_int_hash::(), + local_names: new_int_hash::(), next_var_id: @mutable 0, mutable fixups: fixups, ccx: ccx}; @@ -2653,7 +2654,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. - vec::pop[obj_info](ccx.obj_infos); + vec::pop::(ccx.obj_infos); } _ {/* nothing to do */ } } diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 5500d7a3e68..9fedd515620 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -142,7 +142,7 @@ type pat_id_map = std::map::hashmap; // This is used because same-named variables in alternative patterns need to // use the node_id of their namesake in the first pattern. fn pat_id_map(pat: &@pat) -> pat_id_map { - let map = std::map::new_str_hash[node_id](); + let map = std::map::new_str_hash::(); for each bound in pat_bindings(pat) { let name = alt bound.node { pat_bind(n) { n } }; map.insert(name, bound.id); @@ -661,7 +661,7 @@ fn eq_ty(a: &@ty, b: &@ty) -> bool { ret std::box::ptr_eq(a, b); } fn hash_ty(t: &@ty) -> uint { ret t.span.lo << 16u + t.span.hi; } fn block_from_expr(e: @expr) -> blk { - let blk_ = {stmts: ~[], expr: option::some[@expr](e), id: e.id}; + let blk_ = {stmts: ~[], expr: option::some::<@expr>(e), id: e.id}; ret {node: blk_, span: e.span}; } diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 5a9b3ac1d19..9c0ea438678 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -20,7 +20,7 @@ tag syntax_extension { // A temporary hard-coded map of methods for expanding syntax extension // AST nodes into full ASTs fn syntax_expander_table() -> hashmap { - let syntax_expanders = new_str_hash[syntax_extension](); + let syntax_expanders = new_str_hash::(); syntax_expanders.insert("fmt", normal(ext::fmt::expand_syntax_ext)); syntax_expanders.insert("env", normal(ext::env::expand_syntax_ext)); syntax_expanders.insert("macro", diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index 498792b80b0..0ec14a1a399 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -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 vec::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/fmt.rs b/src/comp/syntax/ext/fmt.rs index fd0ba7d4d01..2dd607d1cfb 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -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 vec::len[@ast::expr](args) == 0u { + if vec::len::<@ast::expr>(args) == 0u { cx.span_fatal(sp, "#fmt requires a format string"); } let fmt = @@ -93,7 +93,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], {node: {mut: ast::imm, ident: ident, expr: val}, span: sp}; astfields += ~[astfield]; } - let recexpr = ast::expr_rec(astfields, option::none[@ast::expr]); + let recexpr = ast::expr_rec(astfields, option::none::<@ast::expr>); ret @{id: cx.next_id(), node: recexpr, span: sp}; } fn make_path_vec(cx: &ext_ctxt, ident: str) -> [str] { @@ -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 vec::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 = vec::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 841f8221e3e..41ef3e976ea 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -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 vec::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 462f9d7ce0c..a0443aeee82 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -167,7 +167,7 @@ fn acumm_bindings(cx: &ext_ctxt, b_dest: &bindings, b_src: &bindings) { } fn pattern_to_selectors(cx: &ext_ctxt, e: @expr) -> binders { let res: binders = - {real_binders: new_str_hash[selector](), + {real_binders: new_str_hash::(), mutable literal_ast_matchers: ~[]}; //this oughta return binders instead, but macro args are a sequence of //expressions, rather than a single expression @@ -183,7 +183,7 @@ bindings. Most of the work is done in p_t_s, which generates the selectors. */ fn use_selectors_to_bind(b: &binders, e: @expr) -> option::t { - let res = new_str_hash[arb_depth](); + let res = new_str_hash::>(); //need to do this first, to check vec lengths. for sel: selector in b.literal_ast_matchers { alt sel(match_expr(e)) { none. { ret none; } _ { } } @@ -262,7 +262,7 @@ fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t>, /* helper for transcribe_exprs: what vars from `b` occur in `e`? */ iter free_vars(b: &bindings, e: @expr) -> ident { - let idents: hashmap = new_str_hash[()](); + let idents: hashmap = new_str_hash::<()>(); fn mark_ident(i: &ident, fld: ast_fold, b: &bindings, idents: &hashmap) -> ident { if b.contains_key(i) { idents.insert(i, ()); } diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index 5e6db11c9d2..eadb63f766c 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -488,9 +488,9 @@ fn noop_fold_local(l: &local_, fld: ast_fold) -> local_ { ret {ty: fld.fold_ty(l.ty), pat: fld.fold_pat(l.pat), init: alt l.init { - option::none[initializer]. { l.init } - option::some[initializer](init) { - option::some[initializer]({op: init.op, + option::none::. { l.init } + option::some::(init) { + option::some::({op: init.op, expr: fld.fold_expr(init.expr)}) } }, diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 2d92da32273..ecf3cf87fa6 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -188,7 +188,7 @@ fn scan_exponent(rdr: &reader) -> option::t { if str::byte_len(exponent) > 0u { ret some(rslt + exponent); } else { rdr.err("scan_exponent: bad fp literal"); fail; } - } else { ret none[str]; } + } else { ret none::; } } fn scan_dec_digits(rdr: &reader) -> str { @@ -301,14 +301,14 @@ fn scan_number(c: char, rdr: &reader) -> token::token { } } else { - ret token::LIT_FLOAT(interner::intern[str](*rdr.get_interner(), + ret token::LIT_FLOAT(interner::intern::(*rdr.get_interner(), float_str)); } } let maybe_exponent = scan_exponent(rdr); alt maybe_exponent { some(s) { - ret token::LIT_FLOAT(interner::intern[str](*rdr.get_interner(), + ret token::LIT_FLOAT(interner::intern::(*rdr.get_interner(), dec_str + s)); } none. { ret token::LIT_INT(accum_int); } @@ -350,7 +350,7 @@ fn next_token_inner(rdr: &reader) -> token::token { } if str::eq(accum_str, "_") { ret token::UNDERSCORE; } let is_mod_name = c == ':' && rdr.next() == ':'; - ret token::IDENT(interner::intern[str](*rdr.get_interner(), + ret token::IDENT(interner::intern::(*rdr.get_interner(), accum_str), is_mod_name); } if is_dec_digit(c) { ret scan_number(c, rdr); } @@ -510,7 +510,7 @@ fn next_token_inner(rdr: &reader) -> token::token { } } rdr.bump(); - ret token::LIT_STR(interner::intern[str](*rdr.get_interner(), + ret token::LIT_STR(interner::intern::(*rdr.get_interner(), accum_str)); } '-' { @@ -712,7 +712,7 @@ fn gather_comments_and_literals(cm: &codemap::codemap, path: str, srdr: io::reader) -> {cmnts: [cmnt], lits: [lit]} { let src = str::unsafe_from_bytes(srdr.read_whole_stream()); - let itr = @interner::mk[str](str::hash, str::eq); + let itr = @interner::mk::(str::hash, str::eq); let rdr = new_reader(cm, src, codemap::new_filemap(path, 0u, 0u), itr); let comments: [cmnt] = ~[]; let literals: [lit] = ~[]; diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index aa5628b1bad..2cd31d5b3c1 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -672,7 +672,7 @@ fn parse_seq_lt_gt(sep: option::t, f: fn(&parser) -> T, p: &parser) -> spanned<[T]> { let lo = p.get_lo_pos(); expect(p, token::LT); - let result = parse_seq_to_before_gt[T](sep, f, p); + let result = parse_seq_to_before_gt::(sep, f, p); let hi = p.get_hi_pos(); expect_gt(p); ret spanned(lo, hi, result); @@ -705,7 +705,7 @@ fn parse_seq(bra: token::token, ket: token::token, p: &parser) -> spanned<[T]> { let lo = p.get_lo_pos(); expect(p, bra); - let result = parse_seq_to_before_end[T](ket, sep, f, p); + let result = parse_seq_to_before_end::(ket, sep, f, p); let hi = p.get_hi_pos(); p.bump(); ret spanned(lo, hi, result); diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs index b9faac40dc3..64088ec8f0a 100644 --- a/src/comp/syntax/parse/token.rs +++ b/src/comp/syntax/parse/token.rs @@ -153,12 +153,12 @@ fn to_str(r: lexer::reader, t: token) -> str { ret int::to_str(i, 10u) + "_" + ty_mach_to_str(tm); } LIT_MACH_FLOAT(tm, s) { - ret interner::get[str](*r.get_interner(), s) + "_" + + ret interner::get::(*r.get_interner(), s) + "_" + ty_mach_to_str(tm); } - LIT_FLOAT(s) { ret interner::get[str](*r.get_interner(), s); } + LIT_FLOAT(s) { ret interner::get::(*r.get_interner(), s); } LIT_STR(s) { // FIXME: escape. - ret "\"" + interner::get[str](*r.get_interner(), s) + "\""; + ret "\"" + interner::get::(*r.get_interner(), s) + "\""; } LIT_CHAR(c) { // FIXME: escape. @@ -171,7 +171,7 @@ fn to_str(r: lexer::reader, t: token) -> str { /* Name components */ IDENT(s, _) { - ret interner::get[str](*r.get_interner(), s); + ret interner::get::(*r.get_interner(), s); } IDX(i) { ret "_" + int::to_str(i, 10u); } UNDERSCORE. { ret "_"; } diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 66a1062de7e..7bd89ed36d9 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -55,9 +55,9 @@ fn end(s: &ps) { vec::pop(s.boxes); pp::end(s.s); } fn rust_printer(writer: io::writer) -> ps { let boxes: [pp::breaks] = ~[]; ret @{s: pp::mk_printer(writer, default_columns), - cm: none[codemap], - comments: none[[lexer::cmnt]], - literals: none[[lexer::lit]], + cm: none::, + comments: none::<[lexer::cmnt]>, + literals: none::<[lexer::lit]>, mutable cur_cmnt: 0u, mutable cur_lit: 0u, mutable boxes: boxes, @@ -231,7 +231,7 @@ fn commasep(s: &ps, b: breaks, elts: &[IN], op: fn(&ps, &IN) ) { fn commasep_cmnt(s: &ps, b: breaks, elts: &[IN], op: fn(&ps, &IN) , get_span: fn(&IN) -> codemap::span ) { box(s, 0u, b); - let len = vec::len[IN](elts); + let len = vec::len::(elts); let i = 0u; for elt: IN in elts { maybe_print_comment(s, get_span(elt).hi); @@ -327,7 +327,7 @@ fn print_type(s: &ps, ty: &@ast::ty) { pclose(s); } ast::ty_fn(proto, inputs, output, cf, constrs) { - print_ty_fn(s, proto, none[str], inputs, output, cf, constrs); + print_ty_fn(s, proto, none::, inputs, output, cf, constrs); } ast::ty_obj(methods) { head(s, "obj"); @@ -486,7 +486,7 @@ fn print_item(s: &ps, item: &@ast::item) { pclose(s); } word(s.s, ";"); - maybe_print_trailing_comment(s, v.span, none[uint]); + maybe_print_trailing_comment(s, v.span, none::); } bclose(s, item.span); } @@ -575,7 +575,7 @@ fn print_stmt(s: &ps, st: &ast::stmt) { ast::stmt_expr(expr, _) { space_if_not_bol(s); print_expr(s, expr); } } if parse::parser::stmt_ends_with_semi(st) { word(s.s, ";"); } - maybe_print_trailing_comment(s, st.span, none[uint]); + maybe_print_trailing_comment(s, st.span, none::); } fn print_block(s: &ps, blk: &ast::blk) { @@ -1436,9 +1436,9 @@ fn next_lit(s: &ps) -> option::t { some(lits) { if s.cur_lit < vec::len(lits) { ret some(lits.(s.cur_lit)); - } else { ret none[lexer::lit]; } + } else { ret none::; } } - _ { ret none[lexer::lit]; } + _ { ret none::; } } } @@ -1528,9 +1528,9 @@ fn next_comment(s: &ps) -> option::t { some(cmnts) { if s.cur_cmnt < vec::len(cmnts) { ret some(cmnts.(s.cur_cmnt)); - } else { ret none[lexer::cmnt]; } + } else { ret none::; } } - _ { ret none[lexer::cmnt]; } + _ { ret none::; } } } @@ -1542,7 +1542,7 @@ fn constr_args_to_str(f: &fn(&T) -> str , let s = "("; for a: @ast::sp_constr_arg in args { if comma { s += ", "; } else { comma = true; } - s += constr_arg_to_str[T](f, a.node); + s += constr_arg_to_str::(f, a.node); } s += ")"; ret s; @@ -1611,7 +1611,7 @@ fn proto_to_str(p: &ast::proto) -> str { fn ty_constr_to_str(c: &@ast::ty_constr) -> str { ret path_to_str(c.node.path) + - constr_args_to_str[ast::path](path_to_str, c.node.args); + constr_args_to_str::(path_to_str, c.node.args); } diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 8edfd3cb618..0b80bdd5bfd 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -17,7 +17,7 @@ type interner = eqer: eqfn}; fn mk<@T>(hasher: hashfn, eqer: eqfn) -> interner { - let m = map::mk_hashmap[T, uint](hasher, eqer); + let m = map::mk_hashmap::(hasher, eqer); ret {map: m, mutable vect: ~[], hasher: hasher, eqer: eqer}; } @@ -25,7 +25,7 @@ fn intern<@T>(itr: &interner, val: &T) -> uint { alt itr.map.find(val) { some(idx) { ret idx; } none. { - let new_idx = vec::len[T](itr.vect); + let new_idx = vec::len::(itr.vect); itr.map.insert(val, new_idx); itr.vect += ~[val]; ret new_idx; diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index 2b91f704285..fd7a6b22661 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -36,20 +36,20 @@ type visitor = fn(&_fn, &[ty_param], &span, &fn_ident, node_id, &E, &vt) }; fn default_visitor() -> visitor { - ret @{visit_mod: bind visit_mod[E](_, _, _, _), - visit_view_item: bind visit_view_item[E](_, _, _), - visit_native_item: bind visit_native_item[E](_, _, _), - visit_item: bind visit_item[E](_, _, _), - visit_local: bind visit_local[E](_, _, _), - visit_block: bind visit_block[E](_, _, _), - visit_stmt: bind visit_stmt[E](_, _, _), - visit_arm: bind visit_arm[E](_, _, _), - visit_pat: bind visit_pat[E](_, _, _), - visit_decl: bind visit_decl[E](_, _, _), - visit_expr: bind visit_expr[E](_, _, _), - visit_ty: bind visit_ty[E](_, _, _), - visit_constr: bind visit_constr[E](_, _, _, _, _), - visit_fn: bind visit_fn[E](_, _, _, _, _, _, _)}; + ret @{visit_mod: bind visit_mod::(_, _, _, _), + visit_view_item: bind visit_view_item::(_, _, _), + visit_native_item: bind visit_native_item::(_, _, _), + visit_item: bind visit_item::(_, _, _), + visit_local: bind visit_local::(_, _, _), + visit_block: bind visit_block::(_, _, _), + visit_stmt: bind visit_stmt::(_, _, _), + visit_arm: bind visit_arm::(_, _, _), + visit_pat: bind visit_pat::(_, _, _), + visit_decl: bind visit_decl::(_, _, _), + visit_expr: bind visit_expr::(_, _, _), + visit_ty: bind visit_ty::(_, _, _), + visit_constr: bind visit_constr::(_, _, _, _, _), + visit_fn: bind visit_fn::(_, _, _, _, _, _, _)}; } fn visit_crate(c: &crate, e: &E, v: &vt) { diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs index cfc96844933..984e047834b 100644 --- a/src/comp/util/common.rs +++ b/src/comp/util/common.rs @@ -44,7 +44,7 @@ fn hash_def(d: &ast::def_id) -> uint { fn new_def_hash<@V>() -> std::map::hashmap { let hasher: std::map::hashfn = hash_def; let eqer: std::map::eqfn = def_eq; - ret std::map::mk_hashmap[ast::def_id, V](hasher, eqer); + ret std::map::mk_hashmap::(hasher, eqer); } fn field_expr(f: &ast::field) -> @ast::expr { ret f.node.expr; } diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index a13c96fe469..37ba49b0a67 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -61,7 +61,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str { ret s; } fn method_to_str(cx: &ctxt, m: &method) -> str { - ret fn_to_str(cx, m.proto, some[ast::ident](m.ident), m.inputs, + ret fn_to_str(cx, m.proto, some::(m.ident), m.inputs, m.output, m.cf, m.constrs) + ";"; } fn field_to_str(cx: &ctxt, f: &field) -> str { @@ -109,7 +109,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str { // The user should never see this if the cname is set properly! s += ""; - if vec::len[t](tps) > 0u { + if vec::len::(tps) > 0u { let strs: [str] = ~[]; for typ: t in tps { strs += ~[ty_to_str(cx, typ)]; } s += "[" + str::connect(strs, ",") + "]"; @@ -165,7 +165,7 @@ fn constrs_str(constrs: &[@constr]) -> str { fn ty_constr_to_str(c: &@ast::spanned>) -> str { ret path_to_str(c.node.path) + - constr_args_to_str[ast::path](path_to_str, c.node.args); + constr_args_to_str::(path_to_str, c.node.args); } // Local Variables: