@@ -36,6 +36,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3636    )  -> Ty < ' tcx >  { 
3737        let  ( lhs_ty,  rhs_ty,  return_ty)  =
3838            self . check_overloaded_binop ( expr,  lhs,  rhs,  op,  IsAssign :: Yes ,  expected) ; 
39+         let  lhs_ty = self . try_structurally_resolve_type ( lhs. span ,  lhs_ty) ; 
40+         let  rhs_ty = self . try_structurally_resolve_type ( rhs. span ,  rhs_ty) ; 
3941
4042        let  ty =
4143            if  !lhs_ty. is_ty_var ( )  && !rhs_ty. is_ty_var ( )  && is_builtin_binop ( lhs_ty,  rhs_ty,  op)  { 
@@ -232,10 +234,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
232234            } 
233235        } ; 
234236
235-         // Guide inference on the lhs ty if necessary. 
236-         self . select_obligations_where_possible ( |_| { } ) ; 
237-         let  lhs_ty = self . resolve_vars_if_possible ( lhs_ty) ; 
238- 
239237        // N.B., as we have not yet type-checked the RHS, we don't have the 
240238        // type at hand. Make a variable to represent it. The whole reason 
241239        // for this indirection is so that, below, we can check the expr 
@@ -253,7 +251,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
253251
254252        // see `NB` above 
255253        let  rhs_ty = self . check_expr_coercible_to_type ( rhs_expr,  rhs_ty_var,  Some ( lhs_expr) ) ; 
256-         let  rhs_ty = self . resolve_vars_with_obligations ( rhs_ty) ; 
257254
258255        let  return_ty = match  result { 
259256            Ok ( method)  => { 
@@ -299,6 +296,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
299296                Ty :: new_misc_error ( self . tcx ) 
300297            } 
301298            Err ( errors)  => { 
299+                 let  lhs_ty = self . try_structurally_resolve_type ( lhs_expr. span ,  lhs_ty) ; 
300+                 let  rhs_ty = self . try_structurally_resolve_type ( rhs_expr. span ,  rhs_ty) ; 
301+ 
302302                let  ( _,  trait_def_id)  =
303303                    lang_item_for_op ( self . tcx ,  Op :: Binary ( op,  is_assign) ,  op. span ) ; 
304304                let  missing_trait = trait_def_id
0 commit comments