Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiser
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:
@@ -446,11 +446,13 @@ impl<'a> Parser<'a> {
|
||||
)
|
||||
.emit();
|
||||
*self = snapshot;
|
||||
Ok(self.mk_block(
|
||||
let mut tail = self.mk_block(
|
||||
vec![self.mk_stmt_err(expr.span)],
|
||||
s,
|
||||
lo.to(self.prev_token.span),
|
||||
))
|
||||
);
|
||||
tail.could_be_bare_literal = true;
|
||||
Ok(tail)
|
||||
}
|
||||
(Err(mut err), Ok(tail)) => {
|
||||
// We have a block tail that contains a somehow valid type ascription expr.
|
||||
@@ -463,7 +465,10 @@ impl<'a> Parser<'a> {
|
||||
self.consume_block(token::Brace, ConsumeClosingDelim::Yes);
|
||||
Err(err)
|
||||
}
|
||||
(Ok(_), Ok(tail)) => Ok(tail),
|
||||
(Ok(_), Ok(mut tail)) => {
|
||||
tail.could_be_bare_literal = true;
|
||||
Ok(tail)
|
||||
}
|
||||
});
|
||||
}
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user