From 045a4375561f80cc30ff15780fecc39a93c44a5b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 16 Nov 2011 13:52:08 -0800 Subject: rustc: Accept 'const' as synonym for 'mutable?' --- src/comp/syntax/parse/parser.rs | 9 ++++++--- src/comp/syntax/print/pprust.rs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/comp/syntax') 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 { diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 93a4293a5d1..e2d829f5217 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -264,7 +264,7 @@ fn print_type(s: ps, &&ty: @ast::ty) { word(s.s, "["); alt mt.mut { ast::mut. { word_space(s, "mutable"); } - ast::maybe_mut. { word_space(s, "mutable?"); } + ast::maybe_mut. { word_space(s, "const"); } ast::imm. { } } print_type(s, mt.ty); -- cgit 1.4.1-3-g733a5