Repository navigation
A pattern binding's view ends at its last use, as a let view's does (#3548); a store of the same field of another record fits the callback role (D213) - #3554
Merged
Conversation
added 2 commits
November 22, 2026 22:29
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.
Two changes.
#3548: a pattern binding's view ends at its last use. A view bound by
letwas already judged by its last use; a name bound from a place by a pattern was held to the end of its arm. So the rewrite the diagnostic suggests was itself refused inside an arm:A block retires the dead borrows of its own depth after each statement, and an arm's scope has no statements of its own. Its bindings live exactly as long as its body, so a block body is now given their borrows to retire: those the pattern made, and one the subject expression made (
match &e:) that an arm binding names. A read after the move is still refused (err_pattern_view_read_after_move), and so is the read and the move in one expression: nothing there says the view's value is gone before the move.The help now names the rewrite that works: "a view ends at its last use: read what you need from
tagin aleton an earlier line, then movewhole". D230's record is updated.Tests:
behav_pattern_view_ends_at_last_use(both forms; leak 0; passes every MIR validator),err_pattern_view_read_after_move.D213: a same-field store.
second->set.fdebug = data->set.fdebug(libcurl 8.23.0,http2.c): a store of the same field of another record of the same type fitsfield F of R is callback, per Eric's amendment of 2026-11-22. The scanner classifies it and it no longer leaves the field undecided. The spec's status note now names only the variadic store as not yet implemented. Test case inconan_facade_callback_field_test.Closes #3548.
Battery green (540 s);
:release-checksgreen.