Skip to content

Accept let-binding as a defining use of existential type #52653

Closed
@dtolnay

Description

@dtolnay

Per #52632 (comment), the following is expected to work. Currently it does not find the defining use of Clonable provided by the let binding.

#![feature(existential_type)]

existential type Clonable: Clone;

fn main() {
    let _x: Clonable = 0i32;
}
error[E0308]: mismatched types
 --> src/main.rs:6:24
  |
6 |     let _x: Clonable = 0i32;
  |                        ^^^^ expected anonymized type, found i32
  |
  = note: expected type `Clonable`
             found type `i32`

error: could not find defining uses
 --> src/main.rs:3:1
  |
3 | existential type Clonable: Clone;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Mentioning the existential types tracking issue #34511
Mentioning @oli-obk and @cramertj

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions