Make gen blocks implement the Iterator trait
This commit is contained in:
@@ -297,6 +297,17 @@ pub fn future_trait_ref_and_outputs<'tcx>(
|
||||
sig.map_bound(|sig| (trait_ref, sig.return_ty))
|
||||
}
|
||||
|
||||
pub fn iterator_trait_ref_and_outputs<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
iterator_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
sig: ty::PolyGenSig<'tcx>,
|
||||
) -> ty::Binder<'tcx, (ty::TraitRef<'tcx>, Ty<'tcx>)> {
|
||||
assert!(!self_ty.has_escaping_bound_vars());
|
||||
let trait_ref = ty::TraitRef::new(tcx, iterator_def_id, [self_ty]);
|
||||
sig.map_bound(|sig| (trait_ref, sig.yield_ty))
|
||||
}
|
||||
|
||||
pub fn impl_item_is_final(tcx: TyCtxt<'_>, assoc_item: &ty::AssocItem) -> bool {
|
||||
assoc_item.defaultness(tcx).is_final()
|
||||
&& tcx.defaultness(assoc_item.container_id(tcx)).is_final()
|
||||
|
||||
Reference in New Issue
Block a user