File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -185,3 +185,42 @@ pub mod issue11635 {
185185 }
186186 }
187187}
188+
189+ pub mod issue12964 {
190+ pub struct MyIter < ' a , T : ' a > {
191+ iter : std:: slice:: Iter < ' a , T > ,
192+ }
193+
194+ impl < ' a , T > Iterator for MyIter < ' a , T > {
195+ type Item = & ' a T ;
196+
197+ fn next ( & mut self ) -> Option < Self :: Item > {
198+ self . iter . next ( )
199+ }
200+ }
201+
202+ pub struct MyContainer < T > {
203+ inner : Vec < T > ,
204+ }
205+
206+ impl < T > MyContainer < T > { }
207+
208+ impl < T > MyContainer < T > {
209+ #[ must_use]
210+ pub fn iter ( & self ) -> MyIter < ' _ , T > {
211+ <& Self as IntoIterator >:: into_iter ( self )
212+ }
213+ }
214+
215+ impl < ' a , T > IntoIterator for & ' a MyContainer < T > {
216+ type Item = & ' a T ;
217+
218+ type IntoIter = MyIter < ' a , T > ;
219+
220+ fn into_iter ( self ) -> Self :: IntoIter {
221+ Self :: IntoIter {
222+ iter : self . inner . as_slice ( ) . iter ( ) ,
223+ }
224+ }
225+ }
226+ }
You can’t perform that action at this time.
0 commit comments