about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-23 15:59:30 +0200
committerGitHub <noreply@github.com>2025-07-23 15:59:30 +0200
commit80342618e1f7dfb32b5d35d6fcb204b302e70cdf (patch)
tree789a52686fcb26d30625fe588e08cb75ea88df3e /compiler/rustc_const_eval
parent546929f276600f9bc794af9d4c07eac14ef6c74a (diff)
parent2832517ba174906b6d6ebedf4893dca8d8a98f55 (diff)
downloadrust-80342618e1f7dfb32b5d35d6fcb204b302e70cdf.tar.gz
rust-80342618e1f7dfb32b5d35d6fcb204b302e70cdf.zip
Rollup merge of #144239 - xizheyin:clean-lexer, r=fee1-dead
Clean `rustc/parse/src/lexer` to improve maintainability

This PR refactors the lexer code to improve maintainability and eliminate code duplication.
In the first commit, I improve the error handling:
- rename `make_unclosed_delims_error` to more appropriate `make_mismatched_closing_delims_errors`
- changes return type from Option<Diag> to `Vec<Diag>` to avoid lengthy vec processing at `lex_token_trees`
- use `splice` instead of `extend` to make the logic clearer, since `errs` sounds more generic and better suited as a return value

In the second commit, I replace the magic number 5 with UNCLOSED_DELIMITER_SHOW_LIMIT constant.

In the third commit, I moves `eof_err` function below parsing logic for better code flow.

In the forth one, I extract `calculate_spacing` function to eliminate duplicate spacing logic between `bump` and `bump_minimal` functions.

r? compiler
Diffstat (limited to 'compiler/rustc_const_eval')
0 files changed, 0 insertions, 0 deletions