Files
rust/compiler/rustc_parse
León Orell Valerian Liehr 8a845e5d15 Clarify the code responsible for parsing bare trait object types
1. Rename `parse_ty_tuple_or_parens` to `parse_paren_start_ty` since it
   doesn't just parse parenthesized types and tuple types, it also parses
   bare trait object types where the first bound is parenthesized.
   Naming is inspired by `parse_path_start_ty`.
2. Don't use `parse_remaining_bounds_path` ("finish parsing bare trait
   object type") when recovering from `for<…> impl …` / `for<…> impl …`
   since we're in fact not parsing a bare trait object type but either an
   impl-Trait type or a dyn-Trait type. This means we no longer need to
   match on the `TyKind` to extract the `bounds`.
3. Rename `parse_remaining_bounds_path` to
   `finish_parsing_bare_trait_object_ty` since the previous name really
   didn't make it clear that it's specific to bare trait object types.
4. Add a bunch of comments explaining what we're doing in (now)
   `parse_paren_start_ty` to successfully parse a bare trait object type
   where the first bound is parenthesized.
5. Inline `parse_remaining_bounds` since it didn't really have any reason
   to exist. The callsites look just fine or even better with the inlined
   body.
2026-09-07 21:43:51 +02:00
..