diff options
Diffstat (limited to 'src/libregex/parse.rs')
| -rw-r--r-- | src/libregex/parse.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index 55e533aadee..ccbd53c4f2a 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -838,8 +838,9 @@ impl<'a> Parser<'a> { // Otherwise, an error will be returned. // Generally, `allow_start` is only true when you're *not* expecting an // opening parenthesis. - fn pos_last(&self, allow_start: bool, pred: |&BuildAst| -> bool) - -> Result<uint, Error> { + fn pos_last<P>(&self, allow_start: bool, pred: P) -> Result<uint, Error> where + P: FnMut(&BuildAst) -> bool, + { let from = match self.stack.iter().rev().position(pred) { Some(i) => i, None => { @@ -887,8 +888,9 @@ impl<'a> Parser<'a> { // build_from combines all AST elements starting at 'from' in the // parser's stack using 'mk' to combine them. If any such element is not an // AST then it is popped off the stack and ignored. - fn build_from(&mut self, from: uint, mk: |Ast, Ast| -> Ast) - -> Result<Ast, Error> { + fn build_from<F>(&mut self, from: uint, mut mk: F) -> Result<Ast, Error> where + F: FnMut(Ast, Ast) -> Ast, + { if from >= self.stack.len() { return self.err("Empty group or alternate not allowed.") } |
