@@ -239,6 +239,7 @@ use rustc::ty::{self, Const, Ty, TyCtxt, TypeFoldable};
239
239
240
240
use rustc:: mir:: interpret:: { truncate, AllocId , ConstValue , Pointer , Scalar } ;
241
241
use rustc:: mir:: Field ;
242
+ use rustc:: util:: captures:: Captures ;
242
243
use rustc:: util:: common:: ErrorReported ;
243
244
244
245
use syntax:: attr:: { SignedInt , UnsignedInt } ;
@@ -250,7 +251,7 @@ use smallvec::{smallvec, SmallVec};
250
251
use std:: cmp:: { self , max, min, Ordering } ;
251
252
use std:: convert:: TryInto ;
252
253
use std:: fmt;
253
- use std:: iter:: { self , FromIterator , IntoIterator } ;
254
+ use std:: iter:: { FromIterator , IntoIterator } ;
254
255
use std:: ops:: RangeInclusive ;
255
256
use std:: u128;
256
257
@@ -422,13 +423,7 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> {
422
423
}
423
424
424
425
/// 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 > {
432
427
self . 0 . iter ( ) . map ( |r| r. head ( ) )
433
428
}
434
429
@@ -1642,12 +1637,6 @@ struct MissingConstructors<'tcx> {
1642
1637
used_ctors : Vec < Constructor < ' tcx > > ,
1643
1638
}
1644
1639
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
-
1651
1640
impl < ' tcx > MissingConstructors < ' tcx > {
1652
1641
fn new (
1653
1642
tcx : TyCtxt < ' tcx > ,
@@ -1667,14 +1656,7 @@ impl<'tcx> MissingConstructors<'tcx> {
1667
1656
}
1668
1657
1669
1658
/// 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 > {
1678
1660
self . all_ctors . iter ( ) . flat_map ( move |req_ctor| {
1679
1661
req_ctor. clone ( ) . subtract_meta_constructor ( self . tcx , self . param_env , & self . used_ctors )
1680
1662
} )
0 commit comments