@@ -256,8 +256,10 @@ special situation where we can get `LubCoerce(ty0, ty1) == Some(ty2)`:
256
256
` LubCoerce((FnDef | Closure), (FnDef | Closure)) == Some(FnPtr) ` (where Closure
257
257
is non-capturing). You can check it with the pseudo code.
258
258
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)) ` .
261
263
262
264
``` rust
263
265
# #[derive(Clone , Copy )]
@@ -277,10 +279,6 @@ let bar: Ty = match true {
277
279
let baz : [Ty ; 2 ] = [a , b ];
278
280
```
279
281
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
-
284
282
[ array literal expressions ] : expressions/array-expr.md
285
283
[ if expressions ] : expressions/if-expr.md
286
284
[ match ] : expressions/match-expr.md
0 commit comments