-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
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 |
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#124682 (Suggest setting lifetime in borrowck error involving types with elided lifetimes) - rust-lang#124917 (Check whether the next_node is else-less if in get_return_block) - rust-lang#125106 (coverage: Memoize and simplify counter expressions) - rust-lang#125173 (Remove `Rvalue::CheckedBinaryOp`) - rust-lang#125305 (add some codegen tests for issue 120493) - rust-lang#125314 ( Add an experimental feature gate for global registration) - rust-lang#125318 (Migrate `run-make/rustdoc-scrape-examples-whitespace` to `rmake.rs`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124917 - cardigan1008:issue-124819, r=pnkfelix Check whether the next_node is else-less if in get_return_block Fix rust-lang#124819
Fix #124819