-
Notifications
You must be signed in to change notification settings - Fork 546
Clarify operand evaluation order in compound assignment with primitiv… #1941
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
Merged
traviscross
merged 4 commits into
rust-lang:master
from
fiveseven-lambda:fix-compound-assign-eval-order
Aug 20, 2025
Merged
Clarify operand evaluation order in compound assignment with primitiv… #1941
traviscross
merged 4 commits into
rust-lang:master
from
fiveseven-lambda:fix-compound-assign-eval-order
Aug 20, 2025
Conversation
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
...with primitive vs generic types.
The things on each side of a `+=` are its operands, and this is what we're referring to here.
ff93297
to
af7d53c
Compare
0b1407a
to
8948ff3
Compare
8948ff3
to
864ca4a
Compare
traviscross
approved these changes
Aug 20, 2025
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Aug 25, 2025
Update books ## rust-lang/nomicon 1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf 2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC - Fix unknown field `author` error when building the book (rust-lang/nomicon#500) ## rust-lang/reference 11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769 2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC - Update `instruction_set` to use the attribute template (rust-lang/reference#1912) - Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922) - Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923) - Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941) - Switch to using native mdbook fragment redirects (rust-lang/reference#1965) - Fix traits implemented for function items (rust-lang/reference#1969) - Clarify that safe extern items do not require unsafe (rust-lang/reference#1970) - Update `type_length_limit` to use the attribute template (rust-lang/reference#1917) - Add missing rule identifier for const outer generics (rust-lang/reference#1962) - Fix indentation of static path restriction text (rust-lang/reference#1961) - Add doc for `sse4a` and `tbm` (rust-lang/reference#1949) ## rust-lang/rust-by-example 2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f 2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC - Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952) - Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 26, 2025
Update books ## rust-lang/nomicon 1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf 2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC - Fix unknown field `author` error when building the book (rust-lang/nomicon#500) ## rust-lang/reference 11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769 2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC - Update `instruction_set` to use the attribute template (rust-lang/reference#1912) - Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922) - Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923) - Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941) - Switch to using native mdbook fragment redirects (rust-lang/reference#1965) - Fix traits implemented for function items (rust-lang/reference#1969) - Clarify that safe extern items do not require unsafe (rust-lang/reference#1970) - Update `type_length_limit` to use the attribute template (rust-lang/reference#1917) - Add missing rule identifier for const outer generics (rust-lang/reference#1962) - Fix indentation of static path restriction text (rust-lang/reference#1961) - Add doc for `sse4a` and `tbm` (rust-lang/reference#1949) ## rust-lang/rust-by-example 2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f 2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC - Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952) - Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 26, 2025
Update books ## rust-lang/nomicon 1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf 2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC - Fix unknown field `author` error when building the book (rust-lang/nomicon#500) ## rust-lang/reference 11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769 2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC - Update `instruction_set` to use the attribute template (rust-lang/reference#1912) - Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922) - Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923) - Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941) - Switch to using native mdbook fragment redirects (rust-lang/reference#1965) - Fix traits implemented for function items (rust-lang/reference#1969) - Clarify that safe extern items do not require unsafe (rust-lang/reference#1970) - Update `type_length_limit` to use the attribute template (rust-lang/reference#1917) - Add missing rule identifier for const outer generics (rust-lang/reference#1962) - Fix indentation of static path restriction text (rust-lang/reference#1961) - Add doc for `sse4a` and `tbm` (rust-lang/reference#1949) ## rust-lang/rust-by-example 2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f 2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC - Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952) - Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
rust-timer
added a commit
to rust-lang/rust
that referenced
this pull request
Aug 26, 2025
Rollup merge of #145856 - rustbot:docs-update, r=ehuss Update books ## rust-lang/nomicon 1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf 2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC - Fix unknown field `author` error when building the book (rust-lang/nomicon#500) ## rust-lang/reference 11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769 2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC - Update `instruction_set` to use the attribute template (rust-lang/reference#1912) - Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922) - Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923) - Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941) - Switch to using native mdbook fragment redirects (rust-lang/reference#1965) - Fix traits implemented for function items (rust-lang/reference#1969) - Clarify that safe extern items do not require unsafe (rust-lang/reference#1970) - Update `type_length_limit` to use the attribute template (rust-lang/reference#1917) - Add missing rule identifier for const outer generics (rust-lang/reference#1962) - Fix indentation of static path restriction text (rust-lang/reference#1961) - Add doc for `sse4a` and `tbm` (rust-lang/reference#1949) ## rust-lang/rust-by-example 2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f 2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC - Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952) - Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
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.
…e vs generic types
Closes #1940.
This PR improves the clarity of the compound assignment expression documentation by specifying that the right-before-left evaluation order only applies to non-generic code involving primitive types. In generic contexts (even with primitive types), the left operand is evaluated before the right, following trait dispatch rules.