fork/rust

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

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

1.42.0
4.9 KiB150 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[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
106  --> $DIR/issue-20831-debruijn.rs:28:5
107   |
108LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
109LL | |         // Not obvious, but there is an implicit lifetime here -------^
110LL | |
111LL | |
112...  |
113LL | |         self.sub = t;
114LL | |     }
115   | |_____^
116   |
117note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
118  --> $DIR/issue-20831-debruijn.rs:28:5
119   |
120LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
121LL | |         // Not obvious, but there is an implicit lifetime here -------^
122LL | |
123LL | |
124...  |
125LL | |         self.sub = t;
126LL | |     }
127   | |_____^
128note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6...
129  --> $DIR/issue-20831-debruijn.rs:26:6
130   |
131LL | impl<'a> Publisher<'a> for MyStruct<'a> {
132   |      ^^
133note: ...so that the types are compatible
134  --> $DIR/issue-20831-debruijn.rs:28:5
135   |
136LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
137LL | |         // Not obvious, but there is an implicit lifetime here -------^
138LL | |
139LL | |
140...  |
141LL | |         self.sub = t;
142LL | |     }
143   | |_____^
144   = note: expected  `Publisher<'_>`
145              found  `Publisher<'_>`
146
147error: aborting due to 4 previous errors
148
149Some errors have detailed explanations: E0308, E0495.
150For more information about an error, try `rustc --explain E0308`.