Skip to content

Commit ef6e5ee

Browse files
committed
---
yaml --- r: 232463 b: refs/heads/try c: cb1eb9d h: refs/heads/master i: 232461: 1492584 232459: 38cc8d3 232455: f3573a0 232447: 30ffd9d v: v3
1 parent c8da627 commit ef6e5ee

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 8d8b489bc93b2f8754a0de386bd4e960b05a5b47
4+
refs/heads/try: cb1eb9d0c41739fc6abf4361c263013004463072
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/check/op.rs

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,6 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
8282
check_expr(fcx, lhs_expr);
8383
let lhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
8484

85-
// Annoyingly, SIMD ops don't fit into the PartialEq/PartialOrd
86-
// traits, because their return type is not bool. Perhaps this
87-
// should change, but for now if LHS is SIMD we go down a
88-
// different path that bypassess all traits.
89-
if lhs_ty.is_simd() {
90-
check_expr_coercable_to_type(fcx, rhs_expr, lhs_ty);
91-
let rhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
92-
let return_ty = enforce_builtin_binop_types(fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
93-
fcx.write_ty(expr.id, return_ty);
94-
return;
95-
}
96-
9785
match BinOpCategory::from(op) {
9886
BinOpCategory::Shortcircuit => {
9987
// && and || are a simple case.
@@ -154,12 +142,6 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
154142
}
155143

156144
BinOpCategory::Shift => {
157-
// For integers, the shift amount can be of any integral
158-
// type. For simd, the type must match exactly.
159-
if lhs_ty.is_simd() {
160-
demand::suptype(fcx, rhs_expr.span, lhs_ty, rhs_ty);
161-
}
162-
163145
// result type is same as LHS always
164146
lhs_ty
165147
}
@@ -174,27 +156,7 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
174156
BinOpCategory::Comparison => {
175157
// both LHS and RHS and result will have the same type
176158
demand::suptype(fcx, rhs_expr.span, lhs_ty, rhs_ty);
177-
178-
// if this is simd, result is same as lhs, else bool
179-
if lhs_ty.is_simd() {
180-
let unit_ty = lhs_ty.simd_type(tcx);
181-
debug!("enforce_builtin_binop_types: lhs_ty={:?} unit_ty={:?}",
182-
lhs_ty,
183-
unit_ty);
184-
if !unit_ty.is_integral() {
185-
tcx.sess.span_err(
186-
lhs_expr.span,
187-
&format!("binary comparison operation `{}` not supported \
188-
for floating point SIMD vector `{}`",
189-
ast_util::binop_to_string(op.node),
190-
lhs_ty));
191-
tcx.types.err
192-
} else {
193-
lhs_ty
194-
}
195-
} else {
196-
tcx.mk_bool()
197-
}
159+
tcx.mk_bool()
198160
}
199161
}
200162
}
@@ -427,29 +389,25 @@ fn is_builtin_binop<'tcx>(lhs: Ty<'tcx>,
427389

428390
BinOpCategory::Shift => {
429391
lhs.references_error() || rhs.references_error() ||
430-
lhs.is_integral() && rhs.is_integral() ||
431-
lhs.is_simd() && rhs.is_simd()
392+
lhs.is_integral() && rhs.is_integral()
432393
}
433394

434395
BinOpCategory::Math => {
435396
lhs.references_error() || rhs.references_error() ||
436397
lhs.is_integral() && rhs.is_integral() ||
437-
lhs.is_floating_point() && rhs.is_floating_point() ||
438-
lhs.is_simd() && rhs.is_simd()
398+
lhs.is_floating_point() && rhs.is_floating_point()
439399
}
440400

441401
BinOpCategory::Bitwise => {
442402
lhs.references_error() || rhs.references_error() ||
443403
lhs.is_integral() && rhs.is_integral() ||
444404
lhs.is_floating_point() && rhs.is_floating_point() ||
445-
lhs.is_simd() && rhs.is_simd() ||
446405
lhs.is_bool() && rhs.is_bool()
447406
}
448407

449408
BinOpCategory::Comparison => {
450409
lhs.references_error() || rhs.references_error() ||
451-
lhs.is_scalar() && rhs.is_scalar() ||
452-
lhs.is_simd() && rhs.is_simd()
410+
lhs.is_scalar() && rhs.is_scalar()
453411
}
454412
}
455413
}

0 commit comments

Comments
 (0)