rustc: Remove the bitwise not operator
This commit is contained in:
parent
7a066ba547
commit
dfdd6dbc54
6 changed files with 14 additions and 22 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue