Let ctor_sub_tys return any Iterator they want

Since we always clone and allocate the types somewhere else ourselves,
no need to ask for `Cx` to do the allocation.
This commit is contained in:
Nadrieril 2024-01-24 16:55:26 +01:00
parent cd6d8f2a04
commit e088016f9d
4 changed files with 24 additions and 19 deletions

View file

@ -101,7 +101,11 @@ pub trait TypeCx: Sized + fmt::Debug {
/// The types of the fields for this constructor. The result must have a length of
/// `ctor_arity()`.
fn ctor_sub_tys(&self, ctor: &Constructor<Self>, ty: &Self::Ty) -> &[Self::Ty];
fn ctor_sub_tys<'a>(
&'a self,
ctor: &'a Constructor<Self>,
ty: &'a Self::Ty,
) -> impl Iterator<Item = Self::Ty> + ExactSizeIterator + Captures<'a>;
/// The set of all the constructors for `ty`.
///