Skip to content

document Closure capture precision#698

Merged
kirtchev-adacore merged 34 commits into
mainfrom
tshepang/capture-precision
Jul 24, 2026
Merged

document Closure capture precision#698
kirtchev-adacore merged 34 commits into
mainfrom
tshepang/capture-precision

Conversation

@tshepang

@tshepang tshepang commented Apr 20, 2026

Copy link
Copy Markdown
Member

This captures some gaps FLS has compared to Reference, and the content is adjusted from Closure capture precision section.

Comment thread src/types-and-traits.rst Outdated
@kirtchev-adacore
kirtchev-adacore self-requested a review April 21, 2026 07:11

@kirtchev-adacore kirtchev-adacore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is it for now. I will have to revisit the remaining rules once the "place" business has been cleared up. I think we can find better wording/grouping of the remaining rules, as they feel somewhat randomly sprinkled.

View changes since this review

Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/types-and-traits.rst Outdated
@tshepang
tshepang force-pushed the tshepang/capture-precision branch from e3ed8e9 to 7be2ad5 Compare April 21, 2026 09:49
@tshepang

tshepang commented Apr 21, 2026

Copy link
Copy Markdown
Member Author

all addressed but #698 (comment)

@kirtchev-adacore kirtchev-adacore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will probably need to read Capture precision to ensure that no rules have been omitted.

View changes since this review

Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst
Comment thread src/expressions.rst Outdated

@PLeVasseur PLeVasseur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling this material into 6.22. The remaining comments are mainly about semantic completeness and alignment with the Rust Reference so the new section lands as dependable spec text.

View changes since this review

Comment thread src/expressions.rst Outdated
Comment thread src/changelog.rst Outdated
- `Const blocks are no longer evaluated to determine if expressions involving fallible operations can implicitly be constant-promoted <https://github.com/rust-lang/rust/pull/150557>`_
- `Make operational semantics of pattern matching independent of crate and module <https://github.com/rust-lang/rust/pull/150681>`_

Changed paragraphs:

@PLeVasseur PLeVasseur Apr 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraph-ID list itself looks fine, but this changelog attribution still seems too broad.

The changed capture-mode paragraphs fit rust-lang/rust#150681, but the new capture-precision block spans multiple sources: some items align with the later pattern/discriminant work in rust-lang/rust#138961 and rust-lang/reference#1837, while others are pre-existing Reference behavior now being documented here.

Could this entry be split, or reworded so #150681 is not presented as introducing the whole block? The note that these paragraphs mostly document behavior that existed before this release already points in that direction.

Support:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can go find where each behavior was added, but am not sure it's worth the time

maybe a good compromise is having a different heading, like "Pre-existing behavior before 1.95", or just "FLS maintenance"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tshepang So far we have used the following headings:

FLS fixes/improvements
FLS corrections

I think those should be changed to "FLS maintenance" (as it is more general), and you should use that heading to split the pre-release changes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done through a rebase

Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
Comment thread src/expressions.rst Outdated
@tshepang tshepang mentioned this pull request Apr 27, 2026
@rustbot

This comment has been minimized.

@tshepang
tshepang force-pushed the tshepang/capture-precision branch from dcd9707 to 550f10d Compare May 2, 2026 17:24
@rustbot

This comment has been minimized.

Comment thread src/expressions.rst Outdated
Comment thread src/patterns.rst Outdated
Comment thread src/patterns.rst Outdated
Comment thread src/patterns.rst Outdated
Comment thread src/expressions.rst Outdated
@kirtchev-adacore

Copy link
Copy Markdown
Contributor

This is it for now. I will have to revisit the remaining rules once the "place" business has been cleared up. I think we can find better wording/grouping of the remaining rules, as they feel somewhat randomly sprinkled.

View changes since this review

Just to clarify, after reading the Reference's Capture precision, I think "place" is indeed the proper term.

@rustbot

This comment has been minimized.

tshepang and others added 10 commits July 24, 2026 08:38
Co-authored-by: Ana Hobden <operator@hoverbear.org>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
tshepang and others added 19 commits July 24, 2026 08:43
…erload the term)

Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Co-authored-by: Hristian Kirtchev <60669983+kirtchev-adacore@users.noreply.github.com>
Also, sort by alphabet
In an FLS call, we decided that it's not important after all...
my thinking is that mentioning a read is not exactly relevant,
as FLS is not a place to explain mechanics of rustc.
It should be enough to only explain surface behavior,
and not why that behavior is so.

This reverts commit a3d7be4.
@tshepang
tshepang force-pushed the tshepang/capture-precision branch from 529319e to c14483e Compare July 24, 2026 06:47
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

This avoids the entry getting missed, due to the much larger
"New paragraphs" entry
@tshepang

Copy link
Copy Markdown
Member Author

rebased due to divergence from main

@tshepang
tshepang dismissed PLeVasseur’s stale review July 24, 2026 09:52

hristian took over, and review now handled

@kirtchev-adacore
kirtchev-adacore added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 51b7879 Jul 24, 2026
3 checks passed
@kirtchev-adacore
kirtchev-adacore deleted the tshepang/capture-precision branch July 24, 2026 10:18
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.

5 participants