Matthias Krüger
ed45c1187f
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 .
2025-02-20 00:55:16 +01:00
..
2025-02-16 18:37:50 +01:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-12 20:09:56 -05:00
2025-02-14 00:37:23 +01:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-12 20:09:56 -05:00
2025-02-15 16:47:30 +01:00
2025-02-13 23:49:09 +01:00
2025-02-06 22:28:44 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-15 21:49:53 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-14 14:05:27 -08:00
2025-02-13 03:53:32 -05:00
2025-02-06 23:44:23 +01:00
2025-02-10 20:21:39 +00:00
2025-01-31 20:39:01 +00:00
2025-01-26 21:20:31 +01:00
2025-02-15 03:41:07 +01:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-02 15:07:13 +01:00
2025-02-14 00:44:10 -08:00
2025-02-11 01:02:43 -05:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-03 19:38:52 +00:00
2025-02-09 10:05:13 -06:00
2025-02-14 00:37:23 +01:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-09 20:40:43 +08:00
2025-02-10 20:21:39 +00:00
2025-02-18 10:36:53 -08:00
2025-02-11 09:19:37 +00:00
2025-02-06 13:09:59 +01:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-17 11:33:07 +00:00
2025-02-14 00:44:10 -08:00
2025-02-15 20:38:14 +00:00
2025-02-10 20:21:39 +00:00
2025-02-06 23:44:23 +01:00
2025-02-03 13:12:41 -08:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-02 02:39:43 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-03 19:00:22 +00:00
2025-02-17 09:30:40 +11:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-06 22:28:44 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-17 17:21:24 +00:00
2025-02-10 20:21:39 +00:00
2025-02-15 07:44:20 +08:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-17 17:21:24 +00:00
2025-02-20 00:55:13 +01:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:37:23 +01:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-09 20:45:47 -08:00
2025-02-15 03:41:07 +01:00
2025-02-15 16:47:30 +01:00
2025-02-19 01:30:11 +01:00
2025-02-10 20:21:39 +00:00
2025-02-03 19:43:24 +00:00
2025-02-10 13:01:55 +00:00
2025-02-10 20:21:39 +00:00
2025-02-12 20:09:56 -05:00
2025-02-18 13:22:45 +01:00
2025-02-03 03:43:14 +01:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-11 19:42:47 -08:00
2025-02-07 16:02:19 +00:00
2025-02-19 19:24:49 +01:00
2025-02-10 20:21:39 +00:00
2025-02-08 16:33:36 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-01-28 19:35:51 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-01-30 21:33:11 -07:00
2025-02-19 01:30:11 +01:00
2025-02-06 22:28:44 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-12 20:09:56 -05:00
2025-02-03 22:27:17 +08:00
2025-01-26 13:55:59 +00:00
2025-02-20 00:55:16 +01:00
2025-02-19 01:43:38 -08:00
2025-02-14 00:44:10 -08:00
2025-02-11 19:42:47 -08:00
2025-02-18 16:22:16 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-01-30 20:37:56 -07:00
2025-01-30 17:10:19 +00:00
2025-02-15 12:18:30 +08:00
2025-02-10 20:21:39 +00:00
2025-02-06 21:56:24 +01:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-01-27 02:28:04 +01:00
2025-02-06 23:44:23 +01:00
2025-02-11 05:27:49 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-13 23:49:09 +01:00
2025-02-14 00:44:10 -08:00
2025-01-27 23:42:47 +00:00
2025-02-15 12:18:30 +08:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-18 18:40:49 +01:00
2025-02-14 16:23:27 +01:00
2025-02-15 07:44:20 +08:00
2025-02-11 20:18:01 -08:00
2025-02-02 22:12:49 +07:00
2025-02-14 19:47:52 +01:00
2025-02-14 00:44:10 -08:00
2025-01-29 15:45:13 +00:00
2025-02-03 10:39:32 -05:00
2025-02-11 09:19:37 +00:00
2025-02-19 18:52:08 +01:00
2025-02-14 00:44:10 -08:00
2025-01-27 02:28:04 +01:00
2025-02-18 17:34:16 +00:00
2025-02-18 17:34:16 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-11 23:47:56 +00:00
2025-02-15 12:18:30 +08:00
2025-02-03 19:51:20 +00:00
2025-02-17 11:33:07 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-01-27 02:28:04 +01:00
2025-02-10 20:21:39 +00:00
2025-02-16 09:08:24 +00:00
2025-02-14 00:44:10 -08:00
2025-02-13 03:45:07 +00:00
2025-02-11 09:19:37 +00:00
2025-02-10 20:21:39 +00:00
2025-02-17 11:33:07 +00:00
2025-02-03 19:00:22 +00:00
2025-02-04 21:42:43 +05:30
2025-01-31 09:59:41 +01:00
2025-01-31 09:59:41 +01:00
2025-02-10 20:21:39 +00:00
2025-02-03 10:39:32 -05:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-16 18:37:50 +01:00
2025-02-16 18:37:50 +01:00
2025-02-16 18:37:50 +01:00
2025-02-16 18:37:50 +01:00
2025-02-16 18:37:50 +01:00
2025-02-16 18:37:50 +01:00
2025-02-15 20:02:16 +01:00
2025-02-15 20:02:16 +01:00
2025-02-18 16:11:41 +01:00
2025-02-18 16:11:41 +01:00
2025-02-06 22:28:44 +00:00
2025-01-30 17:10:19 +00:00
2025-01-30 17:10:19 +00:00
2025-02-10 20:21:39 +00:00
2025-02-06 15:05:53 -05:00
2025-02-06 22:28:44 +00:00