summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-26 00:39:50 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-26 00:39:50 -0700
commit26e1cacb216fc754650a58b22bbbd91ab945089d (patch)
tree053ecbf8acc9893baff25c3a1fa33c93b3f30ba2 /src/comp
parentb099760269ecf7920eed99919ff6bdbd341ecf95 (diff)
downloadrust-26e1cacb216fc754650a58b22bbbd91ab945089d.tar.gz
rust-26e1cacb216fc754650a58b22bbbd91ab945089d.zip
Let typestate constraints mention pattern-bound vars
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/tstate/auxiliary.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs
index 6aab9e5aed4..03d31c67369 100644
--- a/src/comp/middle/tstate/auxiliary.rs
+++ b/src/comp/middle/tstate/auxiliary.rs
@@ -621,9 +621,18 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: &@expr) -> @constr_arg_use {
                         carg_ident({ident: p.node.idents[0],
                                     node: a_id.node}));
           }
-          _ {
+          some (def_binding(b_id)) {
+            ret @respan(p.span,
+                        carg_ident({ident: p.node.idents[0],
+                                    node: b_id.node}));
+           }
+          some(_) {
             tcx.sess.bug("exprs_to_constr_args: non-local variable " +
                              "as pred arg");
+          }
+          none {
+            tcx.sess.bug("exprs_to_constr_args: NONE " +
+                             "as pred arg");
 
           }
         }
@@ -646,10 +655,6 @@ fn exprs_to_constr_args(tcx: ty::ctxt, args: &[@expr]) -> [@constr_arg_use] {
 
 fn expr_to_constr(tcx: ty::ctxt, e: &@expr) -> sp_constr {
     alt e.node {
-
-
-      // FIXME change the first pattern to expr_path to test a
-      // typechecker bug
       expr_call(operator, args) {
         alt operator.node {
           expr_path(p) {