about summary refs log tree commit diff
path: root/src/rustc/middle/astencode.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-07-27 19:32:42 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-07-27 19:35:24 -0700
commit93c2f5e0e43532a2288ed6dec378564264d1a77c (patch)
tree2d8d3f5d4667f7a009fa338bc34076216873b35c /src/rustc/middle/astencode.rs
parente6d2e49852873c52b872185a0ae5a8ca941ed2f1 (diff)
downloadrust-93c2f5e0e43532a2288ed6dec378564264d1a77c.tar.gz
rust-93c2f5e0e43532a2288ed6dec378564264d1a77c.zip
rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
Diffstat (limited to 'src/rustc/middle/astencode.rs')
-rw-r--r--src/rustc/middle/astencode.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs
index d47598cd8cb..84ada7726ab 100644
--- a/src/rustc/middle/astencode.rs
+++ b/src/rustc/middle/astencode.rs
@@ -13,6 +13,8 @@ import std::ebml;
 import std::ebml::writer;
 import std::ebml::serializer;
 import std::ebml::deserializer;
+import std::ebml::extensions;
+import std::ebml::get_doc;
 import std::map::hashmap;
 import std::serialization::serializer;
 import std::serialization::deserializer;
@@ -285,7 +287,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
 }
 
 fn decode_ast(par_doc: ebml::doc) -> ast::inlined_item {
-    let chi_doc = par_doc[c::tag_tree];
+    let chi_doc = par_doc[c::tag_tree as uint];
     let d = ebml::ebml_deserializer(chi_doc);
     ast::deserialize_inlined_item(d)
 }
@@ -776,15 +778,11 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
 
 trait doc_decoder_helpers {
     fn as_int() -> int;
-    fn [](tag: c::astencode_tag) -> ebml::doc;
     fn opt_child(tag: c::astencode_tag) -> option<ebml::doc>;
 }
 
 impl decoder of doc_decoder_helpers for ebml::doc {
     fn as_int() -> int { ebml::doc_as_u64(self) as int }
-    fn [](tag: c::astencode_tag) -> ebml::doc {
-        ebml::get_doc(self, tag as uint)
-    }
     fn opt_child(tag: c::astencode_tag) -> option<ebml::doc> {
         ebml::maybe_get_doc(self, tag as uint)
     }
@@ -843,9 +841,9 @@ impl decoder of ebml_deserializer_decoder_helpers
 fn decode_side_tables(xcx: extended_decode_ctxt,
                       ast_doc: ebml::doc) {
     let dcx = xcx.dcx;
-    let tbl_doc = ast_doc[c::tag_table];
+    let tbl_doc = ast_doc[c::tag_table as uint];
     for ebml::docs(tbl_doc) |tag, entry_doc| {
-        let id0 = entry_doc[c::tag_table_id].as_int();
+        let id0 = entry_doc[c::tag_table_id as uint].as_int();
         let id = xcx.tr_id(id0);
 
         #debug[">> Side table document with tag 0x%x \
@@ -855,7 +853,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
         if tag == (c::tag_table_mutbl as uint) {
             dcx.maps.mutbl_map.insert(id, ());
         } else {
-            let val_doc = entry_doc[c::tag_table_val];
+            let val_doc = entry_doc[c::tag_table_val as uint];
             let val_dsr = ebml::ebml_deserializer(val_doc);
             if tag == (c::tag_table_def as uint) {
                 let def = decode_def(xcx, val_doc);
@@ -916,7 +914,7 @@ fn encode_item_ast(ebml_w: ebml::writer, item: @ast::item) {
 
 #[cfg(test)]
 fn decode_item_ast(par_doc: ebml::doc) -> @ast::item {
-    let chi_doc = par_doc[c::tag_tree];
+    let chi_doc = par_doc[c::tag_tree as uint];
     let d = ebml::ebml_deserializer(chi_doc);
     @ast::deserialize_item(d)
 }