Skip to content

Commit

Permalink
Rollup merge of rust-lang#119231 - aDotInTheVoid:PatKind-struct-bool-…
Browse files Browse the repository at this point in the history
…docs, r=compiler-errors

Clairify `ast::PatKind::Struct` presese of `..` by using an enum instead of a bool

The bool is mainly used for when a `..` is present, but it is also set on recovery to avoid errors. The doc comment not describes both of these cases.

See https://github.com/rust-lang/rust/blob/cee794ee98d49b45a55ba225680d98e0c4672736/compiler/rustc_parse/src/parser/pat.rs#L890-L897 for the only place this is constructed.

r? ``@compiler-errors``
  • Loading branch information
matthiaskrgr authored Dec 23, 2023
2 parents 101bc22 + d9ea102 commit f002221
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,15 @@ impl Rewrite for Pat {
None,
None,
),
PatKind::Struct(ref qself, ref path, ref fields, ellipsis) => {
rewrite_struct_pat(qself, path, fields, ellipsis, self.span, context, shape)
}
PatKind::Struct(ref qself, ref path, ref fields, rest) => rewrite_struct_pat(
qself,
path,
fields,
rest == ast::PatFieldsRest::Rest,
self.span,
context,
shape,
),
PatKind::MacCall(ref mac) => {
rewrite_macro(mac, None, context, shape, MacroPosition::Pat)
}
Expand Down

0 comments on commit f002221

Please sign in to comment.