Skip to content

Min TAIT + GAT lifetime issue #86218

Closed
@ivan770

Description

@ivan770

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

Activity

ivan770

ivan770 commented on Jun 13, 2021

@ivan770
Author

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

added
A-lifetimesArea: Lifetimes / regions
requires-nightlyThis issue requires a nightly compiler in some way.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Jun 13, 2021
b-naber

b-naber commented on Jun 16, 2021

@b-naber
Contributor

@rustbot claim

jackh726

jackh726 commented on Oct 23, 2021

@jackh726
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

jackh726 commented on Oct 23, 2021

@jackh726
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

jackh726 commented on Oct 23, 2021

@jackh726
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.

added
GATs-triagedIssues using the `generic_associated_types` feature that have been triaged
on Oct 23, 2021
oli-obk

oli-obk commented on Mar 31, 2022

@oli-obk
Contributor

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

moved this from Todo to In Progress in type alias impl trait stabilizationon Sep 9, 2022
added a commit that references this issue on Sep 25, 2022

Auto merge of rust-lang#95474 - oli-obk:tait_ub, r=jackh726

f5193a9
Repository owner moved this from In Progress to Done in type alias impl trait stabilizationon Sep 25, 2022
added
A-GATsArea: Generic associated types (GATs)
on Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-GATsArea: Generic associated types (GATs)A-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsF-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`GATs-triagedIssues using the `generic_associated_types` feature that have been triagedT-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

Status

Done

Milestone

No milestone

Relationships

None yet

    Participants

    @oli-obk@ivan770@fmease@jackh726@rustbot

    Issue actions

      Min TAIT + GAT lifetime issue · Issue #86218 · rust-lang/rust