2020-12-01 02:10:13 -06:00
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/issue-79187-2.rs:9:24
|
|
|
|
|
|
|
|
|
LL | take_foo(|a: &i32| a);
|
|
|
|
| - - ^ returning this value requires that `'1` must outlive `'2`
|
|
|
|
| | |
|
|
|
|
| | return type of closure is &'2 i32
|
|
|
|
| let's call the lifetime of this reference `'1`
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/issue-79187-2.rs:10:34
|
|
|
|
|
|
|
|
|
LL | take_foo(|a: &i32| -> &i32 { a });
|
|
|
|
| - - ^ returning this value requires that `'1` must outlive `'2`
|
|
|
|
| | |
|
|
|
|
| | let's call the lifetime of this reference `'2`
|
|
|
|
| let's call the lifetime of this reference `'1`
|
|
|
|
|
2021-06-07 14:25:19 -05:00
|
|
|
error: implementation of `FnOnce` is not general enough
|
2020-12-01 02:10:13 -06:00
|
|
|
--> $DIR/issue-79187-2.rs:8:5
|
|
|
|
|
|
|
|
|
LL | take_foo(|a| a);
|
2021-06-07 14:25:19 -05:00
|
|
|
| ^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
|
|
|
|
|
|
|
|
= note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`...
|
|
|
|
= note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2`
|
2020-12-01 02:10:13 -06:00
|
|
|
|
2021-06-07 14:25:19 -05:00
|
|
|
error[E0308]: mismatched types
|
2020-12-01 02:10:13 -06:00
|
|
|
--> $DIR/issue-79187-2.rs:8:5
|
|
|
|
|
|
|
|
|
LL | take_foo(|a| a);
|
2021-06-07 14:25:19 -05:00
|
|
|
| ^^^^^^^^^^^^^^^ one type is more general than the other
|
|
|
|
|
|
|
|
|
= note: expected type `for<'r> Fn<(&'r i32,)>`
|
|
|
|
found type `Fn<(&i32,)>`
|
|
|
|
note: this closure does not fulfill the lifetime requirements
|
|
|
|
--> $DIR/issue-79187-2.rs:8:14
|
|
|
|
|
|
|
|
|
LL | take_foo(|a| a);
|
|
|
|
| ^^^^^
|
2021-08-28 18:45:37 -05:00
|
|
|
note: the lifetime requirement is introduced here
|
|
|
|
--> $DIR/issue-79187-2.rs:5:21
|
|
|
|
|
|
|
|
|
LL | fn take_foo(_: impl Foo) {}
|
|
|
|
| ^^^
|
2020-12-01 02:10:13 -06:00
|
|
|
|
2021-06-07 14:25:19 -05:00
|
|
|
error[E0308]: mismatched types
|
2020-12-01 02:10:13 -06:00
|
|
|
--> $DIR/issue-79187-2.rs:9:5
|
|
|
|
|
|
|
|
|
LL | take_foo(|a: &i32| a);
|
2021-06-07 14:25:19 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
|
|
|
|
|
|
|
|
= note: expected reference `&i32`
|
|
|
|
found reference `&i32`
|
2021-08-28 18:45:37 -05:00
|
|
|
note: the lifetime requirement is introduced here
|
|
|
|
--> $DIR/issue-79187-2.rs:5:21
|
|
|
|
|
|
|
|
|
LL | fn take_foo(_: impl Foo) {}
|
|
|
|
| ^^^
|
2020-12-01 02:10:13 -06:00
|
|
|
|
2021-06-07 14:25:19 -05:00
|
|
|
error[E0308]: mismatched types
|
2020-12-01 02:10:13 -06:00
|
|
|
--> $DIR/issue-79187-2.rs:10:5
|
|
|
|
|
|
|
|
|
LL | take_foo(|a: &i32| -> &i32 { a });
|
2021-06-07 14:25:19 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
|
|
|
|
|
|
|
|
= note: expected reference `&i32`
|
|
|
|
found reference `&i32`
|
2021-08-28 18:45:37 -05:00
|
|
|
note: the lifetime requirement is introduced here
|
|
|
|
--> $DIR/issue-79187-2.rs:5:21
|
|
|
|
|
|
|
|
|
LL | fn take_foo(_: impl Foo) {}
|
|
|
|
| ^^^
|
2020-12-01 02:10:13 -06:00
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
|
2021-06-07 14:25:19 -05:00
|
|
|
For more information about this error, try `rustc --explain E0308`.
|