]> git.proxmox.com Git - rustc.git/blob - src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / 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 of `fn((u32, u32)) -> _`
6 | |
7 | expected signature of `fn(&(u32, u32)) -> _`
8
9 error[E0631]: type mismatch in closure arguments
10 --> $DIR/closure-arg-type-mismatch.rs:4:14
11 |
12 LL | a.iter().map(|_: &(u16, u16)| 45);
13 | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
14 | |
15 | expected signature of `fn(&(u32, u32)) -> _`
16
17 error[E0631]: type mismatch in closure arguments
18 --> $DIR/closure-arg-type-mismatch.rs:5:14
19 |
20 LL | a.iter().map(|_: (u16, u16)| 45);
21 | ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
22 | |
23 | expected signature of `fn(&(u32, u32)) -> _`
24
25 error[E0308]: mismatched types
26 --> $DIR/closure-arg-type-mismatch.rs:10:5
27 |
28 LL | baz(f);
29 | ^^^ lifetime mismatch
30 |
31 = note: expected type `for<'r> Fn<(*mut &'r u32,)>`
32 found type `Fn<(*mut &'a u32,)>`
33 note: the required lifetime does not necessarily outlive the lifetime `'a` as defined on the function body at 9:10
34 --> $DIR/closure-arg-type-mismatch.rs:9:10
35 |
36 LL | fn _test<'a>(f: fn(*mut &'a u32)) {
37 | ^^
38 note: the lifetime requirement is introduced here
39 --> $DIR/closure-arg-type-mismatch.rs:8:11
40 |
41 LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
42 | ^^^^^^^^^^^^^
43
44 error: implementation of `FnOnce` is not general enough
45 --> $DIR/closure-arg-type-mismatch.rs:10:5
46 |
47 LL | baz(f);
48 | ^^^ implementation of `FnOnce` is not general enough
49 |
50 = note: `fn(*mut &'a u32)` must implement `FnOnce<(*mut &'0 u32,)>`, for any lifetime `'0`...
51 = note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`
52
53 error[E0308]: mismatched types
54 --> $DIR/closure-arg-type-mismatch.rs:10:5
55 |
56 LL | baz(f);
57 | ^^^ lifetime mismatch
58 |
59 = note: expected type `for<'r> Fn<(*mut &'r u32,)>`
60 found type `Fn<(*mut &'a u32,)>`
61 note: the lifetime `'a` as defined on the function body at 9:10 doesn't meet the lifetime requirements
62 --> $DIR/closure-arg-type-mismatch.rs:9:10
63 |
64 LL | fn _test<'a>(f: fn(*mut &'a u32)) {
65 | ^^
66 note: the lifetime requirement is introduced here
67 --> $DIR/closure-arg-type-mismatch.rs:8:11
68 |
69 LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
70 | ^^^^^^^^^^^^^
71
72 error: implementation of `FnOnce` is not general enough
73 --> $DIR/closure-arg-type-mismatch.rs:10:5
74 |
75 LL | baz(f);
76 | ^^^ implementation of `FnOnce` is not general enough
77 |
78 = note: `fn(*mut &'a u32)` must implement `FnOnce<(*mut &'0 u32,)>`, for any lifetime `'0`...
79 = note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`
80
81 error: aborting due to 7 previous errors
82
83 Some errors have detailed explanations: E0308, E0631.
84 For more information about an error, try `rustc --explain E0308`.