about summary refs log tree commit diff
path: root/src/comp/syntax/parse/parser.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-11-16 13:52:08 -0800
committerBrian Anderson <banderson@mozilla.com>2011-11-16 13:52:08 -0800
commit045a4375561f80cc30ff15780fecc39a93c44a5b (patch)
tree246f3194dde17df9fcab5f6a4ab0c8acdde49673 /src/comp/syntax/parse/parser.rs
parentf157d0b32c853250a902549b11dbd481465b8f45 (diff)
downloadrust-045a4375561f80cc30ff15780fecc39a93c44a5b.tar.gz
rust-045a4375561f80cc30ff15780fecc39a93c44a5b.zip
rustc: Accept 'const' as synonym for 'mutable?'
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
-rw-r--r--src/comp/syntax/parse/parser.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 05f508edfd0..4e393777d2a 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -746,10 +746,13 @@ fn parse_path_and_ty_param_substs(p: parser) -> ast::path {
 
 fn parse_mutability(p: parser) -> ast::mutability {
     if eat_word(p, "mutable") {
-        if p.peek() == token::QUES { p.bump(); ret ast::maybe_mut; }
-        ret ast::mut;
+        if p.peek() == token::QUES { p.bump(); ast::maybe_mut }
+        else { ast::mut }
+    } else if eat_word(p, "const") {
+        ast::maybe_mut
+    } else {
+        ast::imm
     }
-    ret ast::imm;
 }
 
 fn parse_field(p: parser, sep: token::token) -> ast::field {