fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
4.7 KiB126 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:33
65   |
66LL |     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
67   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68   |
69note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
70  --> $DIR/issue-20831-debruijn.rs:28:5
71   |
72LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
73LL | |         // Not obvious, but there is an implicit lifetime here -------^
74LL | |
75LL | |
76...  |
77LL | |         self.sub = t;
78LL | |     }
79   | |_____^
80note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6...
81  --> $DIR/issue-20831-debruijn.rs:26:6
82   |
83LL | impl<'a> Publisher<'a> for MyStruct<'a> {
84   |      ^^
85note: ...so that the types are compatible
86  --> $DIR/issue-20831-debruijn.rs:28:33
87   |
88LL |     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
89   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90   = note: expected  `Publisher<'_>`
91              found  `Publisher<'_>`
92
93error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
94  --> $DIR/issue-20831-debruijn.rs:28:33
95   |
96LL |     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
97   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98   |
99note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
100  --> $DIR/issue-20831-debruijn.rs:28:5
101   |
102LL | /     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
103LL | |         // Not obvious, but there is an implicit lifetime here -------^
104LL | |
105LL | |
106...  |
107LL | |         self.sub = t;
108LL | |     }
109   | |_____^
110note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6...
111  --> $DIR/issue-20831-debruijn.rs:26:6
112   |
113LL | impl<'a> Publisher<'a> for MyStruct<'a> {
114   |      ^^
115note: ...so that the types are compatible
116  --> $DIR/issue-20831-debruijn.rs:28:33
117   |
118LL |     fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
119   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120   = note: expected  `Publisher<'_>`
121              found  `Publisher<'_>`
122
123error: aborting due to 4 previous errors
124
125Some errors have detailed explanations: E0308, E0495.
126For more information about an error, try `rustc --explain E0308`.