Skip to content

Clarify control flow when a let...else pattern fails - #4912

Open
AmanBoronbaev wants to merge 1 commit into
rust-lang:mainfrom
AmanBoronbaev:clarify-let-else-divergence
Open

AmanBoronbaev wants to merge 1 commit into
rust-lang:mainfrom
AmanBoronbaev:clarify-let-else-divergence

Conversation

@AmanBoronbaev

Copy link
Copy Markdown

Closes #4577.

Chapter 6 currently says the else block of a let...else must return from its function. A loop can also use continue there and process its next item. Explain that choice in Chapter 6, and connect divergence to the guarantee that a binding exists after a successful match in Chapter 19.

I compiled the two chapter listings, checked a loop using continue and the compiler error for an else that falls through, and built the book with mdBook 0.5.1 and the repository's preprocessors.

AI assistance: OpenAI Codex helped verify the control-flow examples and edit the two explanations.

This branch has not been deployed

No deployments
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.

let else divergence clarification

1 participant