]>
Commit | Line | Data |
---|---|---|
923072b8 FG |
1 | error: lifetime may not live long enough |
2 | --> $DIR/issue-79187-2.rs:11:24 | |
3 | | | |
4 | LL | take_foo(|a: &i32| a); | |
5 | | - - ^ returning this value requires that `'1` must outlive `'2` | |
6 | | | | | |
7 | | | return type of closure is &'2 i32 | |
8 | | let's call the lifetime of this reference `'1` | |
9 | ||
10 | error: lifetime may not live long enough | |
11 | --> $DIR/issue-79187-2.rs:14:34 | |
12 | | | |
13 | LL | take_foo(|a: &i32| -> &i32 { a }); | |
14 | | - - ^ returning this value requires that `'1` must outlive `'2` | |
15 | | | | | |
16 | | | let's call the lifetime of this reference `'2` | |
17 | | let's call the lifetime of this reference `'1` | |
18 | ||
19 | error: implementation of `FnOnce` is not general enough | |
20 | --> $DIR/issue-79187-2.rs:8:5 | |
21 | | | |
22 | LL | take_foo(|a| a); | |
23 | | ^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | |
24 | | | |
25 | = note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... | |
26 | = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` | |
27 | ||
5869c6ff XL |
28 | error[E0308]: mismatched types |
29 | --> $DIR/issue-79187-2.rs:8:5 | |
30 | | | |
31 | LL | take_foo(|a| a); | |
923072b8 | 32 | | ^^^^^^^^^^^^^^^ one type is more general than the other |
5869c6ff | 33 | | |
2b03887a | 34 | = note: expected trait `for<'a> Fn<(&'a i32,)>` |
923072b8 | 35 | found trait `Fn<(&i32,)>` |
5869c6ff XL |
36 | note: this closure does not fulfill the lifetime requirements |
37 | --> $DIR/issue-79187-2.rs:8:14 | |
38 | | | |
39 | LL | take_foo(|a| a); | |
064997fb | 40 | | ^^^ |
5869c6ff XL |
41 | note: the lifetime requirement is introduced here |
42 | --> $DIR/issue-79187-2.rs:5:21 | |
43 | | | |
44 | LL | fn take_foo(_: impl Foo) {} | |
45 | | ^^^ | |
46 | ||
47 | error[E0308]: mismatched types | |
923072b8 | 48 | --> $DIR/issue-79187-2.rs:11:5 |
5869c6ff XL |
49 | | |
50 | LL | take_foo(|a: &i32| a); | |
923072b8 | 51 | | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other |
5869c6ff XL |
52 | | |
53 | = note: expected reference `&i32` | |
54 | found reference `&i32` | |
5869c6ff XL |
55 | note: the lifetime requirement is introduced here |
56 | --> $DIR/issue-79187-2.rs:5:21 | |
57 | | | |
58 | LL | fn take_foo(_: impl Foo) {} | |
59 | | ^^^ | |
60 | ||
61 | error[E0308]: mismatched types | |
923072b8 | 62 | --> $DIR/issue-79187-2.rs:14:5 |
5869c6ff XL |
63 | | |
64 | LL | take_foo(|a: &i32| -> &i32 { a }); | |
923072b8 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other |
5869c6ff XL |
66 | | |
67 | = note: expected reference `&i32` | |
68 | found reference `&i32` | |
5869c6ff XL |
69 | note: the lifetime requirement is introduced here |
70 | --> $DIR/issue-79187-2.rs:5:21 | |
71 | | | |
72 | LL | fn take_foo(_: impl Foo) {} | |
73 | | ^^^ | |
74 | ||
923072b8 | 75 | error: aborting due to 6 previous errors |
5869c6ff XL |
76 | |
77 | For more information about this error, try `rustc --explain E0308`. |