Skip to content

Commit 4e3d4b3

Browse files
committed
libsyntax: Stop parsing mutable fields
1 parent 481d4ca commit 4e3d4b3

File tree

6 files changed

+6
-15
lines changed

6 files changed

+6
-15
lines changed

src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ pub fn classify(e: @expr,
118118

119119
ast::expr_struct(_, ref fs, None) => {
120120
let cs = do vec::map((*fs)) |f| {
121-
if f.node.mutbl == ast::m_imm {
122-
classify(f.node.expr, tcx)
123-
} else {
124-
non_const
125-
}
121+
classify(f.node.expr, tcx)
126122
};
127123
join_all(cs)
128124
}

src/libsyntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ pub struct arm {
425425

426426
#[deriving(Eq, Encodable, Decodable)]
427427
pub struct field_ {
428-
mutbl: mutability,
429428
ident: ident,
430429
expr: @expr,
431430
}

src/libsyntax/ext/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl AstBuilder for @ExtCtxt {
486486
self.expr(b.span, ast::expr_block(b))
487487
}
488488
fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field {
489-
respan(span, ast::field_ { mutbl: ast::m_imm, ident: name, expr: e })
489+
respan(span, ast::field_ { ident: name, expr: e })
490490
}
491491
fn expr_struct(&self, span: span, path: @ast::Path, fields: ~[ast::field]) -> @ast::expr {
492492
self.expr(span, ast::expr_struct(path, fields, None))

src/libsyntax/fold.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
433433
fn fold_field_(field: field, fld: @ast_fold) -> field {
434434
spanned {
435435
node: ast::field_ {
436-
mutbl: field.node.mutbl,
437436
ident: fld.fold_ident(field.node.ident),
438437
expr: fld.fold_expr(field.node.expr),
439438
},

src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,11 +1157,13 @@ pub impl Parser {
11571157
// parse ident COLON expr
11581158
fn parse_field(&self) -> field {
11591159
let lo = self.span.lo;
1160-
let m = self.parse_mutability();
11611160
let i = self.parse_ident();
11621161
self.expect(&token::COLON);
11631162
let e = self.parse_expr();
1164-
spanned(lo, e.span.hi, ast::field_ { mutbl: m, ident: i, expr: e })
1163+
spanned(lo, e.span.hi, ast::field_ {
1164+
ident: i,
1165+
expr: e
1166+
})
11651167
}
11661168

11671169
fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
@@ -2566,10 +2568,6 @@ pub impl Parser {
25662568
pr: visibility,
25672569
attrs: ~[attribute]) -> @struct_field {
25682570
let lo = self.span.lo;
2569-
if self.eat_keyword(keywords::Mut) {
2570-
// Do nothing, for backwards compatibility.
2571-
// XXX: Remove after snapshot.
2572-
}
25732571
if !is_plain_ident(&*self.token) {
25742572
self.fatal("expected ident");
25752573
}

src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,6 @@ pub fn print_call_post(s: @ps,
10831083
pub fn print_expr(s: @ps, expr: @ast::expr) {
10841084
fn print_field(s: @ps, field: ast::field) {
10851085
ibox(s, indent_unit);
1086-
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mut"); }
10871086
print_ident(s, field.node.ident);
10881087
word_space(s, ":");
10891088
print_expr(s, field.node.expr);

0 commit comments

Comments
 (0)