diff options
| author | Michael Sullivan <sully@msully.net> | 2012-06-25 20:00:46 -0700 |
|---|---|---|
| committer | Michael Sullivan <sully@msully.net> | 2012-06-25 20:00:46 -0700 |
| commit | 329eca6044fdf376a7a89ec7a96dba7a8b884cf7 (patch) | |
| tree | 7008814278a066914b6ba36818388d5212ffda9f /src/rustc/metadata | |
| parent | c087aaf56b1109163126fea4c2760f8414ffbe56 (diff) | |
| download | rust-329eca6044fdf376a7a89ec7a96dba7a8b884cf7.tar.gz rust-329eca6044fdf376a7a89ec7a96dba7a8b884cf7.zip | |
Make vectors uglier ([]/~). Sorry. Should be temporary. Closes #2725.
Diffstat (limited to 'src/rustc/metadata')
| -rw-r--r-- | src/rustc/metadata/astencode.rs | 22 | ||||
| -rw-r--r-- | src/rustc/metadata/creader.rs | 22 | ||||
| -rw-r--r-- | src/rustc/metadata/csearch.rs | 29 | ||||
| -rw-r--r-- | src/rustc/metadata/cstore.rs | 34 | ||||
| -rw-r--r-- | src/rustc/metadata/decoder.rs | 128 | ||||
| -rw-r--r-- | src/rustc/metadata/encoder.rs | 152 | ||||
| -rw-r--r-- | src/rustc/metadata/filesearch.rs | 26 | ||||
| -rw-r--r-- | src/rustc/metadata/loader.rs | 32 | ||||
| -rw-r--r-- | src/rustc/metadata/tydecode.rs | 60 | ||||
| -rw-r--r-- | src/rustc/metadata/tyencode.rs | 2 |
10 files changed, 255 insertions, 252 deletions
diff --git a/src/rustc/metadata/astencode.rs b/src/rustc/metadata/astencode.rs index b6b0060b5fb..391ab8bfda4 100644 --- a/src/rustc/metadata/astencode.rs +++ b/src/rustc/metadata/astencode.rs @@ -68,7 +68,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, ii: ast::inlined_item) { #debug["> Encoding inlined item: %s::%s (%u)", ast_map::path_to_str(path), ii.ident(), - ebml_w.writer.tell()]; + ebml_w.writer.tell()]/~; let id_range = compute_id_range_for_inlined_item(ii); ebml_w.wr_tag(c::tag_ast as uint) {|| @@ -79,7 +79,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, #debug["< Encoded inlined fn: %s::%s (%u)", ast_map::path_to_str(path), ii.ident(), - ebml_w.writer.tell()]; + ebml_w.writer.tell()]/~; } fn decode_inlined_item(cdata: cstore::crate_metadata, @@ -103,7 +103,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata, #debug["Fn named: %s", ii.ident()]; decode_side_tables(xcx, ast_doc); #debug["< Decoded inlined fn: %s::%s", - ast_map::path_to_str(path), ii.ident()]; + ast_map::path_to_str(path), ii.ident()]/~; alt ii { ast::ii_item(i) { #debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<", @@ -522,7 +522,7 @@ impl helpers for ebml::writer { e::write_type(ecx, self, ty) } - fn emit_tys(ecx: @e::encode_ctxt, tys: [ty::t]) { + fn emit_tys(ecx: @e::encode_ctxt, tys: [ty::t]/~) { self.emit_from_vec(tys) {|ty| e::write_type(ecx, self, ty) } @@ -707,7 +707,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, impl decoder for ebml::doc { fn as_int() -> int { ebml::doc_as_u64(self) as int } - fn [](tag: c::astencode_tag) -> ebml::doc { + fn []/~(tag: c::astencode_tag) -> ebml::doc { ebml::get_doc(self, tag as uint) } fn opt_child(tag: c::astencode_tag) -> option<ebml::doc> { @@ -727,11 +727,11 @@ impl decoder for ebml::ebml_deserializer { xcx.tr_def_id(_)) } - fn read_tys(xcx: extended_decode_ctxt) -> [ty::t] { + fn read_tys(xcx: extended_decode_ctxt) -> [ty::t]/~ { self.read_to_vec {|| self.read_ty(xcx) } } - fn read_bounds(xcx: extended_decode_ctxt) -> @[ty::param_bound] { + fn read_bounds(xcx: extended_decode_ctxt) -> @[ty::param_bound]/~ { tydecode::parse_bounds_data( self.parent.data, self.pos, xcx.dcx.cdata.cnum, xcx.dcx.tcx, xcx.tr_def_id(_)) @@ -765,7 +765,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt, #debug[">> Side table document with tag 0x%x \ found for id %d (orig %d)", - tag, id, id0]; + tag, id, id0]/~; if tag == (c::tag_table_mutbl as uint) { dcx.maps.mutbl_map.insert(id, ()); @@ -859,7 +859,7 @@ type fake_session = (); #[cfg(test)] impl of fake_ext_ctxt for fake_session { - fn cfg() -> ast::crate_cfg { [] } + fn cfg() -> ast::crate_cfg { []/~ } fn parse_sess() -> parse::parse_sess { new_parse_sess() } } @@ -922,13 +922,13 @@ fn test_simplification() { let item_in = ast::ii_item(#ast(item) { fn new_int_alist<B: copy>() -> alist<int, B> { fn eq_int(&&a: int, &&b: int) -> bool { a == b } - ret {eq_fn: eq_int, mut data: []}; + ret {eq_fn: eq_int, mut data: []/~}; } }); let item_out = simplify_ast(item_in); let item_exp = ast::ii_item(#ast(item) { fn new_int_alist<B: copy>() -> alist<int, B> { - ret {eq_fn: eq_int, mut data: []}; + ret {eq_fn: eq_int, mut data: []/~}; } }); alt (item_out, item_exp) { diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index c63d03ce239..c9146135bca 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -43,7 +43,7 @@ type cache_entry = { cnum: int, span: span, hash: @str, - metas: @[@ast::meta_item] + metas: @[@ast::meta_item]/~ }; fn dump_crates(crate_cache: dvec<cache_entry>) { @@ -54,7 +54,7 @@ fn dump_crates(crate_cache: dvec<cache_entry>) { #debug("hash: %?", entry.hash); let attrs = [ attr::mk_attr(attr::mk_list_item(@"link", *entry.metas)) - ]; + ]/~; for attr::find_linkage_attrs(attrs).each {|attr| #debug("meta: %s", pprust::attr_to_str(attr)); } @@ -62,7 +62,7 @@ fn dump_crates(crate_cache: dvec<cache_entry>) { } fn warn_if_multiple_versions(diag: span_handler, - crate_cache: [cache_entry]) { + crate_cache: [cache_entry]/~) { import either::*; if crate_cache.len() != 0u { @@ -86,7 +86,7 @@ fn warn_if_multiple_versions(diag: span_handler, diag.span_note(match.span, "used here"); let attrs = [ attr::mk_attr(attr::mk_list_item(@"link", *match.metas)) - ]; + ]/~; loader::note_linkage_attrs(diag, attrs); } } @@ -161,21 +161,21 @@ fn visit_item(e: env, i: @ast::item) { } fn metas_with(ident: ast::ident, key: ast::ident, - metas: [@ast::meta_item]) -> [@ast::meta_item] { + metas: [@ast::meta_item]/~) -> [@ast::meta_item]/~ { let name_items = attr::find_meta_items_by_name(metas, *key); if name_items.is_empty() { - metas + [attr::mk_name_value_item_str(key, *ident)] + metas + [attr::mk_name_value_item_str(key, *ident)]/~ } else { metas } } fn metas_with_ident(ident: ast::ident, - metas: [@ast::meta_item]) -> [@ast::meta_item] { + metas: [@ast::meta_item]/~) -> [@ast::meta_item]/~ { metas_with(ident, @"name", metas) } -fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> +fn existing_match(e: env, metas: [@ast::meta_item]/~, hash: str) -> option<int> { for e.crate_cache.each {|c| @@ -187,7 +187,7 @@ fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> ret none; } -fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item], +fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item]/~, hash: str, span: span) -> ast::crate_num { let metas = metas_with_ident(ident, metas); @@ -241,7 +241,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item], } // Go through the crate metadata and load any crates that it references -fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { +fn resolve_crate_deps(e: env, cdata: @[u8]/~) -> cstore::cnum_map { #debug("resolving deps of external crate"); // The map from crate numbers in the crate we're resolving to local crate // numbers @@ -249,7 +249,7 @@ fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { for decoder::get_crate_deps(cdata).each {|dep| let extrn_cnum = dep.cnum; let cname = dep.name; - let cmetas = metas_with(dep.vers, @"vers", []); + let cmetas = metas_with(dep.vers, @"vers", []/~); #debug("resolving dep crate %s ver: %s hash: %s", *dep.name, *dep.vers, *dep.hash); alt existing_match(e, metas_with_ident(cname, cmetas), *dep.hash) { diff --git a/src/rustc/metadata/csearch.rs b/src/rustc/metadata/csearch.rs index f65f6110388..f5d628622b2 100644 --- a/src/rustc/metadata/csearch.rs +++ b/src/rustc/metadata/csearch.rs @@ -39,12 +39,12 @@ fn get_type_param_count(cstore: cstore::cstore, def: ast::def_id) -> uint { } fn lookup_defs(cstore: cstore::cstore, cnum: ast::crate_num, - path: [ast::ident]) -> [ast::def] { - let mut result = []; + path: [ast::ident]/~) -> [ast::def]/~ { + let mut result = []/~; #debug("lookup_defs: path = %? cnum = %?", path, cnum); for resolve_path(cstore, cnum, path).each {|elt| let (c, data, def) = elt; - result += [decoder::lookup_def(c, data, def)]; + result += [decoder::lookup_def(c, data, def)]/~; } ret result; } @@ -60,21 +60,21 @@ fn lookup_method_purity(cstore: cstore::cstore, did: ast::def_id) /* Returns a vector of possible def IDs for a given path, in a given crate */ fn resolve_path(cstore: cstore::cstore, cnum: ast::crate_num, - path: [ast::ident]) -> - [(ast::crate_num, @[u8], ast::def_id)] { + path: [ast::ident]/~) -> + [(ast::crate_num, @[u8]/~, ast::def_id)]/~ { let cm = cstore::get_crate_data(cstore, cnum); #debug("resolve_path %s in crates[%d]:%s", ast_util::path_name_i(path), cnum, cm.name); - let mut result = []; + let mut result = []/~; for decoder::resolve_path(path, cm.data).each {|def| if def.crate == ast::local_crate { - result += [(cnum, cm.data, def)]; + result += [(cnum, cm.data, def)]/~; } else { if cm.cnum_map.contains_key(def.crate) { // This reexport is itself a reexport from another crate let next_cnum = cm.cnum_map.get(def.crate); let next_cm_data = cstore::get_crate_data(cstore, next_cnum); - result += [(next_cnum, next_cm_data.data, def)]; + result += [(next_cnum, next_cm_data.data, def)]/~; } } } @@ -88,7 +88,7 @@ fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path { // FIXME #1920: This path is not always correct if the crate is not linked // into the root namespace. - [ast_map::path_mod(@cdata.name)] + path + [ast_map::path_mod(@cdata.name)]/~ + path } enum found_ast { @@ -109,7 +109,8 @@ fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::def_id, decode_inlined_item) } -fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id) -> [ty::variant_info] { +fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id) + -> [ty::variant_info]/~ { let cstore = tcx.cstore; let cdata = cstore::get_crate_data(cstore, def.crate); ret decoder::get_enum_variants(cdata, def.node, tcx) @@ -117,20 +118,20 @@ fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id) -> [ty::variant_info] { fn get_impls_for_mod(cstore: cstore::cstore, def: ast::def_id, name: option<ast::ident>) - -> @[@decoder::_impl] { + -> @[@decoder::_impl]/~ { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impls_for_mod(cdata, def.node, name) {|cnum| cstore::get_crate_data(cstore, cnum) } } -fn get_iface_methods(tcx: ty::ctxt, def: ast::def_id) -> @[ty::method] { +fn get_iface_methods(tcx: ty::ctxt, def: ast::def_id) -> @[ty::method]/~ { let cstore = tcx.cstore; let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_iface_methods(cdata, def.node, tcx) } -fn get_class_fields(tcx: ty::ctxt, def: ast::def_id) -> [ty::field_ty] { +fn get_class_fields(tcx: ty::ctxt, def: ast::def_id) -> [ty::field_ty]/~ { let cstore = tcx.cstore; let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_class_fields(cdata, def.node) @@ -159,7 +160,7 @@ fn get_field_type(tcx: ty::ctxt, class_id: ast::def_id, class_id, def)}); #debug("got field data %?", the_field); let ty = decoder::item_type(def, the_field, tcx, cdata); - ret {bounds: @[], rp: ast::rp_none, ty: ty}; + ret {bounds: @[]/~, rp: ast::rp_none, ty: ty}; } // Given a def_id for an impl or class, return the iface it implements, diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index ebfa8df3b10..7f7468faea5 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -40,7 +40,7 @@ type cnum_map = map::hashmap<ast::crate_num, ast::crate_num>; type mod_path_map = map::hashmap<ast::def_id, @str>; type crate_metadata = @{name: str, - data: @[u8], + data: @[u8]/~, cnum_map: cnum_map, cnum: ast::crate_num}; @@ -55,9 +55,9 @@ type cstore_private = @{metas: map::hashmap<ast::crate_num, crate_metadata>, use_crate_map: use_crate_map, mod_path_map: mod_path_map, - mut used_crate_files: [str], - mut used_libraries: [str], - mut used_link_args: [str]}; + mut used_crate_files: [str]/~, + mut used_libraries: [str]/~, + mut used_link_args: [str]/~}; // Map from node_id's of local use statements to crate numbers type use_crate_map = map::hashmap<ast::node_id, ast::crate_num>; @@ -74,9 +74,9 @@ fn mk_cstore() -> cstore { ret private(@{metas: meta_cache, use_crate_map: crate_map, mod_path_map: mod_path_map, - mut used_crate_files: [], - mut used_libraries: [], - mut used_link_args: []}); + mut used_crate_files: []/~, + mut used_libraries: []/~, + mut used_link_args: []/~}); } fn get_crate_data(cstore: cstore, cnum: ast::crate_num) -> crate_metadata { @@ -113,11 +113,11 @@ fn iter_crate_data(cstore: cstore, i: fn(ast::crate_num, crate_metadata)) { fn add_used_crate_file(cstore: cstore, lib: str) { if !vec::contains(p(cstore).used_crate_files, lib) { - p(cstore).used_crate_files += [lib]; + p(cstore).used_crate_files += [lib]/~; } } -fn get_used_crate_files(cstore: cstore) -> [str] { +fn get_used_crate_files(cstore: cstore) -> [str]/~ { ret p(cstore).used_crate_files; } @@ -125,11 +125,11 @@ fn add_used_library(cstore: cstore, lib: str) -> bool { assert lib != ""; if vec::contains(p(cstore).used_libraries, lib) { ret false; } - p(cstore).used_libraries += [lib]; + p(cstore).used_libraries += [lib]/~; ret true; } -fn get_used_libraries(cstore: cstore) -> [str] { +fn get_used_libraries(cstore: cstore) -> [str]/~ { ret p(cstore).used_libraries; } @@ -137,7 +137,7 @@ fn add_used_link_args(cstore: cstore, args: str) { p(cstore).used_link_args += str::split_char(args, ' '); } -fn get_used_link_args(cstore: cstore) -> [str] { +fn get_used_link_args(cstore: cstore) -> [str]/~ { ret p(cstore).used_link_args; } @@ -153,15 +153,15 @@ fn find_use_stmt_cnum(cstore: cstore, // returns hashes of crates directly used by this crate. Hashes are // sorted by crate name. -fn get_dep_hashes(cstore: cstore) -> [@str] { +fn get_dep_hashes(cstore: cstore) -> [@str]/~ { type crate_hash = {name: @str, hash: @str}; - let mut result = []; + let mut result = []/~; for p(cstore).use_crate_map.each_value {|cnum| let cdata = cstore::get_crate_data(cstore, cnum); let hash = decoder::get_crate_hash(cdata.data); #debug("Add hash[%s]: %s", cdata.name, *hash); - result += [{name: @cdata.name, hash: hash}]; + result += [{name: @cdata.name, hash: hash}]/~; }; fn lteq(a: crate_hash, b: crate_hash) -> bool { ret *a.name <= *b.name; @@ -175,9 +175,9 @@ fn get_dep_hashes(cstore: cstore) -> [@str] { ret vec::map(sorted, mapper); } -fn get_path(cstore: cstore, d: ast::def_id) -> [ast::ident] { +fn get_path(cstore: cstore, d: ast::def_id) -> [ast::ident]/~ { // let f = bind str::split_str(_, "::"); - option::map_default(p(cstore).mod_path_map.find(d), [], + option::map_default(p(cstore).mod_path_map.find(d), []/~, {|ds| str::split_str(*ds, "::").map({|x|@x})}) } // Local Variables: diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 8f25281f4a8..9979bda226c 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -53,8 +53,8 @@ export translate_def_id; // what crate that's in and give us a def_id that makes sense for the current // build. -fn lookup_hash(d: ebml::doc, eq_fn: fn@([u8]) -> bool, hash: uint) -> - [ebml::doc] { +fn lookup_hash(d: ebml::doc, eq_fn: fn@([u8]/~) -> bool, hash: uint) -> + [ebml::doc]/~ { let index = ebml::get_doc(d, tag_index); let table = ebml::get_doc(index, tag_index_table); let hash_pos = table.start + hash % 256u * 4u; @@ -62,19 +62,19 @@ fn lookup_hash(d: ebml::doc, eq_fn: fn@([u8]) -> bool, hash: uint) -> let {tag:_, doc:bucket} = ebml::doc_at(d.data, pos); // Awkward logic because we can't ret from foreach yet - let mut result: [ebml::doc] = []; + let mut result: [ebml::doc]/~ = []/~; let belt = tag_index_buckets_bucket_elt; ebml::tagged_docs(bucket, belt) {|elt| let pos = io::u64_from_be_bytes(*elt.data, elt.start, 4u) as uint; if eq_fn(vec::slice::<u8>(*elt.data, elt.start + 4u, elt.end)) { - result += [ebml::doc_at(d.data, pos).doc]; + result += [ebml::doc_at(d.data, pos).doc]/~; } }; ret result; } fn maybe_find_item(item_id: int, items: ebml::doc) -> option<ebml::doc> { - fn eq_item(bytes: [u8], item_id: int) -> bool { + fn eq_item(bytes: [u8]/~, item_id: int) -> bool { ret io::u64_from_be_bytes(bytes, 0u, 4u) as int == item_id; } let eqer = {|a|eq_item(a, item_id)}; @@ -90,7 +90,7 @@ fn find_item(item_id: int, items: ebml::doc) -> ebml::doc { // Looks up an item in the given metadata and returns an ebml doc pointing // to the item data. -fn lookup_item(item_id: int, data: @[u8]) -> ebml::doc { +fn lookup_item(item_id: int, data: @[u8]/~) -> ebml::doc { let items = ebml::get_doc(ebml::doc(data), tag_items); alt maybe_find_item(item_id, items) { none { fail(#fmt("lookup_item: id not found: %d", item_id)); } @@ -164,13 +164,13 @@ fn item_impl_iface(item: ebml::doc, tcx: ty::ctxt, cdata: cmd) } fn item_ty_param_bounds(item: ebml::doc, tcx: ty::ctxt, cdata: cmd) - -> @[ty::param_bounds] { - let mut bounds = []; + -> @[ty::param_bounds]/~ { + let mut bounds = []/~; ebml::tagged_docs(item, tag_items_data_item_ty_param_bounds) {|p| let bd = parse_bounds_data(p.data, p.start, cdata.cnum, tcx, {|did| translate_def_id(cdata, did) }); - bounds += [bd]; + bounds += [bd]/~; } @bounds } @@ -194,31 +194,31 @@ fn item_ty_param_count(item: ebml::doc) -> uint { n } -fn enum_variant_ids(item: ebml::doc, cdata: cmd) -> [ast::def_id] { - let mut ids: [ast::def_id] = []; +fn enum_variant_ids(item: ebml::doc, cdata: cmd) -> [ast::def_id]/~ { + let mut ids: [ast::def_id]/~ = []/~; let v = tag_items_data_item_variant; ebml::tagged_docs(item, v) {|p| let ext = parse_def_id(ebml::doc_data(p)); - ids += [{crate: cdata.cnum, node: ext.node}]; + ids += [{crate: cdata.cnum, node: ext.node}]/~; }; ret ids; } // Given a path and serialized crate metadata, returns the IDs of the // definitions the path may refer to. -fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] { - fn eq_item(data: [u8], s: str) -> bool { +fn resolve_path(path: [ast::ident]/~, data: @[u8]/~) -> [ast::def_id]/~ { + fn eq_item(data: [u8]/~, s: str) -> bool { ret str::eq(str::from_bytes(data), s); } let s = ast_util::path_name_i(path); let md = ebml::doc(data); let paths = ebml::get_doc(md, tag_paths); let eqer = {|a|eq_item(a, s)}; - let mut result: [ast::def_id] = []; + let mut result: [ast::def_id]/~ = []/~; #debug("resolve_path: looking up %s", s); for lookup_hash(paths, eqer, hash_path(s)).each {|doc| let did_doc = ebml::get_doc(doc, tag_def_id); - result += [parse_def_id(ebml::doc_data(did_doc))]; + result += [parse_def_id(ebml::doc_data(did_doc))]/~; } ret result; } @@ -229,16 +229,16 @@ fn item_path(item_doc: ebml::doc) -> ast_map::path { let len_doc = ebml::get_doc(path_doc, tag_path_len); let len = ebml::doc_as_u32(len_doc) as uint; - let mut result = []; + let mut result = []/~; vec::reserve(result, len); ebml::docs(path_doc) {|tag, elt_doc| if tag == tag_path_elt_mod { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_mod(@str)]; + result += [ast_map::path_mod(@str)]/~; } else if tag == tag_path_elt_name { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_name(@str)]; + result += [ast_map::path_name(@str)]/~; } else { // ignore tag_path_len element } @@ -252,11 +252,11 @@ fn item_name(item: ebml::doc) -> ast::ident { @str::from_bytes(ebml::doc_data(name)) } -fn lookup_item_name(data: @[u8], id: ast::node_id) -> ast::ident { +fn lookup_item_name(data: @[u8]/~, id: ast::node_id) -> ast::ident { item_name(lookup_item(id, data)) } -fn lookup_def(cnum: ast::crate_num, data: @[u8], did_: ast::def_id) -> +fn lookup_def(cnum: ast::crate_num, data: @[u8]/~, did_: ast::def_id) -> ast::def { let item = lookup_item(did_.node, data); let fam_ch = item_family(item); @@ -288,12 +288,12 @@ fn get_type(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) let t = item_type({crate: cdata.cnum, node: id}, item, tcx, cdata); let tp_bounds = if family_has_type_params(item_family(item)) { item_ty_param_bounds(item, tcx, cdata) - } else { @[] }; + } else { @[]/~ }; let rp = item_ty_region_param(item); ret {bounds: tp_bounds, rp: rp, ty: t}; } -fn get_type_param_count(data: @[u8], id: ast::node_id) -> uint { +fn get_type_param_count(data: @[u8]/~, id: ast::node_id) -> uint { item_ty_param_count(lookup_item(id, data)) } @@ -351,7 +351,7 @@ fn class_dtor(cdata: cmd, id: ast::node_id) -> option<ast::def_id> { found } -fn get_symbol(data: @[u8], id: ast::node_id) -> str { +fn get_symbol(data: @[u8]/~, id: ast::node_id) -> str { ret item_symbol(lookup_item(id, data)); } @@ -392,11 +392,11 @@ fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt, } fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) - -> [ty::variant_info] { + -> [ty::variant_info]/~ { let data = cdata.data; let items = ebml::get_doc(ebml::doc(data), tag_items); let item = find_item(id, items); - let mut infos: [ty::variant_info] = []; + let mut infos: [ty::variant_info]/~ = []/~; let variant_ids = enum_variant_ids(item, cdata); let mut disr_val = 0; for variant_ids.each {|did| @@ -404,10 +404,10 @@ fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) let ctor_ty = item_type({crate: cdata.cnum, node: id}, item, tcx, cdata); let name = item_name(item); - let mut arg_tys: [ty::t] = []; + let mut arg_tys: [ty::t]/~ = []/~; alt ty::get(ctor_ty).struct { ty::ty_fn(f) { - for f.inputs.each {|a| arg_tys += [a.ty]; } + for f.inputs.each {|a| arg_tys += [a.ty]/~; } } _ { /* Nullary enum variant. */ } } @@ -416,7 +416,7 @@ fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) _ { /* empty */ } } infos += [@{args: arg_tys, ctor_ty: ctor_ty, name: name, - id: did, disr_val: disr_val}]; + id: did, disr_val: disr_val}]/~; disr_val += 1; } ret infos; @@ -424,18 +424,18 @@ fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) // NB: These types are duplicated in resolve.rs type method_info = {did: ast::def_id, n_tps: uint, ident: ast::ident}; -type _impl = {did: ast::def_id, ident: ast::ident, methods: [@method_info]}; +type _impl = {did: ast::def_id, ident: ast::ident, methods: [@method_info]/~}; fn item_impl_methods(cdata: cmd, item: ebml::doc, base_tps: uint) - -> [@method_info] { - let mut rslt = []; + -> [@method_info]/~ { + let mut rslt = []/~; ebml::tagged_docs(item, tag_item_impl_method) {|doc| let m_did = parse_def_id(ebml::doc_data(doc)); let mth_item = lookup_item(m_did.node, cdata.data); rslt += [@{did: translate_def_id(cdata, m_did), /* FIXME (maybe #2323) tjc: take a look at this. */ n_tps: item_ty_param_count(mth_item) - base_tps, - ident: item_name(mth_item)}]; + ident: item_name(mth_item)}]/~; } rslt } @@ -443,10 +443,10 @@ fn item_impl_methods(cdata: cmd, item: ebml::doc, base_tps: uint) fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id, name: option<ast::ident>, get_cdata: fn(ast::crate_num) -> cmd) - -> @[@_impl] { + -> @[@_impl]/~ { let data = cdata.data; let mod_item = lookup_item(m_id, data); - let mut result = []; + let mut result = []/~; ebml::tagged_docs(mod_item, tag_mod_impl) {|doc| let did = parse_def_id(ebml::doc_data(doc)); let local_did = translate_def_id(cdata, did); @@ -461,7 +461,7 @@ fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id, result += [@{ did: local_did, ident: nm, methods: item_impl_methods(impl_cdata, item, base_tps) - }]; + }]/~; }; } @result @@ -469,10 +469,10 @@ fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id, /* Works for both classes and ifaces */ fn get_iface_methods(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) - -> @[ty::method] { + -> @[ty::method]/~ { let data = cdata.data; let item = lookup_item(id, data); - let mut result = []; + let mut result = []/~; ebml::tagged_docs(item, tag_item_iface_method) {|mth| let bounds = item_ty_param_bounds(mth, tcx, cdata); let name = item_name(mth); @@ -487,17 +487,17 @@ fn get_iface_methods(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) 'u' { ast::unsafe_fn } 'f' { ast::impure_fn } 'p' { ast::pure_fn } - }, vis: ast::public}]; + }, vis: ast::public}]/~; } @result } // Helper function that gets either fields or methods fn get_class_members(cdata: cmd, id: ast::node_id, - p: fn(char) -> bool) -> [ty::field_ty] { + p: fn(char) -> bool) -> [ty::field_ty]/~ { let data = cdata.data; let item = lookup_item(id, data); - let mut result = []; + let mut result = []/~; ebml::tagged_docs(item, tag_item_field) {|an_item| let f = item_family(an_item); if p(f) { @@ -505,7 +505,7 @@ fn get_class_members(cdata: cmd, id: ast::node_id, let did = class_member_id(an_item, cdata); let mt = field_mutability(an_item); result += [{ident: name, id: did, vis: - family_to_visibility(f), mutability: mt}]; + family_to_visibility(f), mutability: mt}]/~; } } result @@ -519,7 +519,7 @@ pure fn family_to_visibility(family: char) -> ast::visibility { } /* 'g' for public field, 'j' for private field */ -fn get_class_fields(cdata: cmd, id: ast::node_id) -> [ty::field_ty] { +fn get_class_fields(cdata: cmd, id: ast::node_id) -> [ty::field_ty]/~ { get_class_members(cdata, id, {|f| f == 'g' || f == 'j'}) } @@ -576,12 +576,12 @@ fn item_family_to_str(fam: char) -> str { } } -fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { - let mut items: [@ast::meta_item] = []; +fn get_meta_items(md: ebml::doc) -> [@ast::meta_item]/~ { + let mut items: [@ast::meta_item]/~ = []/~; ebml::tagged_docs(md, tag_meta_item_word) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); - items += [attr::mk_word_item(@n)]; + items += [attr::mk_word_item(@n)]/~; }; ebml::tagged_docs(md, tag_meta_item_name_value) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); @@ -590,19 +590,19 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { let v = str::from_bytes(ebml::doc_data(vd)); // FIXME (#623): Should be able to decode meta_name_value variants, // but currently the encoder just drops them - items += [attr::mk_name_value_item_str(@n, v)]; + items += [attr::mk_name_value_item_str(@n, v)]/~; }; ebml::tagged_docs(md, tag_meta_item_list) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); let subitems = get_meta_items(meta_item_doc); - items += [attr::mk_list_item(@n, subitems)]; + items += [attr::mk_list_item(@n, subitems)]/~; }; ret items; } -fn get_attributes(md: ebml::doc) -> [ast::attribute] { - let mut attrs: [ast::attribute] = []; +fn get_attributes(md: ebml::doc) -> [ast::attribute]/~ { + let mut attrs: [ast::attribute]/~ = []/~; alt ebml::maybe_get_doc(md, tag_attributes) { option::some(attrs_d) { ebml::tagged_docs(attrs_d, tag_attribute) {|attr_doc| @@ -613,7 +613,7 @@ fn get_attributes(md: ebml::doc) -> [ast::attribute] { let meta_item = meta_items[0]; attrs += [{node: {style: ast::attr_outer, value: *meta_item}, - span: ast_util::dummy_sp()}]; + span: ast_util::dummy_sp()}]/~; }; } option::none { } @@ -637,15 +637,15 @@ fn list_crate_attributes(md: ebml::doc, hash: @str, out: io::writer) { out.write_str("\n\n"); } -fn get_crate_attributes(data: @[u8]) -> [ast::attribute] { +fn get_crate_attributes(data: @[u8]/~) -> [ast::attribute]/~ { ret get_attributes(ebml::doc(data)); } type crate_dep = {cnum: ast::crate_num, name: ast::ident, vers: @str, hash: @str}; -fn get_crate_deps(data: @[u8]) -> [crate_dep] { - let mut deps: [crate_dep] = []; +fn get_crate_deps(data: @[u8]/~) -> [crate_dep]/~ { + let mut deps: [crate_dep]/~ = []/~; let cratedoc = ebml::doc(data); let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps); let mut crate_num = 1; @@ -656,13 +656,13 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] { deps += [{cnum: crate_num, name: @docstr(depdoc, tag_crate_dep_name), vers: @docstr(depdoc, tag_crate_dep_vers), - hash: @docstr(depdoc, tag_crate_dep_hash)}]; + hash: @docstr(depdoc, tag_crate_dep_hash)}]/~; crate_num += 1; }; ret deps; } -fn list_crate_deps(data: @[u8], out: io::writer) { +fn list_crate_deps(data: @[u8]/~, out: io::writer) { out.write_str("=External Dependencies=\n"); for get_crate_deps(data).each {|dep| @@ -673,13 +673,13 @@ fn list_crate_deps(data: @[u8], out: io::writer) { out.write_str("\n"); } -fn get_crate_hash(data: @[u8]) -> @str { +fn get_crate_hash(data: @[u8]/~) -> @str { let cratedoc = ebml::doc(data); let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash); ret @str::from_bytes(ebml::doc_data(hashdoc)); } -fn get_crate_vers(data: @[u8]) -> @str { +fn get_crate_vers(data: @[u8]/~) -> @str { let attrs = decoder::get_crate_attributes(data); ret alt attr::last_meta_item_value_str_by_name( attr::find_linkage_metas(attrs), "vers") { @@ -688,7 +688,7 @@ fn get_crate_vers(data: @[u8]) -> @str { }; } -fn list_crate_items(bytes: @[u8], md: ebml::doc, out: io::writer) { +fn list_crate_items(bytes: @[u8]/~, md: ebml::doc, out: io::writer) { out.write_str("=Items=\n"); let items = ebml::get_doc(md, tag_items); iter_crate_items(bytes) {|path, did| @@ -697,7 +697,7 @@ fn list_crate_items(bytes: @[u8], md: ebml::doc, out: io::writer) { out.write_str("\n"); } -fn iter_crate_items(bytes: @[u8], proc: fn(str, ast::def_id)) { +fn iter_crate_items(bytes: @[u8]/~, proc: fn(str, ast::def_id)) { let md = ebml::doc(bytes); let paths = ebml::get_doc(md, tag_paths); let index = ebml::get_doc(paths, tag_index); @@ -714,14 +714,14 @@ fn iter_crate_items(bytes: @[u8], proc: fn(str, ast::def_id)) { }; } -fn get_crate_module_paths(bytes: @[u8]) -> [(ast::def_id, str)] { +fn get_crate_module_paths(bytes: @[u8]/~) -> [(ast::def_id, str)]/~ { fn mod_of_path(p: str) -> str { str::connect(vec::init(str::split_str(p, "::")), "::") } // find all module (path, def_ids), which are not // fowarded path due to renamed import or reexport - let mut res = []; + let mut res = []/~; let mods = map::str_hash(); iter_crate_items(bytes) {|path, did| let m = mod_of_path(path); @@ -732,7 +732,7 @@ fn get_crate_module_paths(bytes: @[u8]) -> [(ast::def_id, str)] { // Collect everything by now. There might be multiple // paths pointing to the same did. Those will be // unified later by using the mods map - res += [(did, path)]; + res += [(did, path)]/~; } ret vec::filter(res) {|x| let (_, xp) = x; @@ -740,7 +740,7 @@ fn get_crate_module_paths(bytes: @[u8]) -> [(ast::def_id, str)] { } } -fn list_crate_metadata(bytes: @[u8], out: io::writer) { +fn list_crate_metadata(bytes: @[u8]/~, out: io::writer) { let hash = get_crate_hash(bytes); let md = ebml::doc(bytes); list_crate_attributes(md, hash, out); diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 8390989e7dd..c9802da3b03 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -43,8 +43,8 @@ type encode_parms = { diag: span_handler, tcx: ty::ctxt, reachable: hashmap<ast::node_id, ()>, - reexports: [(str, def_id)], - impl_map: fn@(ast::node_id) -> [(ident, def_id)], + reexports: [(str, def_id)]/~, + impl_map: fn@(ast::node_id) -> [(ident, def_id)]/~, item_symbols: hashmap<ast::node_id, str>, discrim_symbols: hashmap<ast::node_id, str>, link_meta: link_meta, @@ -56,8 +56,8 @@ enum encode_ctxt = { diag: span_handler, tcx: ty::ctxt, reachable: hashmap<ast::node_id, ()>, - reexports: [(str, def_id)], - impl_map: fn@(ast::node_id) -> [(ident, def_id)], + reexports: [(str, def_id)]/~, + impl_map: fn@(ast::node_id) -> [(ident, def_id)]/~, item_symbols: hashmap<ast::node_id, str>, discrim_symbols: hashmap<ast::node_id, str>, link_meta: link_meta, @@ -108,8 +108,8 @@ fn encode_mutability(ebml_w: ebml::writer, mt: class_mutability) { type entry<T> = {val: T, pos: uint}; -fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], - path: [ident], &index: [entry<str>]) { +fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant]/~, + path: [ident]/~, &index: [entry<str>]/~) { for variants.each {|variant| add_to_index(ebml_w, path, index, variant.node.name); ebml_w.wr_tag(tag_paths_data_item) {|| @@ -119,15 +119,15 @@ fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], } } -fn add_to_index(ebml_w: ebml::writer, path: [ident], &index: [entry<str>], +fn add_to_index(ebml_w: ebml::writer, path: [ident]/~, &index: [entry<str>]/~, name: ident) { - let full_path = path + [name]; - index += - [{val: ast_util::path_name_i(full_path), pos: ebml_w.writer.tell()}]; + let full_path = path + [name]/~; + vec::push(index, {val: ast_util::path_name_i(full_path), + pos: ebml_w.writer.tell()}); } fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, - path: [ident], &index: [entry<str>]) { + path: [ident]/~, &index: [entry<str>]/~) { for nmod.items.each {|nitem| add_to_index(ebml_w, path, index, nitem.ident); encode_named_def_id(ebml_w, nitem.ident, local_def(nitem.id)); @@ -135,7 +135,7 @@ fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, } fn encode_class_item_paths(ebml_w: ebml::writer, - items: [@class_member], path: [ident], &index: [entry<str>]) { + items: [@class_member]/~, path: [ident]/~, &index: [entry<str>]/~) { for items.each {|it| alt ast_util::class_member_visibility(it) { private { cont; } @@ -152,8 +152,8 @@ fn encode_class_item_paths(ebml_w: ebml::writer, } fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, - module: _mod, path: [ident], - &index: [entry<str>]) { + module: _mod, path: [ident]/~, + &index: [entry<str>]/~) { for module.items.each {|it| if !reachable(ecx, it.id) || !ast_util::is_exported(it.ident, module) { cont; } @@ -170,7 +170,8 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, item_mod(_mod) { ebml_w.wr_tag(tag_paths_data_mod) {|| encode_name_and_def_id(ebml_w, it.ident, it.id); - encode_module_item_paths(ebml_w, ecx, _mod, path + [it.ident], + encode_module_item_paths(ebml_w, ecx, _mod, + path + [it.ident]/~, index); } } @@ -178,7 +179,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, ebml_w.wr_tag(tag_paths_data_mod) {|| encode_name_and_def_id(ebml_w, it.ident, it.id); encode_native_module_item_paths(ebml_w, nmod, - path + [it.ident], index); + path + [it.ident]/~, index); } } item_ty(_, tps, _) { @@ -196,7 +197,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, add_to_index(ebml_w, path, index, it.ident); encode_named_def_id(ebml_w, it.ident, local_def(ctor.node.id)); - encode_class_item_paths(ebml_w, items, path + [it.ident], + encode_class_item_paths(ebml_w, items, path + [it.ident]/~, index); } } @@ -223,9 +224,9 @@ fn encode_iface_ref(ebml_w: ebml::writer, ecx: @encode_ctxt, t: @iface_ref) { } fn encode_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, crate: @crate) - -> [entry<str>] { - let mut index: [entry<str>] = []; - let mut path: [ident] = []; + -> [entry<str>]/~ { + let mut index: [entry<str>]/~ = []/~; + let mut path: [ident]/~ = []/~; ebml_w.start_tag(tag_paths); encode_module_item_paths(ebml_w, ecx, crate.node.module, path, index); encode_reexport_paths(ebml_w, ecx, index); @@ -234,10 +235,10 @@ fn encode_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, crate: @crate) } fn encode_reexport_paths(ebml_w: ebml::writer, - ecx: @encode_ctxt, &index: [entry<str>]) { + ecx: @encode_ctxt, &index: [entry<str>]/~) { for ecx.reexports.each {|reexport| let (path, def_id) = reexport; - index += [{val: path, pos: ebml_w.writer.tell()}]; + index += [{val: path, pos: ebml_w.writer.tell()}]/~; ebml_w.start_tag(tag_paths_data_item); encode_name(ebml_w, @path); encode_def_id(ebml_w, def_id); @@ -256,7 +257,7 @@ fn encode_family(ebml_w: ebml::writer, c: char) { fn def_to_str(did: def_id) -> str { ret #fmt["%d:%d", did.crate, did.node]; } fn encode_type_param_bounds(ebml_w: ebml::writer, ecx: @encode_ctxt, - params: [ty_param]) { + params: [ty_param]/~) { let ty_str_ctxt = @{diag: ecx.diag, ds: def_to_str, tcx: ecx.tcx, @@ -324,14 +325,14 @@ fn encode_parent_item(ebml_w: ebml::writer, id: def_id) { } fn encode_enum_variant_info(ecx: @encode_ctxt, ebml_w: ebml::writer, - id: node_id, variants: [variant], - path: ast_map::path, index: @mut [entry<int>], - ty_params: [ty_param]) { + id: node_id, variants: [variant]/~, + path: ast_map::path, index: @mut [entry<int>]/~, + ty_params: [ty_param]/~) { let mut disr_val = 0; let mut i = 0; let vi = ty::enum_variants(ecx.tcx, {crate: local_crate, node: id}); for variants.each {|variant| - *index += [{val: variant.node.id, pos: ebml_w.writer.tell()}]; + *index += [{val: variant.node.id, pos: ebml_w.writer.tell()}]/~; ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(variant.node.id)); encode_family(ebml_w, 'v'); @@ -420,20 +421,20 @@ fn encode_visibility(ebml_w: ebml::writer, visibility: visibility) { /* Returns an index of items in this class */ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, id: node_id, path: ast_map::path, - class_tps: [ty_param], - items: [@class_member], - global_index: @mut[entry<int>]) -> [entry<int>] { + class_tps: [ty_param]/~, + items: [@class_member]/~, + global_index: @mut[entry<int>]/~) -> [entry<int>]/~ { /* Each class has its own index, since different classes may have fields with the same name */ - let index = @mut []; + let index = @mut []/~; let tcx = ecx.tcx; for items.each {|ci| /* We encode both private and public fields -- need to include private fields to get the offsets right */ alt ci.node { instance_var(nm, _, mt, id, vis) { - *index += [{val: id, pos: ebml_w.writer.tell()}]; - *global_index += [{val: id, pos: ebml_w.writer.tell()}]; + *index += [{val: id, pos: ebml_w.writer.tell()}]/~; + *global_index += [{val: id, pos: ebml_w.writer.tell()}]/~; ebml_w.start_tag(tag_items_data_item); #debug("encode_info_for_class: doing %s %d", *nm, id); encode_visibility(ebml_w, vis); @@ -447,9 +448,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, class_method(m) { alt m.vis { public { - *index += [{val: m.id, pos: ebml_w.writer.tell()}]; - *global_index += [{val: m.id, pos: ebml_w.writer.tell()}]; - let impl_path = path + [ast_map::path_name(m.ident)]; + *index += [{val: m.id, pos: ebml_w.writer.tell()}]/~; + *global_index += [{val: m.id, pos: ebml_w.writer.tell()}]/~; + let impl_path = path + [ast_map::path_name(m.ident)]/~; #debug("encode_info_for_class: doing %s %d", *m.ident, m.id); encode_info_for_method(ecx, ebml_w, impl_path, should_inline(m.attrs), id, m, @@ -465,7 +466,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer, id: node_id, ident: ident, path: ast_map::path, - item: option<inlined_item>, tps: [ty_param], + item: option<inlined_item>, tps: [ty_param]/~, decl: fn_decl) { ebml_w.start_tag(tag_items_data_item); encode_name(ebml_w, ident); @@ -491,7 +492,7 @@ fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer, fn encode_info_for_method(ecx: @encode_ctxt, ebml_w: ebml::writer, impl_path: ast_map::path, should_inline: bool, parent_id: node_id, - m: @method, all_tps: [ty_param]) { + m: @method, all_tps: [ty_param]/~) { #debug("encode_info_for_method: %d %s %u", m.id, *m.ident, all_tps.len()); ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(m.id)); @@ -520,7 +521,7 @@ fn purity_fn_family(p: purity) -> char { } -fn should_inline(attrs: [attribute]) -> bool { +fn should_inline(attrs: [attribute]/~) -> bool { alt attr::find_inline_attr(attrs) { attr::ia_none { false } attr::ia_hint | attr::ia_always { true } @@ -529,7 +530,7 @@ fn should_inline(attrs: [attribute]) -> bool { fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, - index: @mut [entry<int>], path: ast_map::path) { + index: @mut [entry<int>]/~, path: ast_map::path) { let tcx = ecx.tcx; let must_write = @@ -537,8 +538,8 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, if !must_write && !reachable(ecx, item.id) { ret; } fn add_to_index_(item: @item, ebml_w: ebml::writer, - index: @mut [entry<int>]) { - *index += [{val: item.id, pos: ebml_w.writer.tell()}]; + index: @mut [entry<int>]/~) { + *index += [{val: item.id, pos: ebml_w.writer.tell()}]/~; } let add_to_index = {|copy ebml_w|add_to_index_(item, ebml_w, index)}; @@ -620,7 +621,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, items, index); /* Encode the dtor */ option::iter(m_dtor) {|dtor| - *index += [{val: dtor.node.id, pos: ebml_w.writer.tell()}]; + *index += [{val: dtor.node.id, pos: ebml_w.writer.tell()}]/~; encode_info_for_fn(ecx, ebml_w, dtor.node.id, @(*item.ident + "_dtor"), path, if tps.len() > 0u { some(ii_dtor(dtor, item.ident, tps, @@ -707,9 +708,9 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, encode_path(ebml_w, path, ast_map::path_name(item.ident)); ebml_w.end_tag(); - let impl_path = path + [ast_map::path_name(item.ident)]; + let impl_path = path + [ast_map::path_name(item.ident)]/~; for methods.each {|m| - *index += [{val: m.id, pos: ebml_w.writer.tell()}]; + *index += [{val: m.id, pos: ebml_w.writer.tell()}]/~; encode_info_for_method(ecx, ebml_w, impl_path, should_inline(m.attrs), item.id, m, tps + m.tps); } @@ -741,10 +742,10 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer, nitem: @native_item, - index: @mut [entry<int>], + index: @mut [entry<int>]/~, path: ast_map::path, abi: native_abi) { if !reachable(ecx, nitem.id) { ret; } - *index += [{val: nitem.id, pos: ebml_w.writer.tell()}]; + *index += [{val: nitem.id, pos: ebml_w.writer.tell()}]/~; ebml_w.start_tag(tag_items_data_item); alt nitem.node { @@ -766,12 +767,12 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer, } fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, - crate: @crate) -> [entry<int>] { - let index = @mut []; + crate: @crate) -> [entry<int>]/~ { + let index = @mut []/~; ebml_w.start_tag(tag_items_data); - *index += [{val: crate_node_id, pos: ebml_w.writer.tell()}]; + *index += [{val: crate_node_id, pos: ebml_w.writer.tell()}]/~; encode_info_for_mod(ecx, ebml_w, crate.node.module, - crate_node_id, [], @""); + crate_node_id, []/~, @""); visit::visit_crate(*crate, (), visit::mk_vt(@{ visit_expr: {|_e, _cx, _v|}, visit_item: {|i, cx, v, copy ebml_w| @@ -784,7 +785,8 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, item_class(tps, _, _, ctor, m_dtor, _) { #debug("encoding info for ctor %s %d", *i.ident, ctor.node.id); - *index += [{val: ctor.node.id, pos: ebml_w.writer.tell()}]; + *index += + [{val: ctor.node.id, pos: ebml_w.writer.tell()}]/~; encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident, *pt, if tps.len() > 0u { some(ii_ctor(ctor, i.ident, tps, @@ -813,30 +815,30 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, // Path and definition ID indexing -fn create_index<T: copy>(index: [entry<T>], hash_fn: fn@(T) -> uint) -> - [@[entry<T>]] { - let mut buckets: [@mut [entry<T>]] = []; - for uint::range(0u, 256u) {|_i| buckets += [@mut []]; }; +fn create_index<T: copy>(index: [entry<T>]/~, hash_fn: fn@(T) -> uint) -> + [@[entry<T>]/~]/~ { + let mut buckets: [@mut [entry<T>]/~]/~ = []/~; + for uint::range(0u, 256u) {|_i| buckets += [@mut []/~]/~; }; for index.each {|elt| let h = hash_fn(elt.val); - *buckets[h % 256u] += [elt]; + vec::push(*buckets[h % 256u], elt); } - let mut buckets_frozen = []; + let mut buckets_frozen = []/~; for buckets.each {|bucket| - buckets_frozen += [@*bucket]; + vec::push(buckets_frozen, @*bucket); } ret buckets_frozen; } -fn encode_index<T>(ebml_w: ebml::writer, buckets: [@[entry<T>]], +fn encode_index<T>(ebml_w: ebml::writer, buckets: [@[entry<T>]/~]/~, write_fn: fn(io::writer, T)) { let writer = ebml_w.writer; ebml_w.start_tag(tag_index); - let mut bucket_locs: [uint] = []; + let mut bucket_locs: [uint]/~ = []/~; ebml_w.start_tag(tag_index_buckets); for buckets.each {|bucket| - bucket_locs += [ebml_w.writer.tell()]; + bucket_locs += [ebml_w.writer.tell()]/~; ebml_w.start_tag(tag_index_buckets_bucket); for vec::each(*bucket) {|elt| ebml_w.start_tag(tag_index_buckets_bucket_elt); @@ -896,7 +898,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { } } -fn encode_attributes(ebml_w: ebml::writer, attrs: [attribute]) { +fn encode_attributes(ebml_w: ebml::writer, attrs: [attribute]/~) { ebml_w.start_tag(tag_attributes); for attrs.each {|attr| ebml_w.start_tag(tag_attribute); @@ -910,9 +912,9 @@ fn encode_attributes(ebml_w: ebml::writer, attrs: [attribute]) { // metadata that Rust cares about for linking crates. This attribute requires // 'name' and 'vers' items, so if the user didn't provide them we will throw // them in anyway with default values. -fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { +fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute]/~ { - fn synthesize_link_attr(ecx: @encode_ctxt, items: [@meta_item]) -> + fn synthesize_link_attr(ecx: @encode_ctxt, items: [@meta_item]/~) -> attribute { assert (*ecx.link_meta.name != ""); @@ -929,47 +931,47 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { attr::remove_meta_items_by_name(tmp, @"vers") }; - let meta_items = [name_item, vers_item] + other_items; + let meta_items = [name_item, vers_item]/~ + other_items; let link_item = attr::mk_list_item(@"link", meta_items); ret attr::mk_attr(link_item); } - let mut attrs: [attribute] = []; + let mut attrs: [attribute]/~ = []/~; let mut found_link_attr = false; for crate.node.attrs.each {|attr| attrs += if *attr::get_attr_name(attr) != "link" { - [attr] + [attr]/~ } else { alt attr.node.value.node { meta_list(n, l) { found_link_attr = true;; - [synthesize_link_attr(ecx, l)] + [synthesize_link_attr(ecx, l)]/~ } - _ { [attr] } + _ { [attr]/~ } } }; } - if !found_link_attr { attrs += [synthesize_link_attr(ecx, [])]; } + if !found_link_attr { attrs += [synthesize_link_attr(ecx, []/~)]/~; } ret attrs; } fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { - fn get_ordered_deps(cstore: cstore::cstore) -> [decoder::crate_dep] { + fn get_ordered_deps(cstore: cstore::cstore) -> [decoder::crate_dep]/~ { type hashkv = @{key: crate_num, val: cstore::crate_metadata}; type numdep = decoder::crate_dep; // Pull the cnums and name,vers,hash out of cstore - let mut deps: [mut numdep] = [mut]; + let mut deps: [mut numdep]/~ = [mut]/~; cstore::iter_crate_data(cstore) {|key, val| let dep = {cnum: key, name: @val.name, vers: decoder::get_crate_vers(val.data), hash: decoder::get_crate_hash(val.data)}; - deps += [mut dep]; + deps += [mut dep]/~; }; // Sort by cnum @@ -1018,7 +1020,7 @@ fn encode_hash(ebml_w: ebml::writer, hash: str) { ebml_w.end_tag(); } -fn encode_metadata(parms: encode_parms, crate: @crate) -> [u8] { +fn encode_metadata(parms: encode_parms, crate: @crate) -> [u8]/~ { let ecx: @encode_ctxt = @encode_ctxt({ diag: parms.diag, tcx: parms.tcx, diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs index eeb44f80fd7..c66c02bce9c 100644 --- a/src/rustc/metadata/filesearch.rs +++ b/src/rustc/metadata/filesearch.rs @@ -25,29 +25,29 @@ fn pick_file(file: path, path: path) -> option<path> { iface filesearch { fn sysroot() -> path; - fn lib_search_paths() -> [path]; + fn lib_search_paths() -> [path]/~; fn get_target_lib_path() -> path; fn get_target_lib_file_path(file: path) -> path; } fn mk_filesearch(maybe_sysroot: option<path>, target_triple: str, - addl_lib_search_paths: [path]) -> filesearch { + addl_lib_search_paths: [path]/~) -> filesearch { type filesearch_impl = {sysroot: path, - addl_lib_search_paths: [path], + addl_lib_search_paths: [path]/~, target_triple: str}; impl of filesearch for filesearch_impl { fn sysroot() -> path { self.sysroot } - fn lib_search_paths() -> [path] { + fn lib_search_paths() -> [path]/~ { self.addl_lib_search_paths - + [make_target_lib_path(self.sysroot, self.target_triple)] + + [make_target_lib_path(self.sysroot, self.target_triple)]/~ + alt get_cargo_lib_path_nearest() { - result::ok(p) { [p] } - result::err(p) { [] } + result::ok(p) { [p]/~ } + result::err(p) { []/~ } } + alt get_cargo_lib_path() { - result::ok(p) { [p] } - result::err(p) { [] } + result::ok(p) { [p]/~ } + result::err(p) { []/~ } } } fn get_target_lib_path() -> path { @@ -85,13 +85,13 @@ fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> option<T> { ret rslt; } -fn relative_target_lib_path(target_triple: str) -> [path] { - [libdir(), "rustc", target_triple, libdir()] +fn relative_target_lib_path(target_triple: str) -> [path]/~ { + [libdir(), "rustc", target_triple, libdir()]/~ } fn make_target_lib_path(sysroot: path, target_triple: str) -> path { - let path = [sysroot] + relative_target_lib_path(target_triple); + let path = [sysroot]/~ + relative_target_lib_path(target_triple); let path = path::connect_many(path); ret path; } @@ -113,7 +113,7 @@ fn get_sysroot(maybe_sysroot: option<path>) -> path { } fn get_cargo_sysroot() -> result<path, str> { - let path = [get_default_sysroot(), libdir(), "cargo"]; + let path = [get_default_sysroot(), libdir(), "cargo"]/~; result::ok(path::connect_many(path)) } diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index a5874aa29fa..e7fbdb96d56 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -33,13 +33,13 @@ type ctxt = { filesearch: filesearch, span: span, ident: ast::ident, - metas: [@ast::meta_item], + metas: [@ast::meta_item]/~, hash: str, os: os, static: bool }; -fn load_library_crate(cx: ctxt) -> {ident: str, data: @[u8]} { +fn load_library_crate(cx: ctxt) -> {ident: str, data: @[u8]/~} { alt find_library_crate(cx) { some(t) { ret t; } none { @@ -49,7 +49,7 @@ fn load_library_crate(cx: ctxt) -> {ident: str, data: @[u8]} { } } -fn find_library_crate(cx: ctxt) -> option<{ident: str, data: @[u8]}> { +fn find_library_crate(cx: ctxt) -> option<{ident: str, data: @[u8]/~}> { attr::require_unique_names(cx.diag, cx.metas); find_library_crate_aux(cx, libname(cx), cx.filesearch) } @@ -67,12 +67,12 @@ fn libname(cx: ctxt) -> {prefix: str, suffix: str} { fn find_library_crate_aux(cx: ctxt, nn: {prefix: str, suffix: str}, filesearch: filesearch::filesearch) -> - option<{ident: str, data: @[u8]}> { + option<{ident: str, data: @[u8]/~}> { let crate_name = crate_name_from_metas(cx.metas); let prefix: str = nn.prefix + *crate_name + "-"; let suffix: str = nn.suffix; - let mut matches = []; + let mut matches = []/~; filesearch::search(filesearch, { |path| #debug("inspecting file %s", path); let f: str = path::basename(path); @@ -89,7 +89,7 @@ fn find_library_crate_aux(cx: ctxt, option::none::<()> } else { #debug("found %s with matching metadata", path); - matches += [{ident: path, data: cvec}]; + matches += [{ident: path, data: cvec}]/~; option::none::<()> } } @@ -119,7 +119,7 @@ fn find_library_crate_aux(cx: ctxt, } } -fn crate_name_from_metas(metas: [@ast::meta_item]) -> @str { +fn crate_name_from_metas(metas: [@ast::meta_item]/~) -> @str { let name_items = attr::find_meta_items_by_name(metas, "name"); alt vec::last_opt(name_items) { some(i) { @@ -134,14 +134,14 @@ fn crate_name_from_metas(metas: [@ast::meta_item]) -> @str { } } -fn note_linkage_attrs(diag: span_handler, attrs: [ast::attribute]) { +fn note_linkage_attrs(diag: span_handler, attrs: [ast::attribute]/~) { for attr::find_linkage_attrs(attrs).each {|attr| diag.handler().note(#fmt("meta: %s", pprust::attr_to_str(attr))); } } -fn crate_matches(crate_data: @[u8], metas: [@ast::meta_item], hash: str) -> - bool { +fn crate_matches(crate_data: @[u8]/~, metas: [@ast::meta_item]/~, + hash: str) -> bool { let attrs = decoder::get_crate_attributes(crate_data); let linkage_metas = attr::find_linkage_metas(attrs); if hash.is_not_empty() { @@ -151,8 +151,8 @@ fn crate_matches(crate_data: @[u8], metas: [@ast::meta_item], hash: str) -> metadata_matches(linkage_metas, metas) } -fn metadata_matches(extern_metas: [@ast::meta_item], - local_metas: [@ast::meta_item]) -> bool { +fn metadata_matches(extern_metas: [@ast::meta_item]/~, + local_metas: [@ast::meta_item]/~) -> bool { #debug("matching %u metadata requirements against %u items", vec::len(local_metas), vec::len(extern_metas)); @@ -173,14 +173,14 @@ fn metadata_matches(extern_metas: [@ast::meta_item], } fn get_metadata_section(os: os, - filename: str) -> option<@[u8]> unsafe { + filename: str) -> option<@[u8]/~> unsafe { let mb = str::as_c_str(filename, {|buf| llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) }); - if mb as int == 0 { ret option::none::<@[u8]>; } + if mb as int == 0 { ret option::none::<@[u8]/~>; } let of = alt mk_object_file(mb) { option::some(of) { of } - _ { ret option::none::<@[u8]>; } + _ { ret option::none::<@[u8]/~>; } }; let si = mk_section_iter(of.llof); while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False { @@ -196,7 +196,7 @@ fn get_metadata_section(os: os, } llvm::LLVMMoveToNextSection(si.llsi); } - ret option::none::<@[u8]>; + ret option::none::<@[u8]/~>; } fn meta_section_name(os: os) -> str { diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index 794af5577e7..28eddf2b238 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -17,7 +17,7 @@ export parse_bounds_data; // Callback to translate defs to strs or back: type conv_did = fn(ast::def_id) -> ast::def_id; -type pstate = {data: @[u8], crate: int, mut pos: uint, tcx: ty::ctxt}; +type pstate = {data: @[u8]/~, crate: int, mut pos: uint, tcx: ty::ctxt}; fn peek(st: @pstate) -> char { st.data[st.pos] as char @@ -50,7 +50,7 @@ fn parse_ident_(st: @pstate, is_last: fn@(char) -> bool) -> } -fn parse_ty_data(data: @[u8], crate_num: int, pos: uint, tcx: ty::ctxt, +fn parse_ty_data(data: @[u8]/~, crate_num: int, pos: uint, tcx: ty::ctxt, conv: conv_did) -> ty::t { let st = @{data: data, crate: crate_num, mut pos: pos, tcx: tcx}; parse_ty(st, conv) @@ -65,13 +65,13 @@ fn parse_ret_ty(st: @pstate, conv: conv_did) -> (ast::ret_style, ty::t) { fn parse_constrs_gen<T: copy>(st: @pstate, conv: conv_did, pser: fn(@pstate) - -> ast::constr_arg_general_<T>) -> [@ty::constr_general<T>] { - let mut rslt: [@ty::constr_general<T>] = []; + -> ast::constr_arg_general_<T>) -> [@ty::constr_general<T>]/~ { + let mut rslt: [@ty::constr_general<T>]/~ = []/~; alt peek(st) { ':' { loop { next(st); - rslt += [parse_constr(st, conv, pser)]; + rslt += [parse_constr(st, conv, pser)]/~; if peek(st) != ';' { break; } } } @@ -80,18 +80,18 @@ fn parse_constrs_gen<T: copy>(st: @pstate, conv: conv_did, rslt } -fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr] { +fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr]/~ { parse_constrs_gen(st, conv, parse_constr_arg) } -fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr] { +fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr]/~ { parse_constrs_gen(st, conv, parse_ty_constr_arg) } fn parse_path(st: @pstate) -> @ast::path { - let mut idents: [ast::ident] = []; + let mut idents: [ast::ident]/~ = []/~; fn is_last(c: char) -> bool { ret c == '(' || c == ':'; } - idents += [parse_ident_(st, is_last)]; + idents += [parse_ident_(st, is_last)]/~; loop { alt peek(st) { ':' { next(st); next(st); } @@ -99,8 +99,8 @@ fn parse_path(st: @pstate) -> @ast::path { if c == '(' { ret @{span: ast_util::dummy_sp(), global: false, idents: idents, - rp: none, types: []}; - } else { idents += [parse_ident_(st, is_last)]; } + rp: none, types: []/~}; + } else { idents += [parse_ident_(st, is_last)]/~; } } } }; @@ -124,7 +124,7 @@ fn parse_constr_arg(st: @pstate) -> ast::fn_constr_arg { /* else { auto lit = parse_lit(st, conv, ','); - args += [respan(st.span, ast::carg_lit(lit))]; + args += [respan(st.span, ast::carg_lit(lit))]/~; } */ } @@ -143,7 +143,7 @@ fn parse_constr<T: copy>(st: @pstate, conv: conv_did, -> @ty::constr_general<T> { // FIXME: use real spans and not a bogus one (#2407) let sp = ast_util::dummy_sp(); - let mut args: [@sp_constr_arg<T>] = []; + let mut args: [@sp_constr_arg<T>]/~ = []/~; let pth = parse_path(st); let mut ignore: char = next(st); assert (ignore == '('); @@ -151,7 +151,7 @@ fn parse_constr<T: copy>(st: @pstate, conv: conv_did, let mut an_arg: constr_arg_general_<T>; loop { an_arg = pser(st); - args += [@respan(sp, an_arg)]; + args += [@respan(sp, an_arg)]/~; ignore = next(st); if ignore != ';' { break; } } @@ -197,8 +197,8 @@ fn parse_substs(st: @pstate, conv: conv_did) -> ty::substs { let self_ty = parse_opt(st) {|| parse_ty(st, conv) }; assert next(st) == '['; - let mut params: [ty::t] = []; - while peek(st) != ']' { params += [parse_ty(st, conv)]; } + let mut params: [ty::t]/~ = []/~; + while peek(st) != ']' { params += [parse_ty(st, conv)]/~; } st.pos = st.pos + 1u; ret {self_r: self_r, @@ -320,18 +320,18 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { } 'R' { assert (next(st) == '['); - let mut fields: [ty::field] = []; + let mut fields: [ty::field]/~ = []/~; while peek(st) != ']' { let name = @parse_str(st, '='); - fields += [{ident: name, mt: parse_mt(st, conv)}]; + fields += [{ident: name, mt: parse_mt(st, conv)}]/~; } st.pos = st.pos + 1u; ret ty::mk_rec(st.tcx, fields); } 'T' { assert (next(st) == '['); - let mut params = []; - while peek(st) != ']' { params += [parse_ty(st, conv)]; } + let mut params = []/~; + while peek(st) != ']' { params += [parse_ty(st, conv)]/~; } st.pos = st.pos + 1u; ret ty::mk_tup(st.tcx, params); } @@ -403,8 +403,8 @@ fn parse_mt(st: @pstate, conv: conv_did) -> ty::mt { } fn parse_def(st: @pstate, conv: conv_did) -> ast::def_id { - let mut def = []; - while peek(st) != '|' { def += [next_byte(st)]; } + let mut def = []/~; + while peek(st) != '|' { def += [next_byte(st)]/~; } st.pos = st.pos + 1u; ret conv(parse_def_id(def)); } @@ -446,7 +446,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::fn_ty { let proto = parse_proto(next(st)); let purity = parse_purity(next(st)); assert (next(st) == '['); - let mut inputs: [ty::arg] = []; + let mut inputs: [ty::arg]/~ = []/~; while peek(st) != ']' { let mode = alt check peek(st) { '&' { ast::by_mutbl_ref } @@ -456,7 +456,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::fn_ty { '#' { ast::by_val } }; st.pos += 1u; - inputs += [{mode: ast::expl(mode), ty: parse_ty(st, conv)}]; + inputs += [{mode: ast::expl(mode), ty: parse_ty(st, conv)}]/~; } st.pos += 1u; // eat the ']' let cs = parse_constrs(st, conv); @@ -467,7 +467,7 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::fn_ty { // Rust metadata parsing -fn parse_def_id(buf: [u8]) -> ast::def_id { +fn parse_def_id(buf: [u8]/~) -> ast::def_id { let mut colon_idx = 0u; let len = vec::len(buf); while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; } @@ -491,15 +491,15 @@ fn parse_def_id(buf: [u8]) -> ast::def_id { ret {crate: crate_num, node: def_num}; } -fn parse_bounds_data(data: @[u8], start: uint, +fn parse_bounds_data(data: @[u8]/~, start: uint, crate_num: int, tcx: ty::ctxt, conv: conv_did) - -> @[ty::param_bound] { + -> @[ty::param_bound]/~ { let st = @{data: data, crate: crate_num, mut pos: start, tcx: tcx}; parse_bounds(st, conv) } -fn parse_bounds(st: @pstate, conv: conv_did) -> @[ty::param_bound] { - let mut bounds = []; +fn parse_bounds(st: @pstate, conv: conv_did) -> @[ty::param_bound]/~ { + let mut bounds = []/~; loop { bounds += [alt check next(st) { 'S' { ty::bound_send } @@ -507,7 +507,7 @@ fn parse_bounds(st: @pstate, conv: conv_did) -> @[ty::param_bound] { 'K' { ty::bound_const } 'I' { ty::bound_iface(parse_ty(st, conv)) } '.' { break; } - }]; + }]/~; } @bounds } diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index dc1cbac434b..3f7c6ee648c 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -395,7 +395,7 @@ fn enc_ty_constr(w: io::writer, cx: @ctxt, c: @ty::type_constr) { }); } -fn enc_bounds(w: io::writer, cx: @ctxt, bs: @[ty::param_bound]) { +fn enc_bounds(w: io::writer, cx: @ctxt, bs: @[ty::param_bound]/~) { for vec::each(*bs) {|bound| alt bound { ty::bound_send { w.write_char('S'); } |
