@@ -34,6 +34,7 @@ use ty;
3434use ty:: subst:: { Subst , Substs } ;
3535use ty:: util:: { IntTypeExt , Discr } ;
3636use ty:: walk:: TypeWalker ;
37+ use util:: captures:: Captures ;
3738use util:: nodemap:: { NodeSet , DefIdMap , FxHashMap } ;
3839
3940use serialize:: { self , Encodable , Encoder } ;
@@ -1942,8 +1943,10 @@ impl<'a, 'gcx, 'tcx> AdtDef {
19421943 }
19431944
19441945 #[ inline]
1945- pub fn discriminants ( & ' a self , tcx : TyCtxt < ' a , ' gcx , ' tcx > )
1946- -> impl Iterator < Item =Discr < ' tcx > > + ' a {
1946+ pub fn discriminants (
1947+ & ' a self ,
1948+ tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
1949+ ) -> impl Iterator < Item =Discr < ' tcx > > + Captures < ' gcx > + ' a {
19471950 let repr_type = self . repr . discr_type ( ) ;
19481951 let initial = repr_type. initial_discriminant ( tcx. global_tcx ( ) ) ;
19491952 let mut prev_discr = None :: < Discr < ' tcx > > ;
@@ -2290,7 +2293,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
22902293 /// Returns an iterator of the def-ids for all body-owners in this
22912294 /// crate. If you would prefer to iterate over the bodies
22922295 /// themselves, you can do `self.hir.krate().body_ids.iter()`.
2293- pub fn body_owners ( self ) -> impl Iterator < Item = DefId > + ' a {
2296+ pub fn body_owners (
2297+ self ,
2298+ ) -> impl Iterator < Item = DefId > + Captures < ' tcx > + Captures < ' gcx > + ' a {
22942299 self . hir . krate ( )
22952300 . body_ids
22962301 . iter ( )
@@ -2394,11 +2399,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23942399 }
23952400 }
23962401
2397- #[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
2398- pub fn associated_items ( self , def_id : DefId )
2399- -> impl Iterator < Item = ty:: AssociatedItem > + ' a {
2402+ pub fn associated_items (
2403+ self ,
2404+ def_id : DefId ,
2405+ ) -> impl Iterator < Item = ty:: AssociatedItem > + ' a {
24002406 let def_ids = self . associated_item_def_ids ( def_id) ;
2401- ( 0 ..def_ids. len ( ) ) . map ( move |i| self . associated_item ( def_ids[ i] ) )
2407+ Box :: new ( ( 0 ..def_ids. len ( ) ) . map ( move |i| self . associated_item ( def_ids[ i] ) ) )
2408+ as Box < dyn Iterator < Item = ty:: AssociatedItem > + ' a >
24022409 }
24032410
24042411 /// Returns true if the impls are the same polarity and are implementing
0 commit comments