fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
3.5 KiB108 linesraw
1error[E0308]: mismatched types
2  --> $DIR/issue-20831-debruijn.rs:28:5
3   |
4LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
5LL | |         // Not obvious, but there is an implicit lifetime here -------^
6LL | |
7LL | |
8...  |
9LL | |         self.sub = t;
10LL | |     }
11   | |_____^ lifetime mismatch
12   |
13   = note: expected type `'a`
14              found type `'_`
15note: the anonymous lifetime #2 defined on the method body at 28:5...
16  --> $DIR/issue-20831-debruijn.rs:28:5
17   |
18LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
19LL | |         // Not obvious, but there is an implicit lifetime here -------^
20LL | |
21LL | |
22...  |
23LL | |         self.sub = t;
24LL | |     }
25   | |_____^
26note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 26:6
27  --> $DIR/issue-20831-debruijn.rs:26:6
28   |
29LL | impl<'a> Publisher<'a> for MyStruct<'a> {
30   |      ^^
31
32error[E0308]: mismatched types
33  --> $DIR/issue-20831-debruijn.rs:28:5
34   |
35LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
36LL | |         // Not obvious, but there is an implicit lifetime here -------^
37LL | |
38LL | |
39...  |
40LL | |         self.sub = t;
41LL | |     }
42   | |_____^ lifetime mismatch
43   |
44   = note: expected type `'a`
45              found type `'_`
46note: the lifetime `'a` as defined on the impl at 26:6...
47  --> $DIR/issue-20831-debruijn.rs:26:6
48   |
49LL | impl<'a> Publisher<'a> for MyStruct<'a> {
50   |      ^^
51note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 28:5
52  --> $DIR/issue-20831-debruijn.rs:28:5
53   |
54LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
55LL | |         // Not obvious, but there is an implicit lifetime here -------^
56LL | |
57LL | |
58...  |
59LL | |         self.sub = t;
60LL | |     }
61   | |_____^
62
63error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
64  --> $DIR/issue-20831-debruijn.rs:28:5
65   |
66LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
67LL | |         // Not obvious, but there is an implicit lifetime here -------^
68LL | |
69LL | |
70...  |
71LL | |         self.sub = t;
72LL | |     }
73   | |_____^
74   |
75note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
76  --> $DIR/issue-20831-debruijn.rs:28:5
77   |
78LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
79LL | |         // Not obvious, but there is an implicit lifetime here -------^
80LL | |
81LL | |
82...  |
83LL | |         self.sub = t;
84LL | |     }
85   | |_____^
86note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6...
87  --> $DIR/issue-20831-debruijn.rs:26:6
88   |
89LL | impl<'a> Publisher<'a> for MyStruct<'a> {
90   |      ^^
91note: ...so that the types are compatible
92  --> $DIR/issue-20831-debruijn.rs:28:5
93   |
94LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
95LL | |         // Not obvious, but there is an implicit lifetime here -------^
96LL | |
97LL | |
98...  |
99LL | |         self.sub = t;
100LL | |     }
101   | |_____^
102   = note: expected  `Publisher<'_>`
103              found  `Publisher<'_>`
104
105error: aborting due to 3 previous errors
106
107Some errors have detailed explanations: E0308, E0495.
108For more information about an error, try `rustc --explain E0308`.