about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/allocator.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-20 00:55:16 +0100
committerGitHub <noreply@github.com>2025-02-20 00:55:16 +0100
commited45c1187fc94990cd633db47a34696db7ffd580 (patch)
tree4bb904036844c43d4fc40b4395853d6738674abf /compiler/rustc_codegen_llvm/src/allocator.rs
parentbe73ea82ce2a60c851e84bcf51caa95eca7693e3 (diff)
parenta090e76dab39b3771b5e99096766b5ffac588145 (diff)
downloadrust-ed45c1187fc94990cd633db47a34696db7ffd580.tar.gz
rust-ed45c1187fc94990cd633db47a34696db7ffd580.zip
Rollup merge of #137281 - estebank:doc-comment-syntax-error, r=compiler-errors
Tweak "expected ident" parse error to avoid talking about doc comments

When encountering a doc comment without an identifier after, we'd unconditionally state "this doc comment doesn't document anything", swallowing the *actual* error which is that the thing *after* the doc comment wasn't expected. Added a check that the found token is something that "conceptually" closes the previous item before emitting that error, otherwise just complain about the missing identifier.

In both of the following cases, the syntax error follows a doc comment:
```
error: expected identifier, found keyword `Self`
  --> $DIR/doc-before-bad-variant.rs:4:5
   |
LL | enum TestEnum {
   |      -------- while parsing this enum
...
LL |     Self,
   |     ^^^^ expected identifier, found keyword
   |
   = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
```
```
error: expected identifier, found `<`
  --> $DIR/doc-before-syntax-error.rs:2:1
   |
LL | <>
   | ^ expected identifier
```

Fix #71982.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/allocator.rs')
0 files changed, 0 insertions, 0 deletions