Skip to content

Commit 9b1f700

Browse files
committed
docs:Update rustc-dev-guide-book
Rename `StringReader` to `Lexer` and update links. The `StringReader` struct link is invalid since pr:Merge `TokenTreesReader` into `StringReader`.
1 parent 73c0ae6 commit 9b1f700

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/doc/rustc-dev-guide/src/appendix/code-index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Item | Kind | Short description | Chapter |
2424
`SourceFile` | struct | Part of the `SourceMap`. Maps AST nodes to their source code for a single source file. Was previously called FileMap | [The parser] | [compiler/rustc_span/src/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.SourceFile.html)
2525
`SourceMap` | struct | Maps AST nodes to their source code. It is composed of `SourceFile`s. Was previously called CodeMap | [The parser] | [compiler/rustc_span/src/source_map.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/source_map/struct.SourceMap.html)
2626
`Span` | struct | A location in the user's source code, used for error reporting primarily | [Emitting Diagnostics] | [compiler/rustc_span/src/span_encoding.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html)
27-
`StringReader` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] | [compiler/rustc_parse/src/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.StringReader.html)
27+
`Lexer` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] | [compiler/rustc_parse/src/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html)
2828
`rustc_ast::token_stream::TokenStream` | struct | An abstract sequence of tokens, organized into `TokenTree`s | [The parser], [Macro expansion] | [compiler/rustc_ast/src/tokenstream.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/tokenstream/struct.TokenStream.html)
2929
`TraitDef` | struct | This struct contains a trait's definition with type information | [The `ty` modules] | [compiler/rustc_middle/src/ty/trait_def.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait_def/struct.TraitDef.html)
3030
`TraitRef` | struct | The combination of a trait and its input types (e.g. `P0: Trait<P1...Pn>`) | [Trait Solving: Goals and Clauses] | [compiler/rustc_middle/src/ty/sty.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.TraitRef.html)

src/doc/rustc-dev-guide/src/guides/editions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ stability.
9191
## Edition parsing
9292

9393
For the most part, the lexer is edition-agnostic.
94-
Within [`StringReader`], tokens can be modified based on edition-specific behavior.
94+
Within [`Lexer`], tokens can be modified based on edition-specific behavior.
9595
For example, C-String literals like `c"foo"` are split into multiple tokens in editions before 2021.
9696
This is also where things like reserved prefixes are handled for the 2021 edition.
9797

@@ -114,7 +114,7 @@ For example, the deprecated `start...end` pattern syntax emits the
114114
[`ellipsis_inclusive_range_patterns`] lint on editions before 2021, and in 2021 is an hard error via
115115
the `emit_err` method.
116116

117-
[`StringReader`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.StringReader.html
117+
[`Lexer`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html
118118
[`ParseSess::edition`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.ParseSess.html#structfield.edition
119119
[`ellipsis_inclusive_range_patterns`]: https://doc.rust-lang.org/nightly/rustc/lints/listing/warn-by-default.html#ellipsis-inclusive-range-patterns
120120

src/doc/rustc-dev-guide/src/overview.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Unicode character encoding.
3838

3939
The token stream passes through a higher-level lexer located in
4040
[`rustc_parse`] to prepare for the next stage of the compile process. The
41-
[`StringReader`] `struct` is used at this stage to perform a set of validations
41+
[`Lexer`] `struct` is used at this stage to perform a set of validations
4242
and turn strings into interned symbols (_interning_ is discussed later).
4343
[String interning] is a way of storing only one immutable
4444
copy of each distinct string value.
@@ -153,7 +153,7 @@ the final binary.
153153
[`rustc_parse::parser::Parser`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html
154154
[`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
155155
[`simplify_try`]: https://github.com/rust-lang/rust/pull/66282
156-
[`StringReader`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.StringReader.html
156+
[`Lexer`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html
157157
[`Ty<'tcx>`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html
158158
[borrow checking]: borrow_check.md
159159
[codegen]: backend/codegen.md
@@ -342,7 +342,7 @@ Compiler performance is a problem that we would like to improve on
342342
(and are always working on). One aspect of that is parallelizing
343343
`rustc` itself.
344344

345-
Currently, there is only one part of rustc that is parallel by default:
345+
Currently, there is only one part of rustc that is parallel by default:
346346
[code generation](./parallel-rustc.md#Codegen).
347347

348348
However, the rest of the compiler is still not yet parallel. There have been

src/doc/rustc-dev-guide/src/the-parser.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This happens in two stages: Lexing and Parsing.
1313

1414
2. _Parsing_ takes streams of tokens and turns them into a structured form
1515
which is easier for the compiler to work with, usually called an [*Abstract
16-
Syntax Tree* (AST)][ast] .
16+
Syntax Tree* (AST)][ast] .
1717

1818
## The AST
1919

@@ -52,7 +52,7 @@ the token stream, and then execute the parser to get a [`Crate`] (the root AST
5252
node).
5353

5454
To minimize the amount of copying that is done,
55-
both [`StringReader`] and [`Parser`] have lifetimes which bind them to the parent [`ParseSess`].
55+
both [`Lexer`] and [`Parser`] have lifetimes which bind them to the parent [`ParseSess`].
5656
This contains all the information needed while parsing, as well as the [`SourceMap`] itself.
5757

5858
Note that while parsing, we may encounter macro definitions or invocations.
@@ -67,7 +67,7 @@ Code for lexical analysis is split between two crates:
6767
constituting tokens. Although it is popular to implement lexers as generated
6868
finite state machines, the lexer in [`rustc_lexer`] is hand-written.
6969

70-
- [`StringReader`] integrates [`rustc_lexer`] with data structures specific to
70+
- [`Lexer`] integrates [`rustc_lexer`] with data structures specific to
7171
`rustc`. Specifically, it adds `Span` information to tokens returned by
7272
[`rustc_lexer`] and interns identifiers.
7373

@@ -76,7 +76,7 @@ Code for lexical analysis is split between two crates:
7676
[`ParseSess`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.ParseSess.html
7777
[`rustc_lexer`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html
7878
[`SourceMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/source_map/struct.SourceMap.html
79-
[`StringReader`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.StringReader.html
79+
[`Lexer`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html
8080
[ast module]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/index.html
8181
[ast]: ./ast-validation.md
8282
[parser]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/index.html

0 commit comments

Comments
 (0)