rust/compiler/rustc_parse/src/parser
Noratrieb 8a02724b9d Fix const items not being allowed to be called r#move or r#static
Because of an ambiguity with const closures, the parser needs to ensure
that for a const item, the `const` keyword isn't followed by a `move` or
`static` keyword, as that would indicate a const closure:

```rust
fn main() {
  const move // ...
}
```

This check did not take raw identifiers into account, therefore being
unable to distinguish between `const move` and `const r#move`. The
latter is obviously not a const closure, so it should be allowed as a
const item.

This fixes the check in the parser to only treat `const ...` as a const
closure if it's followed by the *proper keyword*, and not a raw
identifier.

Additionally, this adds a large test that tests for all raw identifiers in
all kinds of positions, including `const`, to prevent issues like this
one from occurring again.
2025-02-16 18:21:40 +01: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 Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
attr_wrapper.rs Rustfmt 2025-02-08 22:12:13 +00:00
diagnostics.rs Rustfmt 2025-02-08 22:12:13 +00:00
expr.rs Rustfmt 2025-02-08 22:12:13 +00:00
generics.rs Stop using span hack for contracts feature gating 2025-02-10 19:51:26 +00:00
item.rs Try to recover from path sep error in parser 2025-02-15 07:44:20 +08:00
mod.rs Fix const items not being allowed to be called r#move or r#static 2025-02-16 18:21:40 +01:00
nonterminal.rs tree-wide: parallel: Fully removed all Lrc, replaced with Arc 2025-02-03 13:25:57 +03:00
pat.rs Do not allow attributes on struct field rest patterns 2025-02-03 14:04:57 +00:00
path.rs Try to recover from path sep error in parser 2025-02-15 07:44:20 +08:00
stmt.rs Rustfmt 2025-02-08 22:12:13 +00:00
tests.rs Stop passing the same resource multiple times when building ParseSess 2025-02-06 17:30:10 +00:00
token_type.rs Rename rustc_contract to contract 2025-02-03 13:55:15 -08:00
ty.rs Trim extra whitespace in fn ptr suggestion span 2025-01-27 17:17:22 +00:00