fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
2.2 KiB45 linesraw
1error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
2  --> $DIR/issue-55796.rs:16:9
3   |
4LL |         Box::new(self.out_edges(u).map(|e| e.target()))
5   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7note: first, the lifetime cannot outlive the lifetime `'a` as defined on the trait at 5:17...
8  --> $DIR/issue-55796.rs:5:17
9   |
10LL | pub trait Graph<'a> {
11   |                 ^^
12note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:16:40: 16:54]>` will meet its required lifetime bounds
13  --> $DIR/issue-55796.rs:16:9
14   |
15LL |         Box::new(self.out_edges(u).map(|e| e.target()))
16   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17   = note: but, the lifetime must be valid for the static lifetime...
18   = note: ...so that the expression is assignable:
19           expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>
20              found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>
21
22error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
23  --> $DIR/issue-55796.rs:21:9
24   |
25LL |         Box::new(self.in_edges(u).map(|e| e.target()))
26   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27   |
28note: first, the lifetime cannot outlive the lifetime `'a` as defined on the trait at 5:17...
29  --> $DIR/issue-55796.rs:5:17
30   |
31LL | pub trait Graph<'a> {
32   |                 ^^
33note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closure@$DIR/issue-55796.rs:21:39: 21:53]>` will meet its required lifetime bounds
34  --> $DIR/issue-55796.rs:21:9
35   |
36LL |         Box::new(self.in_edges(u).map(|e| e.target()))
37   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38   = note: but, the lifetime must be valid for the static lifetime...
39   = note: ...so that the expression is assignable:
40           expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>
41              found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>
42
43error: aborting due to 2 previous errors
44
45For more information about this error, try `rustc --explain E0495`.