trans_overloaded_op(bcx, expr, MethodCall::expr(expr.id), base,
vec![(idx_datum, idx.id)], Some(dest), true).bcx
}
- ast::ExprCast(ref val, _) => {
- // DPS output mode means this is a trait cast:
- if ty::type_is_trait(node_id_type(bcx, expr.id)) {
- let trait_ref =
- bcx.tcx().object_cast_map.borrow()
- .get(&expr.id)
- .cloned()
- .unwrap();
- let trait_ref = bcx.monomorphize(&trait_ref);
- let datum = unpack_datum!(bcx, trans(bcx, &**val));
- meth::trans_trait_cast(bcx, datum, expr.id,
- trait_ref, dest)
- } else {
- bcx.tcx().sess.span_bug(expr.span,
- "expr_cast of non-trait");
- }
+ ast::ExprCast(..) => {
+ // Trait casts used to come this way, now they should be coercions.
+ bcx.tcx().sess.span_bug(expr.span, "DPS expr_cast (residual trait cast?)")
}
ast::ExprAssignOp(op, ref dst, ref src) => {
trans_assign_op(bcx, expr, op, &**dst, &**src)
ast::BiAdd => {
if is_float {
FAdd(bcx, lhs, rhs, binop_debug_loc)
+ } else if is_simd {
+ Add(bcx, lhs, rhs, binop_debug_loc)
} else {
let (newbcx, res) = with_overflow_check(
bcx, OverflowOp::Add, info, lhs_t, lhs, rhs, binop_debug_loc);
ast::BiSub => {
if is_float {
FSub(bcx, lhs, rhs, binop_debug_loc)
+ } else if is_simd {
+ Sub(bcx, lhs, rhs, binop_debug_loc)
} else {
let (newbcx, res) = with_overflow_check(
bcx, OverflowOp::Sub, info, lhs_t, lhs, rhs, binop_debug_loc);
ast::BiMul => {
if is_float {
FMul(bcx, lhs, rhs, binop_debug_loc)
+ } else if is_simd {
+ Mul(bcx, lhs, rhs, binop_debug_loc)
} else {
let (newbcx, res) = with_overflow_check(
bcx, OverflowOp::Mul, info, lhs_t, lhs, rhs, binop_debug_loc);
let mut bcx = bcx;
let ccx = bcx.ccx();
- let t_in = expr_ty(bcx, expr);
+ let t_in = expr_ty_adjusted(bcx, expr);
let t_out = node_id_type(bcx, id);
let k_in = cast_type_kind(bcx.tcx(), t_in);
let k_out = cast_type_kind(bcx.tcx(), t_out);
// by-value as appropriate given its type:
let mut datum = unpack_datum!(bcx, trans(bcx, expr));
- if cast_is_noop(datum.ty, t_out) {
+ let datum_ty = monomorphize_type(bcx, datum.ty);
+ if cast_is_noop(datum_ty, t_out) {
datum.ty = t_out;
return DatumBlock::new(bcx, datum);
}