File: hidden-type-suggestion.stderr

package info (click to toggle)
rustc 1.86.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 913,560 kB
  • sloc: xml: 158,127; python: 35,921; javascript: 19,689; sh: 19,600; cpp: 18,906; ansic: 13,124; asm: 4,376; makefile: 708; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (111 lines) | stat: -rw-r--r-- 4,846 bytes parent folder | download | duplicates (4)
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
110
111
error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:3:5
   |
LL | fn lifetime<'a, 'b>(x: &'a ()) -> impl Sized + use<'b> {
   |             --                    -------------------- opaque type defined here
   |             |
   |             hidden type `&'a ()` captures the lifetime `'a` as defined here
LL |
LL |     x
   |     ^
   |
help: add `'a` to the `use<...>` bound to explicitly capture it
   |
LL | fn lifetime<'a, 'b>(x: &'a ()) -> impl Sized + use<'b, 'a> {
   |                                                      ++++

error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:9:5
   |
LL | fn param<'a, T>(x: &'a ()) -> impl Sized + use<T> {
   |          --                   ------------------- opaque type defined here
   |          |
   |          hidden type `&'a ()` captures the lifetime `'a` as defined here
LL |
LL |     x
   |     ^
   |
help: add `'a` to the `use<...>` bound to explicitly capture it
   |
LL | fn param<'a, T>(x: &'a ()) -> impl Sized + use<'a, T> {
   |                                                +++

error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:15:5
   |
LL | fn empty<'a>(x: &'a ()) -> impl Sized + use<> {
   |          --                ------------------ opaque type defined here
   |          |
   |          hidden type `&'a ()` captures the lifetime `'a` as defined here
LL |
LL |     x
   |     ^
   |
help: add `'a` to the `use<...>` bound to explicitly capture it
   |
LL | fn empty<'a>(x: &'a ()) -> impl Sized + use<'a> {
   |                                             ++

error[E0700]: hidden type for `impl Captures<'captured>` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:24:5
   |
LL | fn missing<'a, 'captured, 'not_captured, Captured>(x: &'a ()) -> impl Captures<'captured> {
   |            --                                                    ------------------------ opaque type defined here
   |            |
   |            hidden type `&'a ()` captures the lifetime `'a` as defined here
LL |
LL |     x
   |     ^
   |
help: add a `use<...>` bound to explicitly capture `'a`
   |
LL | fn missing<'a, 'captured, 'not_captured, Captured>(x: &'a ()) -> impl Captures<'captured> + use<'captured, 'a, Captured> {
   |                                                                                           ++++++++++++++++++++++++++++++

error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:30:5
   |
LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized {
   |                                    ---     ---------- opaque type defined here
   |                                    |
   |                                    hidden type `&()` captures the anonymous lifetime defined here
LL |
LL |     y
   |     ^
   |
note: you could use a `use<...>` bound to explicitly capture `'_`, but argument-position `impl Trait`s are not nameable
  --> $DIR/hidden-type-suggestion.rs:28:21
   |
LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized {
   |                     ^^^^^^^^^^
help: add a `use<...>` bound to explicitly capture `'_` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate
   |
LL - fn no_params_yet(_: impl Sized, y: &()) -> impl Sized {
LL + fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> {
   |

error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
  --> $DIR/hidden-type-suggestion.rs:36:5
   |
LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized {
   |                   --                                  ---------- opaque type defined here
   |                   |
   |                   hidden type `&'a ()` captures the lifetime `'a` as defined here
LL |
LL |     y
   |     ^
   |
note: you could use a `use<...>` bound to explicitly capture `'a`, but argument-position `impl Trait`s are not nameable
  --> $DIR/hidden-type-suggestion.rs:34:29
   |
LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized {
   |                             ^^^^^^^^^^
help: add a `use<...>` bound to explicitly capture `'a` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate
   |
LL - fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized {
LL + fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> {
   |

error: aborting due to 6 previous errors

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