Skip to content
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

[Appendix B] Update inclusive range syntax #1245

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions second-edition/src/appendix-02-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ overload that operator is listed.
* `..` (`..`, `expr..`, `..expr`, `expr..expr`): right-exclusive range literal.
* `..` (`..expr`): struct literal update syntax.
* `..` (`variant(x, ..)`, `struct_type { x, .. }`): “and the rest” pattern binding.
* `...` (`...expr`, `expr...expr`) *in an expression*: inclusive range expression.
* `...` (`expr...expr`) *in a pattern*: inclusive range pattern.
* `..=` (`..=expr`, `expr..=expr`) *in an expression*: inclusive range expression.
* `...`, `..=` (`expr...expr` or `expr..=expr`) *in a pattern*: inclusive range pattern.
* `/` (`expr / expr`): arithmetic division. Overloadable (`Div`).
* `/=` (`var /= expr`): arithmetic division and assignment. Overloadable (`DivAssign`).
* `:` (`pat: type`, `ident: type`): constraints.
Expand Down Expand Up @@ -151,4 +151,4 @@ overload that operator is listed.
* `[expr; len]`: array literal containing `len` copies of `expr`.
* `[type; len]`: array type containing `len` instances of `type`.
* `expr[expr]`: collection indexing. Overloadable (`Index`, `IndexMut`).
* `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]`: collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, `RangeFull` as the “index”.
* `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]`, `expr[..=b]`, `expr[a..=b]`: collection indexing pretending to be collection slicing, using `RangeFull`, `RangeFrom`, `RangeTo`, `Range`, `RangeToInclusive`, `RangeInclusive` as the “index”.