]> git.proxmox.com Git - rustc.git/blame - src/test/ui/lifetimes/issue-79187-2.nll.stderr
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / lifetimes / issue-79187-2.nll.stderr
CommitLineData
5869c6ff
XL
1error: lifetime may not live long enough
2 --> $DIR/issue-79187-2.rs:9: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:10: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
94222f64 19error: implementation of `FnOnce` is not general enough
5869c6ff
XL
20 --> $DIR/issue-79187-2.rs:8:5
21 |
22LL | take_foo(|a| a);
94222f64
XL
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`
5869c6ff 27
94222f64 28error[E0308]: mismatched types
5869c6ff
XL
29 --> $DIR/issue-79187-2.rs:8:5
30 |
31LL | take_foo(|a| a);
94222f64
XL
32 | ^^^^^^^^^^^^^^^ one type is more general than the other
33 |
34 = note: expected type `for<'r> Fn<(&'r i32,)>`
35 found type `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 | ^^^^^
c295e0f8
XL
41note: the lifetime requirement is introduced here
42 --> $DIR/issue-79187-2.rs:5:21
43 |
44LL | fn take_foo(_: impl Foo) {}
45 | ^^^
5869c6ff 46
94222f64 47error[E0308]: mismatched types
5869c6ff
XL
48 --> $DIR/issue-79187-2.rs:9:5
49 |
50LL | take_foo(|a: &i32| a);
94222f64
XL
51 | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
52 |
53 = note: expected reference `&i32`
54 found reference `&i32`
c295e0f8
XL
55note: the lifetime requirement is introduced here
56 --> $DIR/issue-79187-2.rs:5:21
57 |
58LL | fn take_foo(_: impl Foo) {}
59 | ^^^
5869c6ff 60
94222f64 61error[E0308]: mismatched types
5869c6ff
XL
62 --> $DIR/issue-79187-2.rs:10:5
63 |
64LL | take_foo(|a: &i32| -> &i32 { a });
94222f64
XL
65 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
66 |
67 = note: expected reference `&i32`
68 found reference `&i32`
c295e0f8
XL
69note: the lifetime requirement is introduced here
70 --> $DIR/issue-79187-2.rs:5:21
71 |
72LL | fn take_foo(_: impl Foo) {}
73 | ^^^
5869c6ff
XL
74
75error: aborting due to 6 previous errors
76
94222f64 77For more information about this error, try `rustc --explain E0308`.