commit | 8d4d2fa5cd291625fdd3394e5de4c94c8b2c7f89 | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Tue Oct 25 22:08:07 2016 -0700 |
committer | David Tolnay <dtolnay@gmail.com> | Tue Oct 25 22:08:07 2016 -0700 |
tree | d00091038309f9c6d3266105b4de644ddf727fda | |
parent | e4606333ac8d04f280ee5033fbd9286267ede735 [diff] [blame] |
Allow using self as a pattern in fn args
diff --git a/src/expr.rs b/src/expr.rs index 3074b99..8ebb28b 100644 --- a/src/expr.rs +++ b/src/expr.rs
@@ -905,7 +905,11 @@ named!(pat_ident -> Pat, do_parse!( mode: option!(keyword!("ref")) >> mutability: mutability >> - name: ident >> + name: alt!( + ident + | + keyword!("self") => { Into::into } + ) >> not!(peek!(punct!("<"))) >> not!(peek!(punct!("::"))) >> subpat: option!(preceded!(punct!("@"), pat)) >>