Skip to content

Commit e8f8b52

Browse files
committed
Add ErrorGuaranteed to DestructuredFloat::Error
1 parent 08a9ca7 commit e8f8b52

File tree

1 file changed

+7
-7
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+7
-7
lines changed

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ enum DestructuredFloat {
5656
/// 1.2 | 1.2e3
5757
MiddleDot(Symbol, Span, Span, Symbol, Span),
5858
/// Invalid
59-
Error,
59+
Error(ErrorGuaranteed),
6060
}
6161

6262
impl<'a> Parser<'a> {
@@ -1000,7 +1000,7 @@ impl<'a> Parser<'a> {
10001000
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
10011001
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
10021002
}
1003-
DestructuredFloat::Error => base,
1003+
DestructuredFloat::Error(_) => base,
10041004
})
10051005
}
10061006
_ => {
@@ -1010,7 +1010,7 @@ impl<'a> Parser<'a> {
10101010
}
10111011
}
10121012

1013-
fn error_unexpected_after_dot(&self) {
1013+
fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
10141014
let actual = pprust::token_to_string(&self.token);
10151015
let span = self.token.span;
10161016
let sm = self.psess.source_map();
@@ -1020,7 +1020,7 @@ impl<'a> Parser<'a> {
10201020
}
10211021
_ => (span, actual),
10221022
};
1023-
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
1023+
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
10241024
}
10251025

10261026
// We need an identifier or integer, but the next token is a float.
@@ -1108,8 +1108,8 @@ impl<'a> Parser<'a> {
11081108
// 1.2e+3 | 1.2e-3
11091109
[IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
11101110
// See the FIXME about `TokenCursor` above.
1111-
self.error_unexpected_after_dot();
1112-
DestructuredFloat::Error
1111+
let guar = self.error_unexpected_after_dot();
1112+
DestructuredFloat::Error(guar)
11131113
}
11141114
_ => panic!("unexpected components in a float token: {components:?}"),
11151115
}
@@ -1175,7 +1175,7 @@ impl<'a> Parser<'a> {
11751175
fields.insert(start_idx, Ident::new(symbol2, span2));
11761176
fields.insert(start_idx, Ident::new(symbol1, span1));
11771177
}
1178-
DestructuredFloat::Error => {
1178+
DestructuredFloat::Error(_) => {
11791179
trailing_dot = None;
11801180
fields.insert(start_idx, Ident::new(symbol, self.prev_token.span));
11811181
}

0 commit comments

Comments
 (0)