Skip to content

Commit b66f921

Browse files
committed
rustc_lexer::TokenKind improve docs
1 parent 36285c5 commit b66f921

File tree

1 file changed

+18
-5
lines changed
  • compiler/rustc_lexer/src

1 file changed

+18
-5
lines changed

compiler/rustc_lexer/src/lib.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,42 @@ pub enum TokenKind {
5757
// Multi-char tokens:
5858
/// "// comment"
5959
LineComment { doc_style: Option<DocStyle> },
60+
6061
/// `/* block comment */`
6162
///
62-
/// Block comments can be recursive, so the sequence like `/* /* */`
63+
/// Block comments can be recursive, so a sequence like `/* /* */`
6364
/// will not be considered terminated and will result in a parsing error.
6465
BlockComment { doc_style: Option<DocStyle>, terminated: bool },
65-
/// Any whitespace characters sequence.
66+
67+
/// Any whitespace character sequence.
6668
Whitespace,
69+
6770
/// "ident" or "continue"
68-
/// At this step keywords are also considered identifiers.
71+
///
72+
/// At this step, keywords are also considered identifiers.
6973
Ident,
74+
7075
/// Like the above, but containing invalid unicode codepoints.
7176
InvalidIdent,
77+
7278
/// "r#ident"
7379
RawIdent,
74-
/// An unknown prefix like `foo#`, `foo'`, `foo"`. Note that only the
80+
81+
/// An unknown prefix, like `foo#`, `foo'`, `foo"`.
82+
///
83+
/// Note that only the
7584
/// prefix (`foo`) is included in the token, not the separator (which is
7685
/// lexed as its own distinct token). In Rust 2021 and later, reserved
7786
/// prefixes are reported as errors; in earlier editions, they result in a
7887
/// (allowed by default) lint, and are treated as regular identifier
7988
/// tokens.
8089
UnknownPrefix,
81-
/// "12_u8", "1.0e-40", "b"123"". See `LiteralKind` for more details.
90+
91+
/// Examples: `"12_u8"`, `"1.0e-40"`, `b"123`.
92+
///
93+
/// See [LiteralKind] for more details.
8294
Literal { kind: LiteralKind, suffix_start: u32 },
95+
8396
/// "'a"
8497
Lifetime { starts_with_number: bool },
8598

0 commit comments

Comments
 (0)