rustc: Remove the bitwise not operator

This commit is contained in:
Patrick Walton 2011-06-10 10:46:59 -07:00
parent 7a066ba547
commit dfdd6dbc54
6 changed files with 14 additions and 22 deletions

View file

@ -3388,11 +3388,6 @@ fn trans_unary(&@block_ctxt cx, ast::unop op,
auto e_ty = ty::expr_ty(cx.fcx.lcx.ccx.tcx, e);
alt (op) {
case (ast::bitnot) {
sub = autoderef(sub.bcx, sub.val,
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e));
ret res(sub.bcx, sub.bcx.build.Not(sub.val));
}
case (ast::not) {
sub = autoderef(sub.bcx, sub.val,
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e));

View file

@ -1580,6 +1580,16 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
}
}
}
case (ast::not) {
if (!type_is_integral(fcx, oper.span, oper_t) &&
structure_of(fcx, oper.span, oper_t)
!= ty::ty_bool) {
fcx.ccx.tcx.sess.span_err(expr.span,
#fmt("mismatched types: expected bool or \
integer but found %s",
ty_to_str(fcx.ccx.tcx, oper_t)));
}
}
case (_) { oper_t = strip_boxes(fcx, expr.span, oper_t); }
}