Skip to content

typeck has an different notion of reachability from liveness #31617

Closed
@arielb1

Description

@arielb1

for example:

enum Void {}
// this uses middle::liveness reachability - the end of the
// function is not reachable
fn compiles() -> Void {
    loop {
        panic!();
        break
    };
}

// this uses typeck reachability - the end of the block
// is reachable, despite the code being identical.
fn does_not_compile() -> Void {
    let a: Void = { //~ ERROR mismatched types
        loop {
            panic!();
            break
        };
    };
    a
}

fn main() {}

Metadata

Metadata

Assignees

No one assigned

    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