diff options
| author | Eric Holk <eric.holk@gmail.com> | 2012-07-17 12:51:24 -0700 |
|---|---|---|
| committer | Eric Holk <eric.holk@gmail.com> | 2012-07-17 17:46:31 -0700 |
| commit | ee855caa5df4a9224aaf7b4ab5f644d3ef071f1b (patch) | |
| tree | ca59a5f57fa16f2ebb55fd0ac60ea445001ee393 /src/libsyntax | |
| parent | 4cf6b4d3b4ea5cd231ab96d82f5f8cd794e0b2c3 (diff) | |
| download | rust-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.rs | 43 |
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 { } |
