fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
3.1 KiB97 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   |      ^^
91   = note: ...so that the types are compatible:
92           expected Publisher<'_>
93              found Publisher<'_>
94
95error: aborting due to 3 previous errors
96
97For more information about this error, try `rustc --explain E0308`.