File: static-lifetime-tip-with-default-type.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 893,176 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; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (110 lines) | stat: -rw-r--r-- 4,667 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
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:7:24
   |
LL | struct Foo<T, K = i32>(&'static T, &'static K);
   |                        ^^^^^^^^^^
   |                        |
   |                        the parameter type `T` must be valid for the static lifetime...
   |                        ...so that the reference type `&'static T` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Foo<T: 'static, K = i32>(&'static T, &'static K);
   |             +++++++++

error[E0310]: the parameter type `K` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:7:36
   |
LL | struct Foo<T, K = i32>(&'static T, &'static K);
   |                                    ^^^^^^^^^^
   |                                    |
   |                                    the parameter type `K` must be valid for the static lifetime...
   |                                    ...so that the reference type `&'static K` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Foo<T, K: 'static = i32>(&'static T, &'static K);
   |                +++++++++

error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:11:28
   |
LL | struct Bar<r#T, r#K = i32>(&'static r#T, &'static r#K);
   |                            ^^^^^^^^^^^^
   |                            |
   |                            the parameter type `T` must be valid for the static lifetime...
   |                            ...so that the reference type `&'static T` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Bar<r#T: 'static, r#K = i32>(&'static r#T, &'static r#K);
   |               +++++++++

error[E0310]: the parameter type `K` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:11:42
   |
LL | struct Bar<r#T, r#K = i32>(&'static r#T, &'static r#K);
   |                                          ^^^^^^^^^^^^
   |                                          |
   |                                          the parameter type `K` must be valid for the static lifetime...
   |                                          ...so that the reference type `&'static K` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Bar<r#T, r#K: 'static = i32>(&'static r#T, &'static r#K);
   |                    +++++++++

error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:15:20
   |
LL | struct Boo<T= i32>(&'static T);
   |                    ^^^^^^^^^^
   |                    |
   |                    the parameter type `T` must be valid for the static lifetime...
   |                    ...so that the reference type `&'static T` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Boo<T: 'static= i32>(&'static T);
   |             +++++++++

error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:19:8
   |
LL | = i32>(&'static T);
   |        ^^^^^^^^^^
   |        |
   |        the parameter type `T` must be valid for the static lifetime...
   |        ...so that the reference type `&'static T` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct Far<T: 'static
   |             +++++++++

error[E0310]: the parameter type `K` may not live long enough
  --> $DIR/static-lifetime-tip-with-default-type.rs:22:27
   |
LL | struct S<'a, K: 'a = i32>(&'static K);
   |                           ^^^^^^^^^^
   |                           |
   |                           the parameter type `K` must be valid for the static lifetime...
   |                           ...so that the reference type `&'static K` does not outlive the data it points at
   |
help: consider adding an explicit lifetime bound
   |
LL | struct S<'a, K: 'a + 'static = i32>(&'static K);
   |                    +++++++++

error[E0392]: lifetime parameter `'a` is never used
  --> $DIR/static-lifetime-tip-with-default-type.rs:22:10
   |
LL | struct S<'a, K: 'a = i32>(&'static K);
   |          ^^ unused lifetime parameter
   |
   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0310, E0392.
For more information about an error, try `rustc --explain E0310`.