Skip to content

"non-defining opaque type use" with equal bound regions due to closure #112841

Closed
@lcnr

Description

@lcnr
#![feature(type_alias_impl_trait)]
trait Trait<'a, 'b> {}
impl Trait<'_, '_> for () {}
type Tait<'a, 'b> = impl Trait<'a, 'b>;
fn fail<'a: 'b, 'b: 'a>() -> Tait<'a, 'b> {
    (|| {})()
}

results in the following but should ideally compile.

error: non-defining opaque type use in defining scope
 --> src/main.rs:6:5
  |
6 |     (|| {})()
  |     ^^^^^^^^^
  |
note: lifetime used multiple times
 --> src/main.rs:4:11
  |
4 | type Tait<'a, 'b> = impl Trait<'a, 'b>;
  |           ^^  ^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions