rust/tests/ui/parser/diff-markers
Nicholas Nethercote 2e412fef75 Remove `Lexer`'s dependency on `Parser`.
Lexing precedes parsing, as you'd expect: `Lexer` creates a
`TokenStream` and `Parser` then parses that `TokenStream`.

But, in a horrendous violation of layering abstractions and common
sense, `Lexer` depends on `Parser`! The `Lexer::unclosed_delim_err`
method does some error recovery that relies on creating a `Parser` to do
some post-processing of the `TokenStream` that the `Lexer` just created.

This commit just removes `unclosed_delim_err`. This change removes
`Lexer`'s dependency on `Parser`, and also means that `lex_token_tree`'s
return value can have a more typical form.

The cost is slightly worse error messages in two obscure cases, as shown
in these tests:
- tests/ui/parser/brace-in-let-chain.rs: there is slightly less
  explanation in this case involving an extra `{`.
- tests/ui/parser/diff-markers/unclosed-delims{,-in-macro}.rs: the diff
  marker detection is no longer supported (because that detection is
  implemented in the parser).

In my opinion this cost is outweighed by the magnitude of the code
cleanup.
2024-12-13 07:10:20 +11:00
..
enum-2.rs
enum-2.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
enum.rs
enum.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
fn-arg.rs
fn-arg.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
item-with-attr.rs
item-with-attr.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
item.rs
item.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
statement.rs
statement.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
struct-expr.rs
struct-expr.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
struct.rs
struct.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
trait-item.rs
trait-item.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
tuple-struct.rs
tuple-struct.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00
unclosed-delims-in-macro.rs Remove `Lexer`'s dependency on `Parser`. 2024-12-13 07:10:20 +11:00
unclosed-delims-in-macro.stderr Remove `Lexer`'s dependency on `Parser`. 2024-12-13 07:10:20 +11:00
unclosed-delims.rs Remove `Lexer`'s dependency on `Parser`. 2024-12-13 07:10:20 +11:00
unclosed-delims.stderr Remove `Lexer`'s dependency on `Parser`. 2024-12-13 07:10:20 +11:00
use-statement.rs
use-statement.stderr Improve conflict marker recovery 2024-06-19 00:27:41 +02:00