@@ -239,6 +239,7 @@ use rustc::ty::{self, Const, Ty, TyCtxt, TypeFoldable};
239239
240240use rustc:: mir:: interpret:: { truncate, AllocId , ConstValue , Pointer , Scalar } ;
241241use rustc:: mir:: Field ;
242+ use rustc:: util:: captures:: Captures ;
242243use rustc:: util:: common:: ErrorReported ;
243244
244245use syntax:: attr:: { SignedInt , UnsignedInt } ;
@@ -250,7 +251,7 @@ use smallvec::{smallvec, SmallVec};
250251use std:: cmp:: { self , max, min, Ordering } ;
251252use std:: convert:: TryInto ;
252253use std:: fmt;
253- use std:: iter:: { self , FromIterator , IntoIterator } ;
254+ use std:: iter:: { FromIterator , IntoIterator } ;
254255use std:: ops:: RangeInclusive ;
255256use std:: u128;
256257
@@ -422,13 +423,7 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> {
422423 }
423424
424425 /// Iterate over the first component of each row
425- // Can't return impl Iterator because of hidden lifetime capture.
426- fn heads < ' a > (
427- & ' a self ,
428- ) -> iter:: Map <
429- std:: slice:: Iter < ' a , PatStack < ' p , ' tcx > > ,
430- impl FnMut ( & ' a PatStack < ' p , ' tcx > ) -> & ' p Pat < ' tcx > ,
431- > {
426+ fn heads < ' a > ( & ' a self ) -> impl Iterator < Item = & ' a Pat < ' tcx > > + Captures < ' p > {
432427 self . 0 . iter ( ) . map ( |r| r. head ( ) )
433428 }
434429
@@ -1642,12 +1637,6 @@ struct MissingConstructors<'tcx> {
16421637 used_ctors : Vec < Constructor < ' tcx > > ,
16431638}
16441639
1645- type MissingConstructorsIter < ' a , ' tcx , F > = std:: iter:: FlatMap <
1646- std:: slice:: Iter < ' a , Constructor < ' tcx > > ,
1647- SmallVec < [ Constructor < ' tcx > ; 1 ] > ,
1648- F ,
1649- > ;
1650-
16511640impl < ' tcx > MissingConstructors < ' tcx > {
16521641 fn new (
16531642 tcx : TyCtxt < ' tcx > ,
@@ -1667,14 +1656,7 @@ impl<'tcx> MissingConstructors<'tcx> {
16671656 }
16681657
16691658 /// Iterate over all_ctors \ used_ctors
1670- // Can't use impl Iterator because of lifetime shenanigans
1671- fn iter < ' a > (
1672- & ' a self ,
1673- ) -> MissingConstructorsIter <
1674- ' a ,
1675- ' tcx ,
1676- impl FnMut ( & ' a Constructor < ' tcx > ) -> SmallVec < [ Constructor < ' tcx > ; 1 ] > ,
1677- > {
1659+ fn iter < ' a > ( & ' a self ) -> impl Iterator < Item = Constructor < ' tcx > > + Captures < ' a > {
16781660 self . all_ctors . iter ( ) . flat_map ( move |req_ctor| {
16791661 req_ctor. clone ( ) . subtract_meta_constructor ( self . tcx , self . param_env , & self . used_ctors )
16801662 } )
0 commit comments