Skip to content

Conversation

@ehuss
Copy link
Contributor

@ehuss ehuss commented Dec 20, 2025

This fixes the order of several of the lexical rules given our interpretation of "first match wins" for alternation.

This fixes the order of PUNCTUATION given our interpretation of
"first match wins" for alternation.

This moves the longer strings to the start to prevent any prefix
matching from happening (for example `.` instead of `...`).
This fixes the order of LIFETIME_TOKEN (and LIFETIME_OR_LABEL) given our
interpretation of "first match wins" for alternation.

This moves RAW_LIFETIME to the start, otherwise a raw lifetime `'r#foo`
would be interpreted as LIFETIME_TOKEN (`'r`) PUNCTUATION (`#`)
IDENTIFIER_OR_KEYWORD (`foo`).
This fixes the order of FLOAT_LITERAL given our interpretation of "first
match wins" for alternation. This moves the first rule (which matches
things like `3.`) to the end so that other two rules have a chance to
match something.

Otherwise, input like `3.14` would be FLOAT_LITERAL (3.) INTEGER_LITERAL
(14).
This fixes the order of INTEGER_LITERAL given our interpretation of
"first match wins" for alternation. This moves DEC_LITERAL to the end of
the list. Otherwise, an input of `0b1` would be interpreted as
INTEGER_LITERAL (0) IDENTIFIER_OR_KEYWORD (b) INTEGER_LITERAL (1)
instead of INTEGER_LITERAL (0b1).
With our interpretation of "first match wins" with alternation, this
fixes a problem where INTEGER_LITERAL was incorrectly in front of
FLOAT_LITERAL.

Otherwise, an input of `1.2` would be interpreted as `INTEGER_LITERAL`,
`PUNCTUATION`, `INTEGER_LITERAL` instead of `FLOAT_LITERAL`.
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Dec 20, 2025
@traviscross traviscross added this pull request to the merge queue Dec 22, 2025
Merged via the queue into rust-lang:master with commit 68bdfd1 Dec 22, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Dec 22, 2025
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 1, 2026
Update books

## rust-lang/reference

21 commits in ec78de0ffe2f8344bd0e222b17ac7a7d32dc7a26..6363385ac4ebe1763f1e6fb2063c0b1db681a072
2025-12-15 16:17:43 +0000 to 2025-12-31 21:12:35 +0000
- Remove cargo workspace inheritance (rust-lang/reference#2129)
- identifiers: bump Unicode from 16 to 17 (rust-lang/reference#2071)
- Fix alternation order of lexical rules (rust-lang/reference#2126)
- Fix overly greedy digits (rust-lang/reference#2124)
- Clarify UNICODE_ESCAPE valid token value (rust-lang/reference#2123)
- Fix ambiguity of RESERVED_RAW_IDENTIFIER (rust-lang/reference#2122)
- Document how closure capturing interacts with discriminant reads (rust-lang/reference#1837)
- operator-expr: remove stray word in footnote (rust-lang/reference#2118)
- await-expr: add a missing space (rust-lang/reference#2120)
- attributes: add missing punctuation to instruction_set (rust-lang/reference#2117)
- associated-items: add missing periods (rust-lang/reference#2116)
- Move tools into a consolidated cargo workspace (rust-lang/reference#2115)
- Unwrap all of the lexical chapters (rust-lang/reference#2113)
- Unwrap const_eval.md (rust-lang/reference#2112)
- Add section on expansion-time (early) name resolution (rust-lang/reference#2055)
- const_eval.md: add missing word (rust-lang/reference#2068)
- path-expr.md: use a more suitable punctuation (rust-lang/reference#2082)
- items: clarify label for type-aliases documentation (rust-lang/reference#2110)
- do not mix singular and plural (rust-lang/reference#2101)
- external-blocks: add missing "and" in list (rust-lang/reference#2111)
- conditional-compilation: add a space in `cfg.cfg_attr.attribute-list` (rust-lang/reference#2109)

## rust-lang/rust-by-example

2 commits in 7d21279e40e8f0e91c2a22c5148dd2d745aef8b6..2e02f22a10e7eeb758e6aba484f13d0f1988a3e5
2025-12-21 08:47:57 UTC to 2025-12-21 08:46:33 UTC

- docs(comments): improve readability and formatting (rust-lang/rust-by-example#1981)
- Fix HOF.MD sum of odd squares algorithm (rust-lang/rust-by-example#1980)
rust-timer added a commit to rust-lang/rust that referenced this pull request Jan 1, 2026
Rollup merge of #150529 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

21 commits in ec78de0ffe2f8344bd0e222b17ac7a7d32dc7a26..6363385ac4ebe1763f1e6fb2063c0b1db681a072
2025-12-15 16:17:43 +0000 to 2025-12-31 21:12:35 +0000
- Remove cargo workspace inheritance (rust-lang/reference#2129)
- identifiers: bump Unicode from 16 to 17 (rust-lang/reference#2071)
- Fix alternation order of lexical rules (rust-lang/reference#2126)
- Fix overly greedy digits (rust-lang/reference#2124)
- Clarify UNICODE_ESCAPE valid token value (rust-lang/reference#2123)
- Fix ambiguity of RESERVED_RAW_IDENTIFIER (rust-lang/reference#2122)
- Document how closure capturing interacts with discriminant reads (rust-lang/reference#1837)
- operator-expr: remove stray word in footnote (rust-lang/reference#2118)
- await-expr: add a missing space (rust-lang/reference#2120)
- attributes: add missing punctuation to instruction_set (rust-lang/reference#2117)
- associated-items: add missing periods (rust-lang/reference#2116)
- Move tools into a consolidated cargo workspace (rust-lang/reference#2115)
- Unwrap all of the lexical chapters (rust-lang/reference#2113)
- Unwrap const_eval.md (rust-lang/reference#2112)
- Add section on expansion-time (early) name resolution (rust-lang/reference#2055)
- const_eval.md: add missing word (rust-lang/reference#2068)
- path-expr.md: use a more suitable punctuation (rust-lang/reference#2082)
- items: clarify label for type-aliases documentation (rust-lang/reference#2110)
- do not mix singular and plural (rust-lang/reference#2101)
- external-blocks: add missing "and" in list (rust-lang/reference#2111)
- conditional-compilation: add a space in `cfg.cfg_attr.attribute-list` (rust-lang/reference#2109)

## rust-lang/rust-by-example

2 commits in 7d21279e40e8f0e91c2a22c5148dd2d745aef8b6..2e02f22a10e7eeb758e6aba484f13d0f1988a3e5
2025-12-21 08:47:57 UTC to 2025-12-21 08:46:33 UTC

- docs(comments): improve readability and formatting (rust-lang/rust-by-example#1981)
- Fix HOF.MD sum of odd squares algorithm (rust-lang/rust-by-example#1980)
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.

3 participants