Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for partial existentials in TAIT #69323

Closed
CAD97 opened this issue Feb 20, 2020 · 1 comment · Fixed by #86859
Closed

Support for partial existentials in TAIT #69323

CAD97 opened this issue Feb 20, 2020 · 1 comment · Fixed by #86859
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@CAD97
Copy link
Contributor

CAD97 commented Feb 20, 2020

[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.

@CAD97 CAD97 added the C-bug Category: This is a bug. label Feb 20, 2020
@Centril Centril added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2020
RalfJung added a commit to RalfJung/rust that referenced this issue Jun 11, 2020
…=nikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc rust-lang#69323
cc rust-lang#63063
Closes rust-lang#57188
Closes rust-lang#62988
Closes rust-lang#69136
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 15, 2020
…ikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc rust-lang#69323
cc rust-lang#63063
Closes rust-lang#57188
Closes rust-lang#62988
Closes rust-lang#69136
Closes rust-lang#73061
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 23, 2020
…ikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc rust-lang#69323
cc rust-lang#63063
Closes rust-lang#57188
Closes rust-lang#62988
Closes rust-lang#69136
Closes rust-lang#73061
@jackh726
Copy link
Member

jackh726 commented Feb 4, 2021

Works on master

@jackh726 jackh726 added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. requires-nightly This issue requires a nightly compiler in some way. labels Feb 4, 2021
@jackh726 jackh726 added F-min_type_alias_impl_trait and removed F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` labels Jun 29, 2021
@bors bors closed this as completed in d3244e2 Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants