fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: lifetime may not live long enough 2 --> $DIR/issue-79187-2.rs:11:24 3 | 4LL | 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 10error: lifetime may not live long enough 11 --> $DIR/issue-79187-2.rs:14:34 12 | 13LL | 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 19error: implementation of `FnOnce` is not general enough 20 --> $DIR/issue-79187-2.rs:8:5 21 | 22LL | 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 28error[E0308]: mismatched types 29 --> $DIR/issue-79187-2.rs:8:5 30 | 31LL | take_foo(|a| a); 32 | ^^^^^^^^^^^^^^^ one type is more general than the other 33 | 34 = note: expected trait `for<'a> Fn<(&'a i32,)>` 35 found trait `Fn<(&i32,)>` 36note: this closure does not fulfill the lifetime requirements 37 --> $DIR/issue-79187-2.rs:8:14 38 | 39LL | take_foo(|a| a); 40 | ^^^ 41note: the lifetime requirement is introduced here 42 --> $DIR/issue-79187-2.rs:5:21 43 | 44LL | fn take_foo(_: impl Foo) {} 45 | ^^^ 46help: consider specifying the type of the closure parameters 47 | 48LL | take_foo(|a: &_| a); 49 | ~~~~~~~ 50 51error[E0308]: mismatched types 52 --> $DIR/issue-79187-2.rs:11:5 53 | 54LL | take_foo(|a: &i32| a); 55 | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other 56 | 57 = note: expected reference `&i32` 58 found reference `&i32` 59note: the lifetime requirement is introduced here 60 --> $DIR/issue-79187-2.rs:5:21 61 | 62LL | fn take_foo(_: impl Foo) {} 63 | ^^^ 64 65error[E0308]: mismatched types 66 --> $DIR/issue-79187-2.rs:14:5 67 | 68LL | take_foo(|a: &i32| -> &i32 { a }); 69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other 70 | 71 = note: expected reference `&i32` 72 found reference `&i32` 73note: the lifetime requirement is introduced here 74 --> $DIR/issue-79187-2.rs:5:21 75 | 76LL | fn take_foo(_: impl Foo) {} 77 | ^^^ 78 79error: aborting due to 6 previous errors 80 81For more information about this error, try `rustc --explain E0308`.