Skip to content

Commit 167ba40

Browse files
committed
Add ErrorGuaranteed to DestructuredFloat::Error
1 parent 3bec617 commit 167ba40

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

+7-7
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> {
@@ -1013,7 +1013,7 @@ impl<'a> Parser<'a> {
10131013
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
10141014
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
10151015
}
1016-
DestructuredFloat::Error => base,
1016+
DestructuredFloat::Error(_) => base,
10171017
})
10181018
}
10191019
_ => {
@@ -1023,7 +1023,7 @@ impl<'a> Parser<'a> {
10231023
}
10241024
}
10251025

1026-
fn error_unexpected_after_dot(&self) {
1026+
fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
10271027
let actual = pprust::token_to_string(&self.token);
10281028
let span = self.token.span;
10291029
let sm = self.psess.source_map();
@@ -1033,7 +1033,7 @@ impl<'a> Parser<'a> {
10331033
}
10341034
_ => (span, actual),
10351035
};
1036-
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
1036+
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
10371037
}
10381038

10391039
// We need an identifier or integer, but the next token is a float.
@@ -1121,8 +1121,8 @@ impl<'a> Parser<'a> {
11211121
// 1.2e+3 | 1.2e-3
11221122
[IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
11231123
// See the FIXME about `TokenCursor` above.
1124-
self.error_unexpected_after_dot();
1125-
DestructuredFloat::Error
1124+
let guar = self.error_unexpected_after_dot();
1125+
DestructuredFloat::Error(guar)
11261126
}
11271127
_ => panic!("unexpected components in a float token: {components:?}"),
11281128
}
@@ -1188,7 +1188,7 @@ impl<'a> Parser<'a> {
11881188
fields.insert(start_idx, Ident::new(symbol2, span2));
11891189
fields.insert(start_idx, Ident::new(symbol1, span1));
11901190
}
1191-
DestructuredFloat::Error => {
1191+
DestructuredFloat::Error(_) => {
11921192
trailing_dot = None;
11931193
fields.insert(start_idx, Ident::new(symbol, self.prev_token.span));
11941194
}

0 commit comments

Comments
 (0)