Detect bare blocks with type ascription that were meant to be a struct literal

Address part of #34255.

Potential improvement: silence the other knock down errors in
`issue-34255-1.rs`.
This commit is contained in:
Esteban Kuber 2021-09-02 18:34:03 +00:00
parent fcce644119
commit 12ce6e9c60
13 changed files with 67 additions and 5 deletions

View file

@ -574,7 +574,14 @@ impl<'a> Parser<'a> {
}
pub(super) fn mk_block(&self, stmts: Vec<Stmt>, rules: BlockCheckMode, span: Span) -> P<Block> {
P(Block { stmts, id: DUMMY_NODE_ID, rules, span, tokens: None })
P(Block {
stmts,
id: DUMMY_NODE_ID,
rules,
span,
tokens: None,
could_be_bare_literal: false,
})
}
pub(super) fn mk_stmt(&self, span: Span, kind: StmtKind) -> Stmt {