rust/compiler/rustc_parse/src/parser
Matthias Krüger bf49dfc943
Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk
Detect and provide suggestion for `&raw EXPR`

When emitting an error in the parser, and we detect that the previous token was `raw` and we *could* have consumed `const`/`mut`, suggest that this may have been a mistyped raw ref expr. To do this, we add `const`/`mut` to the expected token set when parsing `&raw` as an expression (which does not affect the "good path" of parsing, for the record).

This is kind of a rudimentary error improvement, since it doesn't actually attempt to recover anything, leading to some other knock-on errors b/c we still treat `&raw` as the expression that was parsed... but at least we add the suggestion! I don't think the parser grammar means we can faithfully recover `&raw EXPR` early, i.e. during `parse_expr_borrow`.

Fixes #133231
2025-04-14 18:15:31 +02:00
..
mut_visit Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tokenstream update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
attr.rs Provide helpful diagnostics for shebang lookalikes 2025-03-13 19:53:53 +05:30
attr_wrapper.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00
diagnostics.rs Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk 2025-04-14 18:15:31 +02:00
expr.rs Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk 2025-04-14 18:15:31 +02:00
generics.rs Implment #[cfg] and #[cfg_attr] in where clauses 2025-03-01 22:02:46 +08:00
item.rs Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
mod.rs Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov 2025-04-14 03:56:55 +00:00
nonterminal.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00
pat.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00
path.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00
stmt.rs Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk 2025-04-14 18:15:31 +02:00
tests.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00
token_type.rs Add the feature gate for the super let experiment. 2025-03-28 19:06:18 +01:00
ty.rs Impl Copy for Token and TokenKind. 2025-04-02 16:16:49 +11:00