]> git.lizzy.rs Git - rust.git/commit
libsyntax: better error for lifetimes in patterns
authorKevin Butler <haqkrs@gmail.com>
Sat, 24 Oct 2015 23:57:42 +0000 (00:57 +0100)
committerKevin Butler <haqkrs@gmail.com>
Sun, 25 Oct 2015 00:28:00 +0000 (01:28 +0100)
commit64da379c8c6c967a451817dc4909eeb0055351e7
tree0831e691f21f07c6aabb647e9e954f6012ee0493
parent04e497c0056aed899cd6edbc98e7a68a9b391c5c
libsyntax: better error for lifetimes in patterns

Previously, if you copied a signature from a trait definition such as:

```
fn foo<'a>(&'a Bar) -> bool {}
```

and moved it into an `impl`, there would be an error message:

"unexpected token `'a`"

Adding to the error message that a pattern is expected should help
users to find the actual problem with using a lifetime here.
src/libsyntax/parse/parser.rs
src/test/parse-fail/lifetime-in-pattern.rs [new file with mode: 0644]