Skip to content

Rollup of 8 pull requests #133219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4a5bcbb
Add vec_deque::Iter::as_slices and friends
Apr 14, 2024
37ea202
ci: use free runner in dist-i686-msvc
marcoieni Nov 18, 2024
09c2684
Add Visitor::visit_fn_decl
maxcabrajac Nov 18, 2024
e65deb5
Add Visitor::visit_qself
maxcabrajac Nov 18, 2024
f6340f1
Add MutVisitor::visit_fn_ret_ty
maxcabrajac Nov 18, 2024
7bffa31
Mention std::fs::remove_dir_all in std::fs::remove_dir
n0toose Nov 18, 2024
df29f9b
Improve `fake_ident_or_unknown_prefix`.
nnethercote Nov 19, 2024
2c7c369
Improve `TokenKind` comments.
nnethercote Nov 19, 2024
e9a0c3c
Remove `TokenKind::InvalidPrefix`.
nnethercote Nov 19, 2024
38f0c09
Default-enable `llvm_tools_enabled` when no `config.toml` is present
jieyouxu Nov 19, 2024
fcfb782
Register change info
jieyouxu Nov 19, 2024
4b5c883
Explicitly disable llvm tools for cranelift
jieyouxu Nov 19, 2024
616013f
Correct the tier listing of `wasm32-wasip2`
alexcrichton Nov 19, 2024
7ac4c04
Add std::thread::add_spawn_hook.
m-ou-se May 22, 2024
ef9055f
Use add_spawn_hook for libtest's output capturing.
m-ou-se May 22, 2024
947354f
Update thread spawn hooks.
m-ou-se Oct 24, 2024
f2bf9e1
Add thread Builder::no_hooks().
m-ou-se Oct 24, 2024
5a80b48
Use Send + Sync for spawn hooks.
m-ou-se Oct 24, 2024
24fec0d
Add tracking issue.
m-ou-se Nov 12, 2024
38b9a44
Fix tracking issue.
m-ou-se Nov 19, 2024
b96f023
Address review comments.
m-ou-se Nov 19, 2024
691796b
Update doc comments for spawn hook.
m-ou-se Nov 19, 2024
001f98a
Rollup merge of #123947 - zopsicle:vec_deque-Iter-as_slices, r=Amanieu
matthiaskrgr Nov 19, 2024
6c127f3
Rollup merge of #125405 - m-ou-se:thread-add-spawn-hook, r=WaffleLapkin
matthiaskrgr Nov 19, 2024
c74e5a8
Rollup merge of #133175 - MarcoIeni:dist-i686-msvc-free, r=Kobzol
matthiaskrgr Nov 19, 2024
d5dca43
Rollup merge of #133183 - n0toose:improve-remove-dir-docs, r=joboet
matthiaskrgr Nov 19, 2024
022bb9c
Rollup merge of #133188 - maxcabrajac:walk_no_visit, r=petrochenkov
matthiaskrgr Nov 19, 2024
841243f
Rollup merge of #133201 - nnethercote:rm-TokenKind-InvalidPrefix, r=c…
matthiaskrgr Nov 19, 2024
49aec06
Rollup merge of #133207 - jieyouxu:macos-objcopy, r=Kobzol,bjorn3
matthiaskrgr Nov 19, 2024
2467654
Rollup merge of #133213 - alexcrichton:fix-tier-listing, r=jieyouxu
matthiaskrgr Nov 19, 2024
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
Prev Previous commit
Next Next commit
Improve TokenKind comments.
- Improve wording.
- Use backticks consistently for examples.
  • Loading branch information
nnethercote committed Nov 19, 2024
commit 2c7c3697dbaac3e0599aa0e7cd3581822caec17b
80 changes: 39 additions & 41 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ impl Token {
/// Enum representing common lexeme types.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TokenKind {
// Multi-char tokens:
/// "// comment"
/// A line comment, e.g. `// comment`.
LineComment { doc_style: Option<DocStyle> },

/// `/* block comment */`
/// A block comment, e.g. `/* block comment */`.
///
/// Block comments can be recursive, so a sequence like `/* /* */`
/// will not be considered terminated and will result in a parsing error.
Expand All @@ -70,18 +69,17 @@ pub enum TokenKind {
/// Any whitespace character sequence.
Whitespace,

/// "ident" or "continue"
///
/// At this step, keywords are also considered identifiers.
/// An identifier or keyword, e.g. `ident` or `continue`.
Ident,

/// Like the above, but containing invalid unicode codepoints.
/// An identifier that is invalid because it contains emoji.
InvalidIdent,

/// "r#ident"
/// A raw identifier, e.g. "r#ident".
RawIdent,

/// An unknown prefix, like `foo#`, `foo'`, `foo"`.
/// An unknown literal prefix, like `foo#`, `foo'`, `foo"`. Excludes
/// literal prefixes that contain emoji, which are considered "invalid".
///
/// Note that only the
/// prefix (`foo`) is included in the token, not the separator (which is
Expand All @@ -93,11 +91,12 @@ pub enum TokenKind {

/// An unknown prefix in a lifetime, like `'foo#`.
///
/// Note that like above, only the `'` and prefix are included in the token
/// Like `UnknownPrefix`, only the `'` and prefix are included in the token
/// and not the separator.
UnknownPrefixLifetime,

/// `'r#lt`, which in edition < 2021 is split into several tokens: `'r # lt`.
/// A raw lifetime, e.g. `'r#foo`. In edition < 2021 it will be split into
/// several tokens: `'r` and `#` and `foo`.
RawLifetime,

/// Similar to the above, but *always* an error on every edition. This is used
Expand All @@ -110,70 +109,69 @@ pub enum TokenKind {
/// Split into the component tokens on older editions.
GuardedStrPrefix,

/// Examples: `12u8`, `1.0e-40`, `b"123"`. Note that `_` is an invalid
/// Literals, e.g. `12u8`, `1.0e-40`, `b"123"`. Note that `_` is an invalid
/// suffix, but may be present here on string and float literals. Users of
/// this type will need to check for and reject that case.
///
/// See [LiteralKind] for more details.
Literal { kind: LiteralKind, suffix_start: u32 },

/// "'a"
/// A lifetime, e.g. `'a`.
Lifetime { starts_with_number: bool },

// One-char tokens:
/// ";"
/// `;`
Semi,
/// ","
/// `,`
Comma,
/// "."
/// `.`
Dot,
/// "("
/// `(`
OpenParen,
/// ")"
/// `)`
CloseParen,
/// "{"
/// `{`
OpenBrace,
/// "}"
/// `}`
CloseBrace,
/// "["
/// `[`
OpenBracket,
/// "]"
/// `]`
CloseBracket,
/// "@"
/// `@`
At,
/// "#"
/// `#`
Pound,
/// "~"
/// `~`
Tilde,
/// "?"
/// `?`
Question,
/// ":"
/// `:`
Colon,
/// "$"
/// `$`
Dollar,
/// "="
/// `=`
Eq,
/// "!"
/// `!`
Bang,
/// "<"
/// `<`
Lt,
/// ">"
/// `>`
Gt,
/// "-"
/// `-`
Minus,
/// "&"
/// `&`
And,
/// "|"
/// `|`
Or,
/// "+"
/// `+`
Plus,
/// "*"
/// `*`
Star,
/// "/"
/// `/`
Slash,
/// "^"
/// `^`
Caret,
/// "%"
/// `%`
Percent,

/// Unknown token, not expected by the lexer, e.g. "№"
Expand Down