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 cee794ee98/compiler/rustc_parse/src/parser/pat.rs (L890-L897)
for the only place this is constructed.
r? ``@compiler-errors``
This commit is contained in:
commit
bdc4480914
7 changed files with 30 additions and 15 deletions
|
@ -1427,7 +1427,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
self.nbsp();
|
||||
self.word("{");
|
||||
let empty = fields.is_empty() && !etc;
|
||||
let empty = fields.is_empty() && *etc == ast::PatFieldsRest::None;
|
||||
if !empty {
|
||||
self.space();
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ impl<'a> State<'a> {
|
|||
},
|
||||
|f| f.pat.span,
|
||||
);
|
||||
if *etc {
|
||||
if *etc == ast::PatFieldsRest::Rest {
|
||||
if !fields.is_empty() {
|
||||
self.word_space(",");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue