Skip to content

Commit 60f3c00

Browse files
committed
---
yaml --- r: 233462 b: refs/heads/beta c: cb1eb9d h: refs/heads/master v: v3
1 parent 0b3fd11 commit 60f3c00

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 8d8b489bc93b2f8754a0de386bd4e960b05a5b47
26+
refs/heads/beta: cb1eb9d0c41739fc6abf4361c263013004463072
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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)