File: issue-79187-2.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (67 lines) | stat: -rw-r--r-- 2,499 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
error: lifetime may not live long enough
  --> $DIR/issue-79187-2.rs:11: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:14: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`

error: implementation of `FnOnce` is not general enough
  --> $DIR/issue-79187-2.rs:8:5
   |
LL |     take_foo(|a| a);
   |     ^^^^^^^^^^^^^^^ 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`

error: implementation of `Fn` is not general enough
  --> $DIR/issue-79187-2.rs:8:5
   |
LL |     take_foo(|a| a);
   |     ^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
   |
   = note: closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,)>`, for any lifetime `'1`...
   = note: ...but it actually implements `Fn<(&'2 i32,)>`, for some specific lifetime `'2`

error[E0308]: mismatched types
  --> $DIR/issue-79187-2.rs:11:5
   |
LL |     take_foo(|a: &i32| a);
   |     ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected reference `&_`
              found reference `&_`
note: the lifetime requirement is introduced here
  --> $DIR/issue-79187-2.rs:5:21
   |
LL | fn take_foo(_: impl Foo) {}
   |                     ^^^

error[E0308]: mismatched types
  --> $DIR/issue-79187-2.rs:14:5
   |
LL |     take_foo(|a: &i32| -> &i32 { a });
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected reference `&_`
              found reference `&_`
note: the lifetime requirement is introduced here
  --> $DIR/issue-79187-2.rs:5:21
   |
LL | fn take_foo(_: impl Foo) {}
   |                     ^^^

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0308`.