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

Min TAIT + GAT lifetime issue #86218

Closed
ivan770 opened this issue Jun 11, 2021 · 6 comments · Fixed by #95474
Closed

Min TAIT + GAT lifetime issue #86218

ivan770 opened this issue Jun 11, 2021 · 6 comments · Fixed by #95474
Assignees
Labels
A-GATs Area: Generic associated types (GATs) A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` GATs-triaged Issues using the `generic_associated_types` feature that have been triaged 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

@ivan770
Copy link

ivan770 commented Jun 11, 2021

I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=71e56b49edea6de440eed3a417322308

Code that is an equivalent to the one above, but that compiles: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f071b171eda8921c1d4902999417594d

I'm not sure about the exact reason for this to happen, but I can suspect the presence of an additional lifetime in impl block that is causing this bug.

I expected to see this happen: It compiles

Instead, this happened: Lifetime error

Meta

rustc --version --verbose: Latest playground version

@ivan770 ivan770 added the C-bug Category: This is a bug. label Jun 11, 2021
@ivan770
Copy link
Author

ivan770 commented Jun 13, 2021

@rustbot label +T-compiler +F-type_alias_impl_trait +F-generic_associated_types +A-lifetimes +requires-nightly

@rustbot rustbot added A-lifetimes Area: Lifetimes / regions F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` 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. labels Jun 13, 2021
@b-naber
Copy link
Contributor

b-naber commented Jun 16, 2021

@rustbot claim

@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
@jackh726
Copy link
Member

Updated and minimized example:

#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]

pub trait Stream {
    type Item;
}

impl Stream for () {
    type Item = i32;
}

trait Yay<AdditionalValue> {
    type InnerStream<'s>: Stream<Item = i32> + 's;
    fn foo<'s>() -> Self::InnerStream<'s>;
}

impl<'a> Yay<&'a ()> for () {
    type InnerStream<'s> = impl Stream<Item = i32> + 's;
    fn foo<'s>() -> Self::InnerStream<'s> { todo!() }
}

@jackh726
Copy link
Member

Yeah, so somehow 'a is ending up in the substs for the opaque type impl Stream<Item = i32> + 's, and that isn't able to be proven.

@jackh726
Copy link
Member

GATs issue triage: not blocking. This requires the type_alias_impl_trait feature and seems to revolve around the substs for them, rather than a GATs issue.

@jackh726 jackh726 added the GATs-triaged Issues using the `generic_associated_types` feature that have been triaged label Oct 23, 2021
@jackh726 jackh726 added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` and removed F-min_type_alias_impl_trait labels Mar 9, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Mar 31, 2022

@b-naber this issue has been fixed as a side effect of #95474

@oli-obk oli-obk moved this from Todo to In Progress in type alias impl trait stabilization Sep 9, 2022
@bors bors closed this as completed in f5193a9 Sep 25, 2022
Repository owner moved this from In Progress to Done in type alias impl trait stabilization Sep 25, 2022
@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` GATs-triaged Issues using the `generic_associated_types` feature that have been triaged 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.
Development

Successfully merging a pull request may close this issue.

6 participants