Skip to content

Commit 003da02

Browse files
committed
Add ErrorGuaranteed to DestructuredFloat::Error
1 parent f9567d0 commit 003da02

File tree

1 file changed

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

1 file changed

+7
-7
lines changed

Diff for: compiler/rustc_parse/src/parser/expr.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum DestructuredFloat {
4949
/// 1.2 | 1.2e3
5050
MiddleDot(Symbol, Span, Span, Symbol, Span),
5151
/// Invalid
52-
Error,
52+
Error(ErrorGuaranteed),
5353
}
5454

5555
impl<'a> Parser<'a> {
@@ -1008,7 +1008,7 @@ impl<'a> Parser<'a> {
10081008
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
10091009
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
10101010
}
1011-
DestructuredFloat::Error => base,
1011+
DestructuredFloat::Error(_) => base,
10121012
})
10131013
}
10141014
_ => {
@@ -1018,7 +1018,7 @@ impl<'a> Parser<'a> {
10181018
}
10191019
}
10201020

1021-
fn error_unexpected_after_dot(&self) {
1021+
fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
10221022
let actual = pprust::token_to_string(&self.token);
10231023
let span = self.token.span;
10241024
let sm = self.psess.source_map();
@@ -1028,7 +1028,7 @@ impl<'a> Parser<'a> {
10281028
}
10291029
_ => (span, actual),
10301030
};
1031-
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
1031+
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
10321032
}
10331033

10341034
// We need an identifier or integer, but the next token is a float.
@@ -1116,8 +1116,8 @@ impl<'a> Parser<'a> {
11161116
// 1.2e+3 | 1.2e-3
11171117
[IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
11181118
// See the FIXME about `TokenCursor` above.
1119-
self.error_unexpected_after_dot();
1120-
DestructuredFloat::Error
1119+
let guar = self.error_unexpected_after_dot();
1120+
DestructuredFloat::Error(guar)
11211121
}
11221122
_ => panic!("unexpected components in a float token: {components:?}"),
11231123
}
@@ -1183,7 +1183,7 @@ impl<'a> Parser<'a> {
11831183
fields.insert(start_idx, Ident::new(symbol2, span2));
11841184
fields.insert(start_idx, Ident::new(symbol1, span1));
11851185
}
1186-
DestructuredFloat::Error => {
1186+
DestructuredFloat::Error(_) => {
11871187
trailing_dot = None;
11881188
fields.insert(start_idx, Ident::new(symbol, self.prev_token.span));
11891189
}

0 commit comments

Comments
 (0)