about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-05 18:38:51 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-05 18:38:51 -0800
commitbb5e16b4b869f0c585c21db110e51165865e8833 (patch)
tree5ad6a32f888d7036f31f88928f982986467a55bb /src/libsyntax/parse/parser.rs
parent0ca3a8cca718d6715a73fd0931cda3135d68ebd1 (diff)
parentbf6c007760169e9c382d3700fd1cdd20037e4343 (diff)
downloadrust-bb5e16b4b869f0c585c21db110e51165865e8833.tar.gz
rust-bb5e16b4b869f0c585c21db110e51165865e8833.zip
rollup merge of #20554: huonw/mut-pattern
Conflicts:
	src/librustc_typeck/check/_match.rs
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8e4a385923a..9b3df744317 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3351,11 +3351,16 @@ impl<'a> Parser<'a> {
             })
           }
           token::BinOp(token::And) | token::AndAnd => {
-            // parse &pat
+            // parse &pat and &mut pat
             let lo = self.span.lo;
             self.expect_and();
+            let mutability = if self.eat_keyword(keywords::Mut) {
+                ast::MutMutable
+            } else {
+                ast::MutImmutable
+            };
             let sub = self.parse_pat();
-            pat = PatRegion(sub);
+            pat = PatRegion(sub, mutability);
             hi = self.last_span.hi;
             return P(ast::Pat {
                 id: ast::DUMMY_NODE_ID,