]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs
Rollup merge of #98796 - compiler-errors:no-semi-if-comma, r=estebank
[rust.git] / src / test / ui / closure-expected-type / expect-infer-var-appearing-twice.rs
1 fn with_closure<F, A>(_: F)
2     where F: FnOnce(A, A)
3 {
4 }
5
6 fn a() {
7     with_closure(|x: u32, y| {
8         // We deduce type of `y` from `x`.
9     });
10 }
11
12 fn b() {
13     // Here we take the supplied types, resulting in an error later on.
14     with_closure(|x: u32, y: i32| {
15         //~^ ERROR type mismatch in closure arguments
16     });
17 }
18
19 fn c() {
20     with_closure(|x, y: i32| {
21         // We deduce type of `x` from `y`.
22     });
23 }
24
25 fn main() { }