Skip to content

Commit 7c48e53

Browse files
eddybalexcrichton
authored andcommitted
syntax: remove obsolete mutability from ExprVec and ExprRepeat.
1 parent b236f45 commit 7c48e53

File tree

19 files changed

+54
-67
lines changed

19 files changed

+54
-67
lines changed

src/librustc/front/test.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,21 +404,17 @@ fn is_test_crate(krate: &ast::Crate) -> bool {
404404
}
405405

406406
fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
407-
let mut descs = Vec::new();
408407
debug!("building test vector from {} tests", cx.testfns.borrow().len());
409-
for test in cx.testfns.borrow().iter() {
410-
descs.push(mk_test_desc_and_fn_rec(cx, test));
411-
}
412-
413-
let inner_expr = @ast::Expr {
414-
id: ast::DUMMY_NODE_ID,
415-
node: ast::ExprVec(descs, ast::MutImmutable),
416-
span: DUMMY_SP,
417-
};
418408

419409
@ast::Expr {
420410
id: ast::DUMMY_NODE_ID,
421-
node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
411+
node: ast::ExprVstore(@ast::Expr {
412+
id: ast::DUMMY_NODE_ID,
413+
node: ast::ExprVec(cx.testfns.borrow().iter().map(|test| {
414+
mk_test_desc_and_fn_rec(cx, test)
415+
}).collect()),
416+
span: DUMMY_SP,
417+
}, ast::ExprVstoreSlice),
422418
span: DUMMY_SP,
423419
}
424420
}

src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'a> CFGBuilder<'a> {
347347
self.add_node(expr.id, [])
348348
}
349349

350-
ast::ExprVec(ref elems, _) => {
350+
ast::ExprVec(ref elems) => {
351351
self.straightline(expr, pred, elems.as_slice())
352352
}
353353

@@ -379,7 +379,7 @@ impl<'a> CFGBuilder<'a> {
379379
self.straightline(expr, base_exit, field_exprs.as_slice())
380380
}
381381

382-
ast::ExprRepeat(elem, count, _) => {
382+
ast::ExprRepeat(elem, count) => {
383383
self.straightline(expr, pred, [elem, count])
384384
}
385385

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
157157
}
158158
ExprVstore(_, ExprVstoreMutSlice) |
159159
ExprVstore(_, ExprVstoreSlice) |
160-
ExprVec(_, MutImmutable) |
160+
ExprVec(_) |
161161
ExprAddrOf(MutImmutable, _) |
162162
ExprParen(..) |
163163
ExprField(..) |

src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<'a> ConstEvalVisitor<'a> {
213213
join(self.classify(a), self.classify(b)),
214214

215215
ast::ExprTup(ref es) |
216-
ast::ExprVec(ref es, ast::MutImmutable) =>
216+
ast::ExprVec(ref es) =>
217217
join_all(es.iter().map(|e| self.classify(*e))),
218218

219219
ast::ExprVstore(e, vstore) => {

src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,11 @@ impl<'a, 'b, O:DataFlowOperator> PropagationContext<'a, 'b, O> {
538538
self.walk_expr(l, in_out, loop_scopes);
539539
}
540540

541-
ast::ExprVec(ref exprs, _) => {
541+
ast::ExprVec(ref exprs) => {
542542
self.walk_exprs(exprs.as_slice(), in_out, loop_scopes)
543543
}
544544

545-
ast::ExprRepeat(l, r, _) => {
545+
ast::ExprRepeat(l, r) => {
546546
self.walk_expr(l, in_out, loop_scopes);
547547
self.walk_expr(r, in_out, loop_scopes);
548548
}

src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
309309
let target_ty = ty::expr_ty(cx.tcx, e);
310310
check_trait_cast(cx, source_ty, target_ty, source.span);
311311
}
312-
ExprRepeat(element, count_expr, _) => {
312+
ExprRepeat(element, count_expr) => {
313313
let count = ty::eval_repeat_count(cx.tcx, count_expr);
314314
if count > 1 {
315315
let element_ty = ty::expr_ty(cx.tcx, element);

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,11 +1109,11 @@ impl<'a> Liveness<'a> {
11091109
self.propagate_through_expr(expr, succ)
11101110
}
11111111

1112-
ExprVec(ref exprs, _) => {
1112+
ExprVec(ref exprs) => {
11131113
self.propagate_through_exprs(exprs.as_slice(), succ)
11141114
}
11151115

1116-
ExprRepeat(element, count, _) => {
1116+
ExprRepeat(element, count) => {
11171117
let succ = self.propagate_through_expr(count, succ);
11181118
self.propagate_through_expr(element, succ)
11191119
}

src/librustc/middle/moves.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ impl<'a> VisitContext<'a> {
473473
self.use_expr(base, expr_mode);
474474
}
475475

476-
ExprVec(ref exprs, _) => {
476+
ExprVec(ref exprs) => {
477477
self.consume_exprs(exprs.as_slice());
478478
}
479479

@@ -539,7 +539,7 @@ impl<'a> VisitContext<'a> {
539539
// }
540540
}
541541

542-
ExprRepeat(base, count, _) => {
542+
ExprRepeat(base, count) => {
543543
self.consume_expr(base);
544544
self.consume_expr(count);
545545
}

src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
724724
visitor.region_maps.record_rvalue_scope(subexpr.id, blk_id);
725725
record_rvalue_scope_if_borrow_expr(visitor, subexpr, blk_id);
726726
}
727-
ast::ExprVec(ref subexprs, _) |
727+
ast::ExprVec(ref subexprs) |
728728
ast::ExprTup(ref subexprs) => {
729729
for &subexpr in subexprs.iter() {
730730
record_rvalue_scope_if_borrow_expr(

src/librustc/middle/trans/consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
557557
inlineable.iter().fold(true, |a, &b| a && b))
558558
})
559559
}
560-
ast::ExprVec(ref es, ast::MutImmutable) => {
560+
ast::ExprVec(ref es) => {
561561
let (v, _, inlineable) = const_vec(cx,
562562
e,
563563
es.as_slice(),
@@ -573,7 +573,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
573573
_ => { cx.sess().span_bug(e.span, "bad const-slice lit") }
574574
}
575575
}
576-
ast::ExprVec(ref es, ast::MutImmutable) => {
576+
ast::ExprVec(ref es) => {
577577
let (cv, llunitty, _) = const_vec(cx,
578578
e,
579579
es.as_slice(),
@@ -592,7 +592,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
592592
_ => cx.sess().span_bug(e.span, "bad const-slice expr")
593593
}
594594
}
595-
ast::ExprRepeat(elem, count, _) => {
595+
ast::ExprRepeat(elem, count) => {
596596
let vec_ty = ty::expr_ty(cx.tcx(), e);
597597
let unit_ty = ty::sequence_element_type(cx.tcx(), vec_ty);
598598
let llunitty = type_of::type_of(cx, unit_ty);

0 commit comments

Comments
 (0)