@@ -256,8 +256,10 @@ special situation where we can get `LubCoerce(ty0, ty1) == Some(ty2)`:
256256` LubCoerce((FnDef | Closure), (FnDef | Closure)) == Some(FnPtr) ` (where Closure
257257is non-capturing). You can check it with the pseudo code.
258258
259- It also worth mentioning code below compiles if and only if
260- ` LubCoerce(Ty, typeof(a), typeof(b)).is_some() ` :
259+ When an expression that performs LUB coercion has an expected type, the
260+ expected type is added to the list of types the coercion operates on. So,
261+ for example, in each of the following let statements, the coercion being
262+ performed is ` LubCoerce(Ty, typeof(a), typeof(b)) ` .
261263
262264``` rust
263265# #[derive(Clone , Copy )]
@@ -277,10 +279,6 @@ let bar: Ty = match true {
277279let baz : [Ty ; 2 ] = [a , b ];
278280```
279281
280- That's because with expected type, the compiler checks
281- ` LubCoerce(expected, ty0, ty1, ty2...).is_some() ` rather than
282- ` LubCoerce(ty0, ty1, ty2...) == expected ` .
283-
284282[ array literal expressions ] : expressions/array-expr.md
285283[ if expressions ] : expressions/if-expr.md
286284[ match ] : expressions/match-expr.md
0 commit comments