Skip to content

Don't remove unreachable statements at HIR lowering #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021

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