summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-07-17 16:49:54 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-07-17 16:49:54 -0700
commitb71a8827e3a17720508b7edebdc2c13358179e59 (patch)
tree0518d4c11018edca289dec634925979eb538d553 /src/libsyntax
parentdb020ab63cd51dd4a25cba2d00117f016128762b (diff)
downloadrust-b71a8827e3a17720508b7edebdc2c13358179e59.tar.gz
rust-b71a8827e3a17720508b7edebdc2c13358179e59.zip
rustc: Fix coherence errors in the build
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs46
-rw-r--r--src/libsyntax/ext/pipes/proto.rs5
3 files changed, 26 insertions, 27 deletions
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 58f42152437..eb92be1149d 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -202,7 +202,7 @@ impl ast_builder of ext_ctxt_ast_builder for ext_ctxt {
           span: empty_span()}
     }
 
-    fn ty_nil() -> @ast::ty {
+    fn ty_nil_ast_builder() -> @ast::ty {
         @{id: self.next_id(),
           node: ast::ty_nil,
           span: empty_span()}
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index eab2c58e50e..c6b1a2d6932 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -22,7 +22,21 @@ import ast_builder::ast_builder;
 import ast_builder::methods;
 import ast_builder::path;
 
-impl compile for message {
+trait gen_send {
+    fn gen_send(cx: ext_ctxt) -> @ast::item;
+}
+
+trait to_type_decls {
+    fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item];
+    fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item];
+}
+
+trait gen_init {
+    fn gen_init(cx: ext_ctxt) -> @ast::item;
+    fn compile(cx: ext_ctxt) -> @ast::item;
+}
+
+impl compile of gen_send for message {
     fn gen_send(cx: ext_ctxt) -> @ast::item {
         #debug("pipec: gen_send");
         alt self {
@@ -80,7 +94,7 @@ impl compile for message {
 
             let args_ast = vec::append(
                 ~[cx.arg_mode(@~"pipe",
-                              cx.ty_path(path(this.data_name())
+                              cx.ty_path_ast_builder(path(this.data_name())
                                         .add_tys(cx.ty_vars(this.ty_params))),
                               ast::by_copy)],
                 args_ast);
@@ -104,7 +118,7 @@ impl compile for message {
 
             cx.item_fn_poly(self.name(),
                             args_ast,
-                            cx.ty_nil(),
+                            cx.ty_nil_ast_builder(),
                             self.get_params(),
                             cx.expr_block(body))
           }
@@ -112,12 +126,12 @@ impl compile for message {
     }
 
     fn to_ty(cx: ext_ctxt) -> @ast::ty {
-        cx.ty_path_ast_builder(path(self.name)
-          .add_tys(cx.ty_vars(self.ty_params)))
+        cx.ty_path_ast_builder(path(self.name())
+          .add_tys(cx.ty_vars(self.get_params())))
     }
 }
 
-impl compile for state {
+impl compile of to_type_decls for state {
     fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
         #debug("pipec: to_type_decls");
         // This compiles into two different type declarations. Say the
@@ -144,7 +158,7 @@ impl compile for state {
                 };
 
                 vec::append_one(tys,
-                                cx.ty_path((dir + next_name)
+                                cx.ty_path_ast_builder((dir + next_name)
                                            .add_tys(next_tys)))
               }
               none { tys }
@@ -184,7 +198,7 @@ impl compile for state {
     }
 }
 
-impl compile for protocol {
+impl compile of gen_init for protocol {
     fn gen_init(cx: ext_ctxt) -> @ast::item {
         let start_state = self.states[0];
 
@@ -303,19 +317,3 @@ impl parse_utils of ext_ctxt_parse_utils for ext_ctxt {
     }
 }
 
-trait two_vector_utils<A, B> {
-    fn zip() -> ~[(A, B)];
-    fn map<C>(f: fn(A, B) -> C) -> ~[C];
-}
-
-impl methods<A: copy, B: copy> of two_vector_utils<A, B> for (~[A], ~[B]) {
-    fn zip() -> ~[(A, B)] {
-        let (a, b) = self;
-        vec::zip(a, b)
-    }
-
-    fn map<C>(f: fn(A, B) -> C) -> ~[C] {
-        let (a, b) = self;
-        vec::map2(a, b, f)
-    }
-}
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 1df3466286c..1c88732adb0 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -3,7 +3,7 @@ import dvec::{dvec, extensions};
 
 import ast::{ident};
 
-import ast_builder::{path, methods, ast_builder};
+import ast_builder::{path, methods, ast_builder, append_types};
 
 enum direction {
     send, recv
@@ -78,7 +78,8 @@ impl methods for state {
     }
 
     fn to_ty(cx: ext_ctxt) -> @ast::ty {
-        cx.ty_path(path(self.name).add_tys(cx.ty_vars(self.ty_params)))
+        cx.ty_path_ast_builder
+            (path(self.name).add_tys(cx.ty_vars(self.ty_params)))
     }
 }