about summary refs log tree commit diff
path: root/src/comp/metadata/decoder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/metadata/decoder.rs')
-rw-r--r--src/comp/metadata/decoder.rs60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs
index 7803e6922a1..cd241f3931e 100644
--- a/src/comp/metadata/decoder.rs
+++ b/src/comp/metadata/decoder.rs
@@ -34,9 +34,9 @@ export external_resolver;
 // def_id for an item defined in another crate, somebody needs to figure out
 // what crate that's in and give us a def_id that makes sense for the current
 // build.
-type external_resolver = fn(&ast::def_id) -> ast::def_id;
+type external_resolver = fn(ast::def_id) -> ast::def_id;
 
-fn lookup_hash(d: &ebml::doc, eq_fn: fn(&[u8]) -> bool, hash: uint) ->
+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);
@@ -56,8 +56,8 @@ fn lookup_hash(d: &ebml::doc, eq_fn: fn(&[u8]) -> bool, hash: uint) ->
     ret result;
 }
 
-fn maybe_find_item(item_id: int, items: &ebml::doc) -> option::t<ebml::doc> {
-    fn eq_item(bytes: &[u8], item_id: int) -> bool {
+fn maybe_find_item(item_id: int, items: ebml::doc) -> option::t<ebml::doc> {
+    fn eq_item(bytes: [u8], item_id: int) -> bool {
         ret ebml::be_uint_from_bytes(@bytes, 0u, 4u) as int == item_id;
     }
     let eqer = bind eq_item(_, item_id);
@@ -67,36 +67,36 @@ fn maybe_find_item(item_id: int, items: &ebml::doc) -> option::t<ebml::doc> {
     } else { ret option::some::<ebml::doc>(found[0]); }
 }
 
-fn find_item(item_id: int, items: &ebml::doc) -> ebml::doc {
+fn find_item(item_id: int, items: ebml::doc) -> ebml::doc {
     ret option::get(maybe_find_item(item_id, items));
 }
 
 // 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::new_doc(data), tag_items);
     ret find_item(item_id, items);
 }
 
-fn item_family(item: &ebml::doc) -> u8 {
+fn item_family(item: ebml::doc) -> u8 {
     let fam = ebml::get_doc(item, tag_items_data_item_family);
     ret ebml::doc_as_uint(fam) as u8;
 }
 
-fn item_symbol(item: &ebml::doc) -> str {
+fn item_symbol(item: ebml::doc) -> str {
     let sym = ebml::get_doc(item, tag_items_data_item_symbol);
     ret str::unsafe_from_bytes(ebml::doc_data(sym));
 }
 
-fn variant_tag_id(d: &ebml::doc) -> ast::def_id {
+fn variant_tag_id(d: ebml::doc) -> ast::def_id {
     let tagdoc = ebml::get_doc(d, tag_items_data_item_tag_id);
     ret parse_def_id(ebml::doc_data(tagdoc));
 }
 
-fn item_type(item: &ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt,
-             extres: &external_resolver) -> ty::t {
+fn item_type(item: ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt,
+             extres: external_resolver) -> ty::t {
     fn parse_external_def_id(this_cnum: ast::crate_num,
-                             extres: &external_resolver, s: &str) ->
+                             extres: external_resolver, s: str) ->
        ast::def_id {
         let buf = str::bytes(s);
         let external_def_id = parse_def_id(buf);
@@ -114,7 +114,7 @@ fn item_type(item: &ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt,
                       def_parser, tcx);
 }
 
-fn item_ty_param_kinds(item: &ebml::doc) -> [ast::kind] {
+fn item_ty_param_kinds(item: ebml::doc) -> [ast::kind] {
     let ks: [ast::kind] = [];
     let tp = tag_items_data_item_ty_param_kinds;
     for each p: ebml::doc in ebml::tagged_docs(item, tp) {
@@ -135,7 +135,7 @@ fn item_ty_param_kinds(item: &ebml::doc) -> [ast::kind] {
     ret ks;
 }
 
-fn tag_variant_ids(item: &ebml::doc, this_cnum: ast::crate_num) ->
+fn tag_variant_ids(item: ebml::doc, this_cnum: ast::crate_num) ->
    [ast::def_id] {
     let ids: [ast::def_id] = [];
     let v = tag_items_data_item_variant;
@@ -148,8 +148,8 @@ fn tag_variant_ids(item: &ebml::doc, this_cnum: ast::crate_num) ->
 
 // Given a path and serialized crate metadata, returns the ID of the
 // definition the path refers 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::unsafe_from_bytes(data), s);
     }
     let s = str::connect(path, "::");
@@ -165,14 +165,14 @@ fn resolve_path(path: &[ast::ident], data: @[u8]) -> [ast::def_id] {
 }
 
 // Crate metadata queries
-fn lookup_defs(data: &@[u8], cnum: ast::crate_num, path: &[ast::ident]) ->
+fn lookup_defs(data: @[u8], cnum: ast::crate_num, path: [ast::ident]) ->
    [ast::def] {
     ret vec::map(bind lookup_def(cnum, data, _), resolve_path(path, data));
 }
 
 
 // FIXME doesn't yet handle re-exported externals
-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);
@@ -198,8 +198,8 @@ fn lookup_def(cnum: ast::crate_num, data: @[u8], did_: &ast::def_id) ->
     ret def;
 }
 
-fn get_type(data: @[u8], def: ast::def_id, tcx: &ty::ctxt,
-            extres: &external_resolver) -> ty::ty_param_kinds_and_ty {
+fn get_type(data: @[u8], def: ast::def_id, tcx: ty::ctxt,
+            extres: external_resolver) -> ty::ty_param_kinds_and_ty {
     let this_cnum = def.crate;
     let node_id = def.node;
     let item = lookup_item(node_id, data);
@@ -225,8 +225,8 @@ fn get_symbol(data: @[u8], id: ast::node_id) -> str {
     ret item_symbol(lookup_item(id, data));
 }
 
-fn get_tag_variants(_data: &@[u8], def: ast::def_id, tcx: &ty::ctxt,
-                    extres: &external_resolver) -> [ty::variant_info] {
+fn get_tag_variants(_data: @[u8], def: ast::def_id, tcx: ty::ctxt,
+                    extres: external_resolver) -> [ty::variant_info] {
     let external_crate_id = def.crate;
     let data =
         cstore::get_crate_data(tcx.sess.get_cstore(), external_crate_id).data;
@@ -267,7 +267,7 @@ fn family_has_type_params(fam_ch: u8) -> bool {
         };
 }
 
-fn read_path(d: &ebml::doc) -> {path: str, pos: uint} {
+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));
@@ -275,7 +275,7 @@ fn read_path(d: &ebml::doc) -> {path: str, pos: uint} {
     ret {path: path, pos: pos};
 }
 
-fn describe_def(items: &ebml::doc, id: ast::def_id) -> str {
+fn describe_def(items: ebml::doc, id: ast::def_id) -> str {
     if id.crate != ast::local_crate { ret "external"; }
     ret item_family_to_str(item_family(find_item(id.node, items)));
 }
@@ -295,7 +295,7 @@ fn item_family_to_str(fam: u8) -> str {
     }
 }
 
-fn get_meta_items(md: &ebml::doc) -> [@ast::meta_item] {
+fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] {
     let items: [@ast::meta_item] = [];
     for each meta_item_doc: ebml::doc in
              ebml::tagged_docs(md, tag_meta_item_word) {
@@ -323,7 +323,7 @@ fn get_meta_items(md: &ebml::doc) -> [@ast::meta_item] {
     ret items;
 }
 
-fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
+fn get_attributes(md: ebml::doc) -> [ast::attribute] {
     let attrs: [ast::attribute] = [];
     alt ebml::maybe_get_doc(md, tag_attributes) {
       option::some(attrs_d) {
@@ -344,13 +344,13 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
     ret attrs;
 }
 
-fn list_meta_items(meta_items: &ebml::doc, out: io::writer) {
+fn list_meta_items(meta_items: ebml::doc, out: io::writer) {
     for mi: @ast::meta_item in get_meta_items(meta_items) {
         out.write_str(#fmt["%s\n", pprust::meta_item_to_str(*mi)]);
     }
 }
 
-fn list_crate_attributes(md: &ebml::doc, out: io::writer) {
+fn list_crate_attributes(md: ebml::doc, out: io::writer) {
     out.write_str("=Crate Attributes=\n");
 
     for attr: ast::attribute in get_attributes(md) {
@@ -389,7 +389,7 @@ fn list_crate_deps(data: @[u8], out: io::writer) {
     out.write_str("\n");
 }
 
-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 paths = ebml::get_doc(md, tag_paths);
     let items = ebml::get_doc(md, tag_items);
@@ -410,7 +410,7 @@ fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
     out.write_str("\n");
 }
 
-fn list_crate_metadata(bytes: &@[u8], out: io::writer) {
+fn list_crate_metadata(bytes: @[u8], out: io::writer) {
     let md = ebml::new_doc(bytes);
     list_crate_attributes(md, out);
     list_crate_deps(bytes, out);