blob: 6fb514377a6c2a9ee2312d6fd3c01b7769e35e8a (
plain)
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
|
error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:15:5
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
| |
| the associated type `<T as Iter>::Item` must be valid for the static lifetime...
| ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | fn bad1<T: Iter>(v: T) -> Box<dyn X + 'static> where <T as Iter>::Item: 'static
| ++++++++++++++++++++++++++++++++
error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:22:5
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
| |
| the associated type `<T as Iter>::Item` must be valid for the static lifetime...
| ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | where Box<T::Item> : X, <T as Iter>::Item: 'static
| ++++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:28:5
|
LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
| -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | Box::new(item)
| ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a> where <T as Iter>::Item: 'a
| +++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:35:5
|
LL | fn bad4<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
| -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | Box::new(item)
| ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | where Box<T::Item> : X, <T as Iter>::Item: 'a
| +++++++++++++++++++++++
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0309, E0310.
For more information about an error, try `rustc --explain E0309`.
|