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
Check whether the next_node is else-less if in get_return_block #124917
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
Fix rust-lang#124819, where a if-less block causes a wrong output. It is caused by get_return_block in get_fn_decl. In get_return_block, when a else-less if expression is the tail expression, the check for next_node will keep iterating. So it is necessary to make a early return in the check.
can you add a unit test illustrating the change? (If you need help with what steps to use to add a test, feel free to ask; I'd probably start by reading this https://rustc-dev-guide.rust-lang.org/tests/ui.html ) |
@rustbot author |
Hi @pnkfelix I have updated the unit test following the instruction. If there's any mistake, feel free to ask me to change. Thanks! |
@rustbot review |
Fix #124819