Skip to content

Commit d1a57e4

Browse files
committed
syntax: ast: remove TyBox and UnBox.
1 parent a99e626 commit d1a57e4

File tree

18 files changed

+10
-63
lines changed

18 files changed

+10
-63
lines changed

src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ impl LintPass for UnnecessaryAllocation {
12891289

12901290
fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
12911291
match e.node {
1292-
ast::ExprUnary(ast::UnUniq, _) | ast::ExprUnary(ast::UnBox, _) => (),
1292+
ast::ExprUnary(ast::UnUniq, _) => (),
12931293
_ => return
12941294
}
12951295

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) {
100100
if v.in_const {
101101
match e.node {
102102
ExprUnary(UnDeref, _) => { }
103-
ExprUnary(UnBox, _) | ExprUnary(UnUniq, _) => {
103+
ExprUnary(UnUniq, _) => {
104104
span_err!(v.tcx.sess, e.span, E0010, "cannot do allocations in constant expressions");
105105
return;
106106
}

src/librustc/middle/check_static.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckStaticVisitor<'a, 'tcx> {
115115
span_err!(self.tcx.sess, e.span, E0020,
116116
"static items are not allowed to have mutable slices");
117117
},
118-
ast::ExprUnary(ast::UnBox, _) => {
119-
span_err!(self.tcx.sess, e.span, E0021,
120-
"static items are not allowed to have managed pointers");
121-
}
122118
ast::ExprBox(..) |
123119
ast::ExprUnary(ast::UnUniq, _) => {
124120
span_err!(self.tcx.sess, e.span, E0022,

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
421421
let ty = ty::expr_ty(cx.tcx(), &**e);
422422
let is_float = ty::type_is_fp(ty);
423423
return (match u {
424-
ast::UnBox | ast::UnUniq | ast::UnDeref => {
424+
ast::UnUniq | ast::UnDeref => {
425425
let (dv, _dt) = const_deref(cx, te, ty, true);
426426
dv
427427
}

src/librustc/middle/trans/expr.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,9 +1533,6 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
15331533
};
15341534
immediate_rvalue_bcx(bcx, llneg, un_ty).to_expr_datumblock()
15351535
}
1536-
ast::UnBox => {
1537-
trans_managed_expr(bcx, un_ty, sub_expr, expr_ty(bcx, sub_expr))
1538-
}
15391536
ast::UnUniq => {
15401537
trans_uniq_expr(bcx, un_ty, sub_expr, expr_ty(bcx, sub_expr))
15411538
}

src/librustc/middle/typeck/astconv.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,6 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
856856
match ast_ty.node {
857857
ast::TyNil => ty::mk_nil(),
858858
ast::TyBot => ty::mk_bot(),
859-
ast::TyBox(ref ty) => {
860-
mk_pointer(this, rscope, ast::MutImmutable, &**ty, Box,
861-
|ty| ty::mk_box(tcx, ty))
862-
}
863859
ast::TyUniq(ref ty) => {
864860
mk_pointer(this, rscope, ast::MutImmutable, &**ty, Uniq,
865861
|ty| ty::mk_uniq(tcx, ty))

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3881,8 +3881,8 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
38813881
ast::ExprUnary(unop, ref oprnd) => {
38823882
let expected_inner = expected.map(fcx, |sty| {
38833883
match unop {
3884-
ast::UnBox | ast::UnUniq => match *sty {
3885-
ty::ty_box(ty) | ty::ty_uniq(ty) => {
3884+
ast::UnUniq => match *sty {
3885+
ty::ty_uniq(ty) => {
38863886
ExpectHasType(ty)
38873887
}
38883888
_ => {
@@ -3907,11 +3907,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
39073907

39083908
if !ty::type_is_error(oprnd_t) {
39093909
match unop {
3910-
ast::UnBox => {
3911-
if !ty::type_is_bot(oprnd_t) {
3912-
oprnd_t = ty::mk_box(tcx, oprnd_t)
3913-
}
3914-
}
39153910
ast::UnUniq => {
39163911
if !ty::type_is_bot(oprnd_t) {
39173912
oprnd_t = ty::mk_uniq(tcx, oprnd_t);

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,6 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
663663
visit::walk_expr(rcx, expr);
664664
}
665665

666-
ast::ExprUnary(ast::UnBox, ref base) => {
667-
// Managed data must not have borrowed pointers within it:
668-
let base_ty = rcx.resolve_node_type(base.id);
669-
type_must_outlive(rcx, infer::Managed(expr.span),
670-
base_ty, ty::ReStatic);
671-
visit::walk_expr(rcx, expr);
672-
}
673-
674666
ast::ExprUnary(ast::UnDeref, ref base) => {
675667
// For *a, the lifetime of a must enclose the deref
676668
let method_call = MethodCall::expr(expr.id);

src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,6 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
12851285
ast::TyPtr(ref mut_ty) => {
12861286
ty_queue.push(&*mut_ty.ty);
12871287
}
1288-
ast::TyBox(ref ty) |
12891288
ast::TyVec(ref ty) |
12901289
ast::TyUniq(ref ty) |
12911290
ast::TyFixedLengthVec(ref ty, _) => {
@@ -1323,7 +1322,6 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
13231322
ty: build_to(mut_ty.ty, to),
13241323
})
13251324
}
1326-
ast::TyBox(ty) => ast::TyBox(build_to(ty, to)),
13271325
ast::TyVec(ty) => ast::TyVec(build_to(ty, to)),
13281326
ast::TyUniq(ty) => ast::TyUniq(build_to(ty, to)),
13291327
ast::TyFixedLengthVec(ty, e) => {

src/librustdoc/clean/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,6 @@ impl Clean<Type> for ast::Ty {
12151215
TyRptr(ref l, ref m) =>
12161216
BorrowedRef {lifetime: l.clean(cx), mutability: m.mutbl.clean(cx),
12171217
type_: box m.ty.clean(cx)},
1218-
TyBox(ref ty) => Managed(box ty.clean(cx)),
12191218
TyUniq(ref ty) => Unique(box ty.clean(cx)),
12201219
TyVec(ref ty) => Vector(box ty.clean(cx)),
12211220
TyFixedLengthVec(ref ty, ref e) => FixedVector(box ty.clean(cx),

0 commit comments

Comments
 (0)