Skip to content

Support for partial existentials in TAIT #69323

Closed
@CAD97

Description

@CAD97

[playground] (Tracking issue)

With RPIT, it is possible to create a "partial existential":

fn test1<A: Iterator<Item=&'static str>>(x: A)
    -> Chain<A, impl Iterator<Item=&'static str>>
{
    x.chain(once(","))
}

With TAIT, however, this currently produces an error:

type Chained<A> = Chain<A, impl Iterator<Item=&'static str>>;
fn test2<A: Iterator<Item=&'static str>>(x: A) -> Chained<A> {
    x.chain(once(","))
}

This should probably be possible, both for concept parity for factoring unnamed RPIT out into named TAIT, and because this "partial existential" allows parameterizing partial existentials over input types in a way that allows input-type-dependent trait implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions