Skip to content

Commit dfe88bf

Browse files
committed
Auto merge of #29391 - DanielKeep:syntax-index, r=steveklabnik
* `const`: Add reference to raw pointers * Change `expr!(...)` etc. examples to use `ident` instead. *Technically*, it should be `pat`, but that's not how it works in practice. * `|`: add reference to closure syntax. * Closure syntax entry. * Indexing and slicing entries. * Add history of obsolete and deprecated syntax. r? @steveklabnik
2 parents ed121aa + a34274c commit dfe88bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/doc/book/syntax-index.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* `as`: primitive casting. See [Casting Between Types (`as`)].
66
* `break`: break out of loop. See [Loops (Ending Iteration Early)].
7-
* `const`: constant items. See [`const` and `static`].
7+
* `const`: constant items and constant raw pointers. See [`const` and `static`], [Raw Pointers].
88
* `continue`: continue to next loop iteration. See [Loops (Ending Iteration Early)].
99
* `crate`: external crate linkage. See [Crates and Modules (Importing External Crates)].
1010
* `else`: fallback for `if` and `if let` constructs. See [`if`], [`if let`].
@@ -39,7 +39,7 @@
3939

4040
## Operators and Symbols
4141

42-
* `!` (`expr!(…)`, `expr!{…}`, `expr![…]`): denotes macro expansion. See [Macros].
42+
* `!` (`ident!(…)`, `ident!{…}`, `ident![…]`): denotes macro expansion. See [Macros].
4343
* `!` (`!expr`): bitwise or logical complement. Overloadable (`Not`).
4444
* `%` (`expr % expr`): arithmetic remainder. Overloadable (`Rem`).
4545
* `%=` (`var %= expr`): arithmetic remainder & assignment.
@@ -89,6 +89,7 @@
8989
* `^=` (`var ^= expr`): bitwise exclusive or & assignment.
9090
* `|` (`expr | expr`): bitwise or. Overloadable (`BitOr`).
9191
* `|` (`pat | pat`): pattern alternatives. See [Patterns (Multiple patterns)].
92+
* `|` (`|…| expr`): closures. See [Closures].
9293
* `|=` (`var |= expr`): bitwise or & assignment.
9394
* `||` (`expr || expr`): logical or.
9495
* `_`: "ignored" pattern binding. See [Patterns (Ignoring bindings)].
@@ -105,6 +106,7 @@
105106
* `br"…"`, `br#"…"#`, `br##"…"##`, …: raw byte string literal, combination of raw and byte string literal. See [Reference (Raw Byte String Literals)].
106107
* `'…'`: character literal. See [Primitive Types (`char`)].
107108
* `b'…'`: ASCII byte literal.
109+
* `|…| expr`: closure. See [Closures].
108110

109111
<!-- Path-related syntax -->
110112

@@ -173,6 +175,8 @@
173175
* `[…]`: array literal. See [Primitive Types (Arrays)].
174176
* `[expr; len]`: array literal containing `len` copies of `expr`. See [Primitive Types (Arrays)].
175177
* `[type; len]`: array type containing `len` instances of `type`. See [Primitive Types (Arrays)].
178+
* `expr[expr]`: collection indexing. Overloadable (`Index`, `IndexMut`).
179+
* `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]`: collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, `RangeFull` as the "index".
176180

177181
[`const` and `static` (`static`)]: const-and-static.html#static
178182
[`const` and `static`]: const-and-static.html

0 commit comments

Comments
 (0)