Repository navigation
lint: do not emit unreachable_code on become with diverging callee - #165539
Merged
rust-bors[bot] merged 2 commits intoNov 7, 2026
Merged
rust-bors[bot] merged 2 commits into
rust-bors[bot] merged 2 commits into
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @wesleywiser (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
| } | ||
|
|
||
| fn caller() -> ! { | ||
| become callee(); |
Member
There was a problem hiding this comment.
while preserving unreachable code warnings for any statements following become
Could you also add a test for this in this file?
Contributor
Author
There was a problem hiding this comment.
Tests are added to check unreachable statements following become generate warnings.
JonathanBrouwer
requested changes
Nov 6, 2026
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
JonathanBrouwer
approved these changes
Nov 6, 2026
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
…uwer Rollup of 6 pull requests Successful merges: - #165495 (rustdoc: Improve performance by skipping unneeded intermediate JSON serializations) - #165523 (remove stability attributes from intrinsics) - #165034 (allow configuring rustc_perf's path for out-of-tree uses of rustc_perf) - #165373 (use correct span for lifetimes with attributes) - #165539 (lint: do not emit unreachable_code on become with diverging callee) - #165556 (rustc_config: Replace `Option` with a custom enum for `--jobs` options) > [!WARNING] > This rollup conflicts with pending auto build #165548 and may need to be recreated if the pending build succeeds.
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 7, 2026
Rollup merge of #165539 - epiglottis-cartilage:fix-become-unreachable-code, r=JonathanBrouwer lint: do not emit unreachable_code on become with diverging callee <!-- Thank you for making the compiler better! What does this PR do? --> Fixes #165536. Exempts `ExprKind::Become(..)` from emitting `unreachable_code` when its inner call expression diverges, while preserving unreachable code warnings for any statements following `become`. ### Changes - Add `| ExprKind::Become(..)` to the diverging child exemption list in `compiler/rustc_hir_typeck/src/expr.rs`. - Add `tests/ui/explicit-tail-calls/become-diverging.rs`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #165536.
Exempts
ExprKind::Become(..)from emittingunreachable_codewhen its inner call expression diverges, while preserving unreachable code warnings for any statements followingbecome.Changes
| ExprKind::Become(..)to the diverging child exemption list incompiler/rustc_hir_typeck/src/expr.rs.tests/ui/explicit-tail-calls/become-diverging.rs.