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

regression with the new opaque type generics #122307

Closed
aliemjay opened this issue Mar 10, 2024 · 3 comments · Fixed by #116891
Closed

regression with the new opaque type generics #122307

aliemjay opened this issue Mar 10, 2024 · 3 comments · Fixed by #116891
Assignees
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

The following should compile.

#![feature(type_alias_impl_trait)]
#![allow(unconditional_recursion)]

type Opaque<'a> = impl Sized + 'a;

fn test<'a>() -> Opaque<'a> {
    let _: () = test::<'a>();
    //~^ ERROR expected generic lifetime parameter, found `'_`
}

Regressed in #122103. With the new generics of Opaque, the defining use at the let statement is Opaque<'_, 'a> := (). Cc @compiler-errors

@aliemjay aliemjay added C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-types Relevant to the types team, which will review and decide on the PR/issue. labels Mar 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 10, 2024
@compiler-errors
Copy link
Member

You minimized this from the same issue we have with RPITs, right? Because this code ICEs:

#![allow(unconditional_recursion)]

fn test<'a>() -> impl Sized + 'a {
    let _: () = test::<'a>();
}

@aliemjay
Copy link
Member Author

No, I discovered it accidentally by rebasing #116891.

@compiler-errors compiler-errors self-assigned this Mar 11, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 11, 2024
@compiler-errors
Copy link
Member

Wait, @aliemjay isn't this issue also fixed by #116891? It should be filtering out the uncaptured lifetimes in that PR.

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. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants