diff options
| author | Noratrieb <48135649+Noratrieb@users.noreply.github.com> | 2025-02-16 16:20:53 +0100 |
|---|---|---|
| committer | Noratrieb <48135649+Noratrieb@users.noreply.github.com> | 2025-02-16 18:21:40 +0100 |
| commit | 8a02724b9d0bf3a9e449a04c2d7efaa8a0521e1b (patch) | |
| tree | f168066395031d326235c77dc40ee56b87aac702 /compiler/rustc_codegen_llvm/src | |
| parent | 23032f31c91f2bb74ba4be20e075fcc929f66527 (diff) | |
| download | rust-8a02724b9d0bf3a9e449a04c2d7efaa8a0521e1b.tar.gz rust-8a02724b9d0bf3a9e449a04c2d7efaa8a0521e1b.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
