about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorEric Holk <eric.holk@gmail.com>2012-07-17 12:51:24 -0700
committerEric Holk <eric.holk@gmail.com>2012-07-17 17:46:31 -0700
commitee855caa5df4a9224aaf7b4ab5f644d3ef071f1b (patch)
treeca59a5f57fa16f2ebb55fd0ac60ea445001ee393 /src/libsyntax
parent4cf6b4d3b4ea5cd231ab96d82f5f8cd794e0b2c3 (diff)
downloadrust-ee855caa5df4a9224aaf7b4ab5f644d3ef071f1b.tar.gz
rust-ee855caa5df4a9224aaf7b4ab5f644d3ef071f1b.zip
Don't ICE when protocol steps to invalid mesasge.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/pipes/check.rs43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index 7cf96707bca..492cb255805 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -44,28 +44,29 @@ impl proto_check of proto::visitor<(), (), ()>  for ext_ctxt {
 
     fn visit_message(name: ident, _tys: &[@ast::ty],
                      this: state, next: next_state) {
-         alt next {
-           some({state: next, tys: next_tys}) {
-             let proto = this.proto;
-             if !proto.has_state(next) {
-                 // This should be a span fatal, but then we need to
-                 // track span information.
-                 self.span_err(
-                     empty_span(),
-                     #fmt("message %s steps to undefined state, %s",
-                          *name, *next));
-            }
-
-            let next = proto.get_state(next);
-
-            if next.ty_params.len() != next_tys.len() {
+        alt next {
+          some({state: next, tys: next_tys}) {
+            let proto = this.proto;
+            if !proto.has_state(next) {
+                // This should be a span fatal, but then we need to
+                // track span information.
                 self.span_err(
-                    empty_span(), // use a real span
-                    #fmt("message %s target (%s) \
-                          needs %u type parameters, but got %u",
-                         *name, *next.name,
-                         next.ty_params.len(),
-                         next_tys.len()));
+                    empty_span(),
+                    #fmt("message %s steps to undefined state, %s",
+                         *name, *next));
+            }
+            else {
+                let next = proto.get_state(next);
+
+                if next.ty_params.len() != next_tys.len() {
+                    self.span_err(
+                        empty_span(), // use a real span
+                        #fmt("message %s target (%s) \
+                              needs %u type parameters, but got %u",
+                             *name, *next.name,
+                             next.ty_params.len(),
+                             next_tys.len()));
+                }
             }
           }
           none { }