Skip to content

Don't remove unreachable statements at HIR lowering#387

Merged
bors[bot] merged 1 commit intoRust-GCC:masterfrom
lrh2000:typeck-unreachable
Apr 25, 2021
Merged

Don't remove unreachable statements at HIR lowering#387
bors[bot] merged 1 commit intoRust-GCC:masterfrom
lrh2000:typeck-unreachable

Conversation

@lrh2000
Copy link
Contributor

@lrh2000 lrh2000 commented Apr 24, 2021

This is a legal code segment:

fn foo() -> i32 {
    return 1;
    let a = 1;
    a
}

And this is illegal:

fn foo() -> i32 {
    return 1;
    let a = 1.5;
    a
}

So we shouldn't remove unreachable statements at HIR lowering. We can issue warnings for them, but they need to be kept so that their types can be checked.

(Original in #364)

@philberty
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 25, 2021

Build succeeded:

@bors bors bot merged commit 041003d into Rust-GCC:master Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants