diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-12-23 16:23:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-23 16:23:54 +0100 |
| commit | f002221a531b6e80ca5e1d7bb665356bed71344a (patch) | |
| tree | 0a52bc5ba4a7b045a7eb628c07d16fcbba1d2e08 | |
| parent | 101bc225d88191fd8bb415d3351ef7b2fd5054b0 (diff) | |
| parent | d9ea1027b52b94924c00a1ee2eb543f44f64a4e2 (diff) | |
| download | rust-f002221a531b6e80ca5e1d7bb665356bed71344a.tar.gz rust-f002221a531b6e80ca5e1d7bb665356bed71344a.zip | |
Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-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``
| -rw-r--r-- | src/patterns.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/patterns.rs b/src/patterns.rs index 8504999b8ff..0fa6edaa5d7 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -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) } |
