about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-03-21 16:14:56 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-03-25 13:08:07 +1100
commitdce0f7f5c2a62a5aabb1d02351473d6f2b125541 (patch)
tree36892cddc3eb0c12b5ff096b1cb93d06c3f5674d /compiler/rustc_codegen_llvm/src/errors.rs
parent9c091160dc57aa5224a35e6755c357f7089ff2e5 (diff)
downloadrust-dce0f7f5c2a62a5aabb1d02351473d6f2b125541.tar.gz
rust-dce0f7f5c2a62a5aabb1d02351473d6f2b125541.zip
Clarify `parse_dot_suffix_expr`.
For the `MiddleDot` case, current behaviour:
- For a case like `1.2`, `sym1` is `1` and `sym2` is `2`, and `self.token`
  holds `1.2`.
- It creates a new ident token from `sym1` that it puts into `self.token`.
- Then it does `bump_with` with a new dot token, which moves the `sym1`
  token into `prev_token`.
- Then it does `bump_with` with a new ident token from `sym2`, which moves the
  `dot` token into `prev_token` and discards the `sym1` token.
- Then it does `bump`, which puts whatever is next into `self.token`,
  moves the `sym2` token into `prev_token`, and discards the `dot` token
  altogether.

New behaviour:
- Skips creating and inserting the `sym1` and dot tokens, because they are
  unnecessary.
- This also demonstrates that the comment about `Spacing::Alone` is
  wrong -- that value is never used. That comment was added in #77250,
  and AFAICT it has always been incorrect.

The commit also expands comments. I found this code hard to read
previously, the examples in comments make it easier.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions