]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/closure-arg-type-mismatch.stderr
Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin
[rust.git] / tests / ui / mismatched_types / closure-arg-type-mismatch.stderr
1 error[E0631]: type mismatch in closure arguments
2   --> $DIR/closure-arg-type-mismatch.rs:3:14
3    |
4 LL |     a.iter().map(|_: (u32, u32)| 45);
5    |              ^^^ --------------- found signature defined here
6    |              |
7    |              expected due to this
8    |
9    = note: expected closure signature `fn(&(u32, u32)) -> _`
10               found closure signature `fn((u32, u32)) -> _`
11 note: required by a bound in `map`
12   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
13 help: consider borrowing the argument
14    |
15 LL |     a.iter().map(|_: &(u32, u32)| 45);
16    |                      +
17
18 error[E0631]: type mismatch in closure arguments
19   --> $DIR/closure-arg-type-mismatch.rs:4:14
20    |
21 LL |     a.iter().map(|_: &(u16, u16)| 45);
22    |              ^^^ ---------------- found signature defined here
23    |              |
24    |              expected due to this
25    |
26    = note: expected closure signature `fn(&(u32, u32)) -> _`
27               found closure signature `for<'a> fn(&'a (u16, u16)) -> _`
28 note: required by a bound in `map`
29   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
30
31 error[E0631]: type mismatch in closure arguments
32   --> $DIR/closure-arg-type-mismatch.rs:5:14
33    |
34 LL |     a.iter().map(|_: (u16, u16)| 45);
35    |              ^^^ --------------- found signature defined here
36    |              |
37    |              expected due to this
38    |
39    = note: expected closure signature `fn(&(u32, u32)) -> _`
40               found closure signature `fn((u16, u16)) -> _`
41 note: required by a bound in `map`
42   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
43
44 error: aborting due to 3 previous errors
45
46 For more information about this error, try `rustc --explain E0631`.