Skip to content

sema.type_of_expr() cannot resolve non tailexpr never #20460

@A4-Tacks

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 1.90.0-nightly (9748d87 2025-07-21)

rustc version: rustc 1.90.0-nightly (9748d87 2025-07-21)

editor or extension: VIM-9.1 coc-rust-analyzer

code snippet to reproduce:

This code cannot applicable Convert match to let-else

fn main() {
    let _x$0 = match 2 {
        it @ 0..5 => it,
        _ => {
            return; // not in tail_expr
        },
    };
}

But tailexpr can applicable

fn main() {
    let _x$0 = match 2 {
        it @ 0..5 => it,
        _ => {
            return // is tail_expr
        },
    };
}

Should type_of_expr handle the never type of non tailexpr in BlockExpr

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions