@@ -178,9 +178,9 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
178178 // trait matching creating lifetime constraints that are too strict.
179179 // e.g., adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result
180180 // in `&'a T <: &'x T` and `&'b T <: &'x T`, instead of `'a = 'b = 'x`.
181- let lhs_ty = self . infer_expr_no_expect ( lhs_expr, ExprIsRead :: No ) ;
181+ let lhs_ty = self . infer_expr_no_expect ( lhs_expr, ExprIsRead :: Yes ) ;
182182 let fresh_var = self . table . next_ty_var ( ) ;
183- self . demand_coerce ( lhs_expr, lhs_ty, fresh_var, AllowTwoPhase :: No , ExprIsRead :: No )
183+ self . demand_coerce ( lhs_expr, lhs_ty, fresh_var, AllowTwoPhase :: No , ExprIsRead :: Yes )
184184 }
185185 } ;
186186 let lhs_ty = self . table . resolve_vars_with_obligations ( lhs_ty) ;
@@ -200,7 +200,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
200200
201201 // see `NB` above
202202 let rhs_ty =
203- self . infer_expr_coerce ( rhs_expr, & Expectation :: HasType ( rhs_ty_var) , ExprIsRead :: No ) ;
203+ self . infer_expr_coerce ( rhs_expr, & Expectation :: HasType ( rhs_ty_var) , ExprIsRead :: Yes ) ;
204204 let rhs_ty = self . table . resolve_vars_with_obligations ( rhs_ty) ;
205205
206206 let return_ty = match result {
@@ -320,7 +320,11 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
320320 if let Some ( ( rhs_expr, rhs_ty) ) = opt_rhs
321321 && rhs_ty. is_ty_var ( )
322322 {
323- self . infer_expr_coerce ( rhs_expr, & Expectation :: HasType ( rhs_ty) , ExprIsRead :: No ) ;
323+ self . infer_expr_coerce (
324+ rhs_expr,
325+ & Expectation :: HasType ( rhs_ty) ,
326+ ExprIsRead :: Yes ,
327+ ) ;
324328 }
325329
326330 // Construct an obligation `self_ty : Trait<input_tys>`
0 commit comments