Skip to content

Commit 82a09b9

Browse files
committed
librustc: Remove @mut support from the parser
1 parent 8828129 commit 82a09b9

File tree

20 files changed

+52
-81
lines changed

20 files changed

+52
-81
lines changed

src/librustc/front/feature_gate.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ impl Visitor<()> for Context {
189189

190190
fn visit_expr(&mut self, e: @ast::Expr, _: ()) {
191191
match e.node {
192-
ast::ExprUnary(_, ast::UnBox(..), _) |
193-
ast::ExprVstore(_, ast::ExprVstoreBox) |
194-
ast::ExprVstore(_, ast::ExprVstoreMutBox) => {
192+
ast::ExprUnary(_, ast::UnBox, _) |
193+
ast::ExprVstore(_, ast::ExprVstoreBox) => {
195194
self.gate_box(e.span);
196195
}
197196
_ => {}

src/librustc/middle/check_const.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
116116
if is_const {
117117
match e.node {
118118
ExprUnary(_, UnDeref, _) => { }
119-
ExprUnary(_, UnBox(_), _) | ExprUnary(_, UnUniq, _) => {
119+
ExprUnary(_, UnBox, _) | ExprUnary(_, UnUniq, _) => {
120120
sess.span_err(e.span,
121121
"cannot do allocations in constant expressions");
122122
return;
@@ -197,8 +197,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
197197
immutable values");
198198
},
199199
ExprVstore(_, ExprVstoreUniq) |
200-
ExprVstore(_, ExprVstoreBox) |
201-
ExprVstore(_, ExprVstoreMutBox) => {
200+
ExprVstore(_, ExprVstoreBox) => {
202201
sess.span_err(e.span, "cannot allocate vectors in constant expressions")
203202
},
204203

src/librustc/middle/const_eval.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ impl ConstEvalVisitor {
239239
ast::ExprVstoreSlice => self.classify(e),
240240
ast::ExprVstoreUniq |
241241
ast::ExprVstoreBox |
242-
ast::ExprVstoreMutBox |
243242
ast::ExprVstoreMutSlice => non_const
244243
}
245244
}

src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ pub fn check_expr(cx: &mut Context, e: @Expr) {
306306
}
307307

308308
match e.node {
309-
ExprUnary(_, UnBox(_), interior) => {
309+
ExprUnary(_, UnBox, interior) => {
310310
let interior_type = ty::expr_ty(cx.tcx, interior);
311311
let _ = check_durable(cx.tcx, interior_type, interior.span);
312312
}

src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ fn check_unnecessary_allocation(cx: &Context, e: &ast::Expr) {
10681068
}
10691069
}
10701070
ast::ExprUnary(_, ast::UnUniq, _) |
1071-
ast::ExprUnary(_, ast::UnBox(..), _) => BoxAllocation,
1071+
ast::ExprUnary(_, ast::UnBox, _) => BoxAllocation,
10721072

10731073
_ => return
10741074
};

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ fn const_expr_unadjusted(cx: @CrateContext,
377377
let ty = ty::expr_ty(cx.tcx, e);
378378
let is_float = ty::type_is_fp(ty);
379379
return (match u {
380-
ast::UnBox(_) |
381-
ast::UnUniq |
382-
ast::UnDeref => {
380+
ast::UnBox | ast::UnUniq | ast::UnDeref => {
383381
let (dv, _dt) = const_deref(cx, te, ty, true);
384382
dv
385383
}

src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ fn trans_rvalue_datum_unadjusted(bcx: @Block, expr: &ast::Expr) -> DatumBlock {
590590
ast::ExprPath(_) | ast::ExprSelf => {
591591
return trans_def_datum_unadjusted(bcx, expr, bcx.def(expr.id));
592592
}
593-
ast::ExprVstore(contents, ast::ExprVstoreBox) |
594-
ast::ExprVstore(contents, ast::ExprVstoreMutBox) => {
593+
ast::ExprVstore(contents, ast::ExprVstoreBox) => {
595594
return tvec::trans_uniq_or_managed_vstore(bcx, heap_managed,
596595
expr, contents);
597596
}
@@ -1406,9 +1405,8 @@ fn trans_unary_datum(bcx: @Block,
14061405
};
14071406
immediate_rvalue_bcx(bcx, llneg, un_ty)
14081407
}
1409-
ast::UnBox(_) => {
1410-
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty,
1411-
heap_managed)
1408+
ast::UnBox => {
1409+
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty, heap_managed)
14121410
}
14131411
ast::UnUniq => {
14141412
let heap = heap_for_unique(bcx, un_ty);

src/librustc/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3257,7 +3257,6 @@ pub fn expr_kind(tcx: ctxt,
32573257
ast::ExprAddrOf(..) |
32583258
ast::ExprBinary(..) |
32593259
ast::ExprVstore(_, ast::ExprVstoreBox) |
3260-
ast::ExprVstore(_, ast::ExprVstoreMutBox) |
32613260
ast::ExprVstore(_, ast::ExprVstoreUniq) => {
32623261
RvalueDatumExpr
32633262
}

src/librustc/middle/typeck/astconv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
401401
let typ = match ast_ty.node {
402402
ast::ty_nil => ty::mk_nil(),
403403
ast::ty_bot => ty::mk_bot(),
404-
ast::ty_box(ref mt) => {
405-
let mt = ast::mt { ty: mt.ty, mutbl: ast::MutImmutable };
404+
ast::ty_box(ty) => {
405+
let mt = ast::mt { ty: ty, mutbl: ast::MutImmutable };
406406
mk_pointer(this, rscope, &mt, ty::vstore_box,
407407
|tmt| ty::mk_box(tcx, tmt.ty))
408408
}

src/librustc/middle/typeck/check/mod.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,15 +2628,12 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
26282628
}
26292629
ast::ExprVec(ref args, mutbl) => {
26302630
let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
2631-
let mutability;
26322631
let mut any_error = false;
26332632
let mut any_bot = false;
2634-
match vst {
2635-
ast::ExprVstoreMutBox | ast::ExprVstoreMutSlice => {
2636-
mutability = ast::MutMutable
2637-
}
2638-
_ => mutability = mutbl
2639-
}
2633+
let mutability = match vst {
2634+
ast::ExprVstoreMutSlice => ast::MutMutable,
2635+
_ => mutbl,
2636+
};
26402637
let t: ty::t = fcx.infcx().next_ty_var();
26412638
for e in args.iter() {
26422639
check_expr_has_type(fcx, *e, t);
@@ -2650,11 +2647,9 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
26502647
}
26512648
if any_error {
26522649
ty::mk_err()
2653-
}
2654-
else if any_bot {
2650+
} else if any_bot {
26552651
ty::mk_bot()
2656-
}
2657-
else {
2652+
} else {
26582653
ty::mk_evec(tcx, ty::mt {ty: t, mutbl: mutability}, tt)
26592654
}
26602655
}
@@ -2663,10 +2658,8 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
26632658
let _ = ty::eval_repeat_count(fcx, count_expr);
26642659
let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
26652660
let mutability = match vst {
2666-
ast::ExprVstoreMutBox | ast::ExprVstoreMutSlice => {
2667-
ast::MutMutable
2668-
}
2669-
_ => mutbl
2661+
ast::ExprVstoreMutSlice => ast::MutMutable,
2662+
_ => mutbl,
26702663
};
26712664
let t: ty::t = fcx.infcx().next_ty_var();
26722665
check_expr_has_type(fcx, element, t);
@@ -2741,7 +2734,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
27412734
ast::ExprUnary(callee_id, unop, oprnd) => {
27422735
let exp_inner = unpack_expected(fcx, expected, |sty| {
27432736
match unop {
2744-
ast::UnBox(_) | ast::UnUniq => match *sty {
2737+
ast::UnBox | ast::UnUniq => match *sty {
27452738
ty::ty_box(ty) => Some(ty),
27462739
ty::ty_uniq(ref mt) => Some(mt.ty),
27472740
_ => None
@@ -2755,7 +2748,7 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
27552748
if !ty::type_is_error(oprnd_t) &&
27562749
!ty::type_is_bot(oprnd_t) {
27572750
match unop {
2758-
ast::UnBox(_) => {
2751+
ast::UnBox => {
27592752
oprnd_t = ty::mk_box(tcx, oprnd_t)
27602753
}
27612754
ast::UnUniq => {
@@ -3920,7 +3913,7 @@ pub fn ast_expr_vstore_to_vstore(fcx: @FnCtxt,
39203913
-> ty::vstore {
39213914
match v {
39223915
ast::ExprVstoreUniq => ty::vstore_uniq,
3923-
ast::ExprVstoreBox | ast::ExprVstoreMutBox => ty::vstore_box,
3916+
ast::ExprVstoreBox => ty::vstore_box,
39243917
ast::ExprVstoreSlice | ast::ExprVstoreMutSlice => {
39253918
let r = fcx.infcx().next_region_var(infer::AddrOfSlice(e.span));
39263919
ty::vstore_slice(r)

0 commit comments

Comments
 (0)