Skip to content

rust-analyzer infers incorrect type when using _ = expr #20176

@gvozdvmozgu

Description

@gvozdvmozgu

The following code compiles with rustc and correctly infers the type of n as i32:

let n = match 42 {
    0 => _ = todo!(),
    _ => 0,
};

However, rust-analyzer incorrectly infers the type of n as ().

Metadata

Metadata

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