@@ -9,18 +9,21 @@ pub struct CompoundReducer<'op, A: ConfigurableProgramAnalysis, B: ConfigurableP
99 b : B :: Reducer < ' op > ,
1010}
1111
12- impl < ' op , A : ConfigurableProgramAnalysis , B : ConfigurableProgramAnalysis >
13- Residue < ' op , CompoundState2 < A :: State , B :: State > > for CompoundReducer < ' op , A , B >
12+ impl < ' r , A : ConfigurableProgramAnalysis , B : ConfigurableProgramAnalysis >
13+ Residue < CompoundState2 < A :: State , B :: State > > for CompoundReducer < ' r , A , B >
14+ where
15+ A :: Reducer < ' r > : Residue < A :: State > ,
16+ B :: Reducer < ' r > : Residue < B :: State > ,
1417{
1518 type Output = (
16- <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: Output ,
17- <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: Output ,
19+ <A :: Reducer < ' r > as Residue < A :: State > >:: Output ,
20+ <B :: Reducer < ' r > as Residue < B :: State > >:: Output ,
1821 ) ;
1922
2023 fn new ( ) -> Self {
2124 Self {
22- a : <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: new ( ) ,
23- b : <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: new ( ) ,
25+ a : <A :: Reducer < ' r > as Residue < A :: State > >:: new ( ) ,
26+ b : <B :: Reducer < ' r > as Residue < B :: State > >:: new ( ) ,
2427 }
2528 }
2629
@@ -29,7 +32,9 @@ impl<'op, A: ConfigurableProgramAnalysis, B: ConfigurableProgramAnalysis>
2932 ( a. finalize ( ) , b. finalize ( ) )
3033 }
3134
32- fn merged_state (
35+ // Method-level op lifetime is `'op`; it is late-bound by the trait and
36+ // is independent from the impl's `'r` lifetime parameter.
37+ fn merged_state < ' op > (
3338 & mut self ,
3439 curr_state : & CompoundState2 < A :: State , B :: State > ,
3540 dest_state : & CompoundState2 < A :: State , B :: State > ,
@@ -42,7 +47,7 @@ impl<'op, A: ConfigurableProgramAnalysis, B: ConfigurableProgramAnalysis>
4247 . merged_state ( & curr_state. s2 , & dest_state. s2 , & merged_state. s2 , op) ;
4348 }
4449
45- fn new_state (
50+ fn new_state < ' op > (
4651 & mut self ,
4752 state : & CompoundState2 < A :: State , B :: State > ,
4853 dest_state : & CompoundState2 < A :: State , B :: State > ,
@@ -59,18 +64,21 @@ pub struct CompoundReducer2<'op, A: ConfigurableProgramAnalysis, B: Configurable
5964 b : B :: Reducer < ' op > ,
6065}
6166
62- impl < ' op , A : ConfigurableProgramAnalysis , B : ConfigurableProgramAnalysis >
63- Residue < ' op , CompoundState2 < A :: State , B :: State > > for CompoundReducer2 < ' op , A , B >
67+ impl < ' r , A : ConfigurableProgramAnalysis , B : ConfigurableProgramAnalysis >
68+ Residue < CompoundState2 < A :: State , B :: State > > for CompoundReducer2 < ' r , A , B >
69+ where
70+ A :: Reducer < ' r > : Residue < A :: State > ,
71+ B :: Reducer < ' r > : Residue < B :: State > ,
6472{
6573 type Output = (
66- <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: Output ,
67- <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: Output ,
74+ <A :: Reducer < ' r > as Residue < A :: State > >:: Output ,
75+ <B :: Reducer < ' r > as Residue < B :: State > >:: Output ,
6876 ) ;
6977
7078 fn new ( ) -> Self {
7179 Self {
72- a : <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: new ( ) ,
73- b : <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: new ( ) ,
80+ a : <A :: Reducer < ' r > as Residue < A :: State > >:: new ( ) ,
81+ b : <B :: Reducer < ' r > as Residue < B :: State > >:: new ( ) ,
7482 }
7583 }
7684
@@ -79,7 +87,7 @@ impl<'op, A: ConfigurableProgramAnalysis, B: ConfigurableProgramAnalysis>
7987 ( a. finalize ( ) , b. finalize ( ) )
8088 }
8189
82- fn merged_state (
90+ fn merged_state < ' op > (
8391 & mut self ,
8492 curr_state : & CompoundState2 < A :: State , B :: State > ,
8593 dest_state : & CompoundState2 < A :: State , B :: State > ,
@@ -92,7 +100,7 @@ impl<'op, A: ConfigurableProgramAnalysis, B: ConfigurableProgramAnalysis>
92100 . merged_state ( & curr_state. s2 , & dest_state. s2 , & merged_state. s2 , op) ;
93101 }
94102
95- fn new_state (
103+ fn new_state < ' op > (
96104 & mut self ,
97105 state : & CompoundState2 < A :: State , B :: State > ,
98106 dest_state : & CompoundState2 < A :: State , B :: State > ,
@@ -116,23 +124,27 @@ pub struct CompoundReducer3<
116124}
117125
118126impl <
119- ' op ,
127+ ' r ,
120128 A : ConfigurableProgramAnalysis ,
121129 B : ConfigurableProgramAnalysis ,
122130 C : ConfigurableProgramAnalysis ,
123- > Residue < ' op , CompoundState3 < A :: State , B :: State , C :: State > > for CompoundReducer3 < ' op , A , B , C >
131+ > Residue < CompoundState3 < A :: State , B :: State , C :: State > > for CompoundReducer3 < ' r , A , B , C >
132+ where
133+ A :: Reducer < ' r > : Residue < A :: State > ,
134+ B :: Reducer < ' r > : Residue < B :: State > ,
135+ C :: Reducer < ' r > : Residue < C :: State > ,
124136{
125137 type Output = (
126- <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: Output ,
127- <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: Output ,
128- <C :: Reducer < ' op > as Residue < ' op , C :: State > >:: Output ,
138+ <A :: Reducer < ' r > as Residue < A :: State > >:: Output ,
139+ <B :: Reducer < ' r > as Residue < B :: State > >:: Output ,
140+ <C :: Reducer < ' r > as Residue < C :: State > >:: Output ,
129141 ) ;
130142
131143 fn new ( ) -> Self {
132144 Self {
133- a : <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: new ( ) ,
134- b : <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: new ( ) ,
135- c : <C :: Reducer < ' op > as Residue < ' op , C :: State > >:: new ( ) ,
145+ a : <A :: Reducer < ' r > as Residue < A :: State > >:: new ( ) ,
146+ b : <B :: Reducer < ' r > as Residue < B :: State > >:: new ( ) ,
147+ c : <C :: Reducer < ' r > as Residue < C :: State > >:: new ( ) ,
136148 }
137149 }
138150
@@ -141,7 +153,7 @@ impl<
141153 ( a. finalize ( ) , b. finalize ( ) , c. finalize ( ) )
142154 }
143155
144- fn merged_state (
156+ fn merged_state < ' op > (
145157 & mut self ,
146158 curr_state : & CompoundState3 < A :: State , B :: State , C :: State > ,
147159 dest_state : & CompoundState3 < A :: State , B :: State , C :: State > ,
@@ -156,7 +168,7 @@ impl<
156168 . merged_state ( & curr_state. s3 , & dest_state. s3 , & merged_state. s3 , op) ;
157169 }
158170
159- fn new_state (
171+ fn new_state < ' op > (
160172 & mut self ,
161173 state : & CompoundState3 < A :: State , B :: State , C :: State > ,
162174 dest_state : & CompoundState3 < A :: State , B :: State , C :: State > ,
@@ -183,27 +195,32 @@ pub struct CompoundReducer4<
183195}
184196
185197impl <
186- ' op ,
198+ ' r ,
187199 A : ConfigurableProgramAnalysis ,
188200 B : ConfigurableProgramAnalysis ,
189201 C : ConfigurableProgramAnalysis ,
190202 D : ConfigurableProgramAnalysis ,
191- > Residue < ' op , CompoundState4 < A :: State , B :: State , C :: State , D :: State > >
192- for CompoundReducer4 < ' op , A , B , C , D >
203+ > Residue < CompoundState4 < A :: State , B :: State , C :: State , D :: State > >
204+ for CompoundReducer4 < ' r , A , B , C , D >
205+ where
206+ A :: Reducer < ' r > : Residue < A :: State > ,
207+ B :: Reducer < ' r > : Residue < B :: State > ,
208+ C :: Reducer < ' r > : Residue < C :: State > ,
209+ D :: Reducer < ' r > : Residue < D :: State > ,
193210{
194211 type Output = (
195- <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: Output ,
196- <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: Output ,
197- <C :: Reducer < ' op > as Residue < ' op , C :: State > >:: Output ,
198- <D :: Reducer < ' op > as Residue < ' op , D :: State > >:: Output ,
212+ <A :: Reducer < ' r > as Residue < A :: State > >:: Output ,
213+ <B :: Reducer < ' r > as Residue < B :: State > >:: Output ,
214+ <C :: Reducer < ' r > as Residue < C :: State > >:: Output ,
215+ <D :: Reducer < ' r > as Residue < D :: State > >:: Output ,
199216 ) ;
200217
201218 fn new ( ) -> Self {
202219 Self {
203- a : <A :: Reducer < ' op > as Residue < ' op , A :: State > >:: new ( ) ,
204- b : <B :: Reducer < ' op > as Residue < ' op , B :: State > >:: new ( ) ,
205- c : <C :: Reducer < ' op > as Residue < ' op , C :: State > >:: new ( ) ,
206- d : <D :: Reducer < ' op > as Residue < ' op , D :: State > >:: new ( ) ,
220+ a : <A :: Reducer < ' r > as Residue < A :: State > >:: new ( ) ,
221+ b : <B :: Reducer < ' r > as Residue < B :: State > >:: new ( ) ,
222+ c : <C :: Reducer < ' r > as Residue < C :: State > >:: new ( ) ,
223+ d : <D :: Reducer < ' r > as Residue < D :: State > >:: new ( ) ,
207224 }
208225 }
209226
@@ -212,7 +229,7 @@ impl<
212229 ( a. finalize ( ) , b. finalize ( ) , c. finalize ( ) , d. finalize ( ) )
213230 }
214231
215- fn merged_state (
232+ fn merged_state < ' op > (
216233 & mut self ,
217234 curr_state : & CompoundState4 < A :: State , B :: State , C :: State , D :: State > ,
218235 dest_state : & CompoundState4 < A :: State , B :: State , C :: State , D :: State > ,
@@ -229,7 +246,7 @@ impl<
229246 . merged_state ( & curr_state. s4 , & dest_state. s4 , & merged_state. s4 , op) ;
230247 }
231248
232- fn new_state (
249+ fn new_state < ' op > (
233250 & mut self ,
234251 state : & CompoundState4 < A :: State , B :: State , C :: State , D :: State > ,
235252 dest_state : & CompoundState4 < A :: State , B :: State , C :: State , D :: State > ,
0 commit comments