@@ -21,7 +21,7 @@ use super::{
2121 structurally_resolved_type,
2222} ;
2323use middle:: traits;
24- use middle:: ty:: { self , Ty , HasTypeFlags } ;
24+ use middle:: ty:: { Ty , HasTypeFlags } ;
2525use syntax:: ast;
2626use syntax:: ast_util;
2727use syntax:: parse:: token;
@@ -41,7 +41,7 @@ pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
4141 let lhs_ty = structurally_resolved_type ( fcx, lhs_expr. span , fcx. expr_ty ( lhs_expr) ) ;
4242 let rhs_ty = structurally_resolved_type ( fcx, rhs_expr. span , fcx. expr_ty ( rhs_expr) ) ;
4343
44- if is_builtin_binop ( fcx . tcx ( ) , lhs_ty, rhs_ty, op) {
44+ if is_builtin_binop ( lhs_ty, rhs_ty, op) {
4545 enforce_builtin_binop_types ( fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op) ;
4646 fcx. write_nil ( expr. id ) ;
4747 } else {
@@ -86,7 +86,7 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
8686 // traits, because their return type is not bool. Perhaps this
8787 // should change, but for now if LHS is SIMD we go down a
8888 // different path that bypassess all traits.
89- if lhs_ty. is_simd ( fcx . tcx ( ) ) {
89+ if lhs_ty. is_simd ( ) {
9090 check_expr_coercable_to_type ( fcx, rhs_expr, lhs_ty) ;
9191 let rhs_ty = fcx. resolve_type_vars_if_possible ( fcx. expr_ty ( lhs_expr) ) ;
9292 let return_ty = enforce_builtin_binop_types ( fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op) ;
@@ -123,7 +123,7 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
123123 let rhs_ty = fcx. resolve_type_vars_if_possible ( rhs_ty) ;
124124 if
125125 !lhs_ty. is_ty_var ( ) && !rhs_ty. is_ty_var ( ) &&
126- is_builtin_binop ( fcx . tcx ( ) , lhs_ty, rhs_ty, op)
126+ is_builtin_binop ( lhs_ty, rhs_ty, op)
127127 {
128128 let builtin_return_ty =
129129 enforce_builtin_binop_types ( fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op) ;
@@ -143,7 +143,7 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
143143 op : ast:: BinOp )
144144 -> Ty < ' tcx >
145145{
146- debug_assert ! ( is_builtin_binop( fcx . tcx ( ) , lhs_ty, rhs_ty, op) ) ;
146+ debug_assert ! ( is_builtin_binop( lhs_ty, rhs_ty, op) ) ;
147147
148148 let tcx = fcx. tcx ( ) ;
149149 match BinOpCategory :: from ( op) {
@@ -156,7 +156,7 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
156156 BinOpCategory :: Shift => {
157157 // For integers, the shift amount can be of any integral
158158 // type. For simd, the type must match exactly.
159- if lhs_ty. is_simd ( tcx ) {
159+ if lhs_ty. is_simd ( ) {
160160 demand:: suptype ( fcx, rhs_expr. span , lhs_ty, rhs_ty) ;
161161 }
162162
@@ -176,7 +176,7 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
176176 demand:: suptype ( fcx, rhs_expr. span , lhs_ty, rhs_ty) ;
177177
178178 // if this is simd, result is same as lhs, else bool
179- if lhs_ty. is_simd ( tcx ) {
179+ if lhs_ty. is_simd ( ) {
180180 let unit_ty = lhs_ty. simd_type ( tcx) ;
181181 debug ! ( "enforce_builtin_binop_types: lhs_ty={:?} unit_ty={:?}" ,
182182 lhs_ty,
@@ -415,8 +415,7 @@ impl BinOpCategory {
415415/// Reason #2 is the killer. I tried for a while to always use
416416/// overloaded logic and just check the types in constants/trans after
417417/// the fact, and it worked fine, except for SIMD types. -nmatsakis
418- fn is_builtin_binop < ' tcx > ( cx : & ty:: ctxt < ' tcx > ,
419- lhs : Ty < ' tcx > ,
418+ fn is_builtin_binop < ' tcx > ( lhs : Ty < ' tcx > ,
420419 rhs : Ty < ' tcx > ,
421420 op : ast:: BinOp )
422421 -> bool
@@ -429,28 +428,28 @@ fn is_builtin_binop<'tcx>(cx: &ty::ctxt<'tcx>,
429428 BinOpCategory :: Shift => {
430429 lhs. references_error ( ) || rhs. references_error ( ) ||
431430 lhs. is_integral ( ) && rhs. is_integral ( ) ||
432- lhs. is_simd ( cx ) && rhs. is_simd ( cx )
431+ lhs. is_simd ( ) && rhs. is_simd ( )
433432 }
434433
435434 BinOpCategory :: Math => {
436435 lhs. references_error ( ) || rhs. references_error ( ) ||
437436 lhs. is_integral ( ) && rhs. is_integral ( ) ||
438437 lhs. is_floating_point ( ) && rhs. is_floating_point ( ) ||
439- lhs. is_simd ( cx ) && rhs. is_simd ( cx )
438+ lhs. is_simd ( ) && rhs. is_simd ( )
440439 }
441440
442441 BinOpCategory :: Bitwise => {
443442 lhs. references_error ( ) || rhs. references_error ( ) ||
444443 lhs. is_integral ( ) && rhs. is_integral ( ) ||
445444 lhs. is_floating_point ( ) && rhs. is_floating_point ( ) ||
446- lhs. is_simd ( cx ) && rhs. is_simd ( cx ) ||
445+ lhs. is_simd ( ) && rhs. is_simd ( ) ||
447446 lhs. is_bool ( ) && rhs. is_bool ( )
448447 }
449448
450449 BinOpCategory :: Comparison => {
451450 lhs. references_error ( ) || rhs. references_error ( ) ||
452451 lhs. is_scalar ( ) && rhs. is_scalar ( ) ||
453- lhs. is_simd ( cx ) && rhs. is_simd ( cx )
452+ lhs. is_simd ( ) && rhs. is_simd ( )
454453 }
455454 }
456455}
0 commit comments