Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2c5f759
Create a syntax index
ehuss Oct 12, 2025
12678cb
Lowercase punctuation index links
ehuss Oct 22, 2025
89294c2
Remove a stray "and"
ehuss Oct 22, 2025
f0a259b
Add a trailing pipe for the punctuation table
ehuss Oct 22, 2025
f8b53c7
Update pipe for or-patterns
ehuss Oct 22, 2025
cb0194f
Add use bounds for punctuation index
ehuss Oct 22, 2025
bc145b8
Add let statements for `=`
ehuss Oct 22, 2025
81f798a
Switch links to rule links
ehuss Oct 23, 2025
98ae16b
Add link forwarding to the syntax index
ehuss Oct 23, 2025
120227e
Disable indexing for the syntax index
ehuss Oct 23, 2025
1a1c5bd
Add keywords to the syntax index
ehuss Oct 23, 2025
56826a3
Add comments to syntax index
ehuss Oct 23, 2025
fc33501
Add other tokens to the syntax index
ehuss Oct 23, 2025
b49facd
Add macros to the syntax index
ehuss Oct 23, 2025
41e7de9
Add attributes to syntax index
ehuss Oct 24, 2025
16c8bbc
Add expressions, items, types, and patterns to syntax index
ehuss Oct 24, 2025
34ccba1
Singularize "wildcard pattern", "inferred type"
traviscross Oct 25, 2025
addbb94
Add inferred const to keyword index
traviscross Oct 25, 2025
69c18db
Add placeholder lifetime to syntax index
traviscross Oct 25, 2025
29a0852
Add range patterns to patterns section of index
traviscross Oct 26, 2025
4ae18da
Clarify role of `_` with constants
traviscross Oct 27, 2025
c1c626f
Avoid overloading "alias"
traviscross Oct 27, 2025
8f8eedb
Singularize "extern crate"
traviscross Oct 27, 2025
6d88476
Say "impl trait types"
traviscross Oct 27, 2025
e79b6de
Separate RPIT and APIT in the index
traviscross Oct 27, 2025
f2fc212
Remove "unsafe static items" from syntax index
traviscross Oct 27, 2025
59b8fa7
Add "unsafe blocks" to syntax index
traviscross Oct 27, 2025
11133a9
Add "array expressions" for semicolon in index
traviscross Oct 27, 2025
c70d602
Clarify about `->` and types
traviscross Oct 27, 2025
02c7d47
List raw string literals for `#` in index
traviscross Oct 27, 2025
86fd49c
Refer to relaxed trait bounds for `?`
traviscross Oct 27, 2025
a31a5d0
Call `$ident:kind` a macro matcher fragment specifier
traviscross Oct 27, 2025
2a62276
Call `$ident` a "macro metavariable" in the index
traviscross Oct 27, 2025
7ae6d27
Add `|..| -> Type { .. }` syntax for closures to index
traviscross Oct 27, 2025
256eb2f
Fix `Type as Trait` capitalization
traviscross Oct 27, 2025
e32a1a8
Clarify ATBs in syntax index
traviscross Oct 27, 2025
a4ea4a1
Move `Type<..>` to type expressions in index
traviscross Oct 27, 2025
4946e96
Pluralize "single element tuple expressions"
traviscross Oct 27, 2025
7783ff4
Add space ahead of curly brackets in index
traviscross Oct 28, 2025
fe74fad
Clarify description of items in syntax index
traviscross Oct 28, 2025
e323abf
Add semicolons for items needing them in index
traviscross Oct 28, 2025
33cb862
Indicate list of primitive types is non-exhaustive
traviscross Oct 28, 2025
f5b74cf
Remove "compound type bounds" from syntax index
traviscross Oct 28, 2025
fc3a743
Fix slice types syntax in syntax index
traviscross Oct 28, 2025
bca3f52
Refer to "type aliases" rather than "aliases"
traviscross Oct 28, 2025
a1cd147
Link to items listed for type paths
traviscross Oct 28, 2025
4ac6626
Singularize "the rest pattern"
traviscross Oct 28, 2025
fd446a1
Go with "constant items" for `_` in index
traviscross Oct 28, 2025
e93dce5
Say "use" rather than "usage" in the syntax index
traviscross Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ level = 0
use-boolean-and = true

[output.html.search.chapter]
"test-summary.md" = { enable = false }
"grammar.md" = { enable = false }
"syntax-index.md" = { enable = false }
"test-summary.md" = { enable = false }

[output.html.redirect]
"/crates-and-source-files.html#preludes-and-no_std" = "names/preludes.html"
Expand All @@ -34,6 +35,7 @@ use-boolean-and = true
"/items/traits.html#object-safety" = "traits.html#dyn-compatibility"
"/lifetime-elision.html#static-lifetime-elision" = "lifetime-elision.html#const-and-static-elision"
"/macros-by-example.html#path-based-scope" = "macros-by-example.html#the-macro_export-attribute"
"/patterns.html#rest-patterns" = "patterns.html#rest-pattern"
"/procedural-macros.html#attribute-macros" = "procedural-macros.html#the-proc_macro_attribute-attribute"
"/procedural-macros.html#derive-macros" = "procedural-macros.html#the-proc_macro_derive-attribute"
"/procedural-macros.html#function-like-procedural-macros" = "procedural-macros.html#the-proc_macro-attribute"
Expand Down
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@

- [Appendices](appendices.md)
- [Grammar summary](grammar.md)
- [Syntax index](syntax-index.md)
- [Macro follow-set ambiguity formal specification](macro-ambiguity.md)
- [Influences](influences.md)
- [Test summary](test-summary.md)
Expand Down
9 changes: 5 additions & 4 deletions src/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Destructuring breaks up a value into its component pieces.
The syntax used is almost the same as when creating such values.

r[patterns.destructure.wildcard]
In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a [wildcard pattern](#wildcard-pattern) (`_`) stands in for a *single* data field, whereas an [et cetera](#grammar-StructPatternEtCetera) or [rest pattern](#rest-patterns) (`..`) stands in for *all* the remaining fields of a particular variant.
In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a [wildcard pattern](#wildcard-pattern) (`_`) stands in for a *single* data field, whereas an [et cetera](#grammar-StructPatternEtCetera) or [rest pattern][patterns.rest] (`..`) stands in for *all* the remaining fields of a particular variant.

r[patterns.destructure.named-field-shorthand]
When destructuring a data structure with named (but not numbered) fields, it is allowed to write `fieldname` as a shorthand for `fieldname: fieldname`.
Expand Down Expand Up @@ -421,7 +421,7 @@ r[patterns.wildcard.refutable]
The wildcard pattern is always irrefutable.

r[patterns.rest]
## Rest patterns
## Rest pattern

r[patterns.rest.syntax]
```grammar,patterns
Expand Down Expand Up @@ -470,7 +470,8 @@ if let [.., penultimate, _] = slice {
}

# let tuple = (1, 2, 3, 4, 5);
// Rest patterns may also be used in tuple and tuple struct patterns.
// The rest pattern may also be used in tuple and tuple
// struct patterns.
match tuple {
(1, .., y, z) => println!("y={} z={}", y, z),
(.., 5) => println!("tail must be 5"),
Expand Down Expand Up @@ -974,7 +975,7 @@ r[patterns.slice.refutable-array]
Slice patterns are irrefutable when matching an array as long as each element is irrefutable.

r[patterns.slice.refutable-slice]
When matching a slice, it is irrefutable only in the form with a single `..` [rest pattern](#rest-patterns) or [identifier pattern](#identifier-patterns) with the `..` rest pattern as a subpattern.
When matching a slice, it is irrefutable only in the form with a single `..` [rest pattern][patterns.rest] or [identifier pattern](#identifier-patterns) with the `..` rest pattern as a subpattern.

r[patterns.slice.restriction]
Within a slice, a range pattern without both lower and upper bound must be enclosed in parentheses, as in `(a..)`, to clarify it is intended to match against a single slice element.
Expand Down
Loading