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

Can't define TAIT with region params inside of a closure #120224

Closed
compiler-errors opened this issue Jan 22, 2024 · 2 comments
Closed

Can't define TAIT with region params inside of a closure #120224

compiler-errors opened this issue Jan 22, 2024 · 2 comments
Labels
C-bug Category: This is a bug. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` 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

@compiler-errors
Copy link
Member

I tried this code:

#![feature(type_alias_impl_trait)]

type Tait<'a> = impl Sized;

fn foo<'a>() where Tait<'a>: {
    let _ = |x: &'a ()| {
        let _: Tait<'a> = x;
    };
}

I expected to see it work

Instead, this happened:

error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
 --> src/lib.rs:7:16
  |
3 | type Tait<'a> = impl Sized;
  |                 ---------- opaque type defined here
4 |
5 | fn foo<'a>() where Tait<'a>: {
  |        -- hidden type `&'a ()` captures the lifetime `'a` as defined here
6 |     let _ = |x: &'a ()| {
7 |         let _: Tait<'a> = x;
  |                ^^^^^^^^

This probably has to do something with promoting member constraints from a closure or something? idk.

@compiler-errors compiler-errors 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. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` labels Jan 22, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 22, 2024
@aliemjay
Copy link
Member

This is #105498. Close as duplicate?

@compiler-errors
Copy link
Member Author

yup will close

@compiler-errors compiler-errors closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 22, 2024
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-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` 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

No branches or pull requests

4 participants