fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
2.5 KiB53 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...
18note: ...so that the expression is assignable
19  --> $DIR/issue-55796.rs:16:9
20   |
21LL |         Box::new(self.out_edges(u).map(|e| e.target()))
22   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23   = note: expected  `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
24              found  `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
25
26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
27  --> $DIR/issue-55796.rs:21:9
28   |
29LL |         Box::new(self.in_edges(u).map(|e| e.target()))
30   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31   |
32note: first, the lifetime cannot outlive the lifetime `'a` as defined on the trait at 5:17...
33  --> $DIR/issue-55796.rs:5:17
34   |
35LL | pub trait Graph<'a> {
36   |                 ^^
37note: ...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
38  --> $DIR/issue-55796.rs:21:9
39   |
40LL |         Box::new(self.in_edges(u).map(|e| e.target()))
41   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42   = note: but, the lifetime must be valid for the static lifetime...
43note: ...so that the expression is assignable
44  --> $DIR/issue-55796.rs:21:9
45   |
46LL |         Box::new(self.in_edges(u).map(|e| e.target()))
47   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48   = note: expected  `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
49              found  `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
50
51error: aborting due to 2 previous errors
52
53For more information about this error, try `rustc --explain E0495`.