Skip to content

Commit 9ce026c

Browse files
carbotaniumanfrank-king
authored andcommitted
Be more conservative
1 parent aa94da6 commit 9ce026c

File tree

1 file changed

+3
-4
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+3
-4
lines changed

compiler/rustc_parse/src/parser/ty.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,9 @@ impl<'a> Parser<'a> {
405405
err.span_label(self.token.span, "expected type");
406406
// self.maybe_annotate_with_ascription(&mut err, true);
407407

408-
// `struct` is a strict keyword, so we can check it here as
409-
// we will be erroring otherwise
410-
// FIXME: or should we not?
411-
if self.token.is_keyword(kw::Struct) {
408+
if allow_anonymous_types == AllowAnonymousTypes::OnlyRecover
409+
&& self.token.is_keyword(kw::Struct)
410+
{
412411
// Recover the parser from anonymous types anywhere other than field types.
413412
let snapshot = self.create_snapshot_for_diagnostic();
414413
match self.parse_anonymous_ty(lo) {

0 commit comments

Comments
 (0)