File: opaque-and-lifetime-mismatch.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, 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 (109 lines) | stat: -rw-r--r-- 4,367 bytes parent folder | download | duplicates (3)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
error[E0106]: missing lifetime specifier
  --> $DIR/opaque-and-lifetime-mismatch.rs:4:24
   |
LL |     fn bar() -> Wrapper<impl Sized>;
   |                        ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
   |
LL |     fn bar() -> Wrapper<'static, impl Sized>;
   |                         ++++++++

error[E0106]: missing lifetime specifier
  --> $DIR/opaque-and-lifetime-mismatch.rs:18:24
   |
LL |     fn foo() -> Wrapper<impl Sized>;
   |                        ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
   |
LL |     fn foo() -> Wrapper<'static, impl Sized>;
   |                         ++++++++

error[E0106]: missing lifetime specifier
  --> $DIR/opaque-and-lifetime-mismatch.rs:24:24
   |
LL |     fn foo() -> Wrapper<impl Sized> {
   |                        ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
   |
LL |     fn foo() -> Wrapper<'static, impl Sized> {
   |                         ++++++++

error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
  --> $DIR/opaque-and-lifetime-mismatch.rs:4:17
   |
LL |     fn bar() -> Wrapper<impl Sized>;
   |                 ^^^^^^^ ---------- help: remove the unnecessary generic argument
   |                 |
   |                 expected 0 generic arguments
   |
note: struct defined here, with 0 generic parameters
  --> $DIR/opaque-and-lifetime-mismatch.rs:1:8
   |
LL | struct Wrapper<'rom>(&'rom ());
   |        ^^^^^^^

error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
  --> $DIR/opaque-and-lifetime-mismatch.rs:18:17
   |
LL |     fn foo() -> Wrapper<impl Sized>;
   |                 ^^^^^^^ ---------- help: remove the unnecessary generic argument
   |                 |
   |                 expected 0 generic arguments
   |
note: struct defined here, with 0 generic parameters
  --> $DIR/opaque-and-lifetime-mismatch.rs:1:8
   |
LL | struct Wrapper<'rom>(&'rom ());
   |        ^^^^^^^

error[E0053]: method `bar` has an incompatible return type for trait
  --> $DIR/opaque-and-lifetime-mismatch.rs:10:17
   |
LL |     fn bar() -> i32 {
   |                 ^^^
   |                 |
   |                 expected `Wrapper<'static>`, found `i32`
   |                 return type in trait

error[E0053]: method `bar` has an incompatible type for trait
  --> $DIR/opaque-and-lifetime-mismatch.rs:10:17
   |
LL |     fn bar() -> i32 {
   |                 ^^^ expected `Wrapper<'static>`, found `i32`
   |
note: type in trait
  --> $DIR/opaque-and-lifetime-mismatch.rs:4:17
   |
LL |     fn bar() -> Wrapper<impl Sized>;
   |                 ^^^^^^^^^^^^^^^^^^^
   = note: expected signature `fn() -> Wrapper<'static>`
              found signature `fn() -> i32`
help: change the output type to match the trait
   |
LL |     fn bar() -> Wrapper<'static> {
   |                 ~~~~~~~~~~~~~~~~

error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
  --> $DIR/opaque-and-lifetime-mismatch.rs:24:17
   |
LL |     fn foo() -> Wrapper<impl Sized> {
   |                 ^^^^^^^ ---------- help: remove the unnecessary generic argument
   |                 |
   |                 expected 0 generic arguments
   |
note: struct defined here, with 0 generic parameters
  --> $DIR/opaque-and-lifetime-mismatch.rs:1:8
   |
LL | struct Wrapper<'rom>(&'rom ());
   |        ^^^^^^^

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0053, E0106, E0107.
For more information about an error, try `rustc --explain E0053`.