Skip to content

Commit f1e47c6

Browse files
committed
Add ErrorGuaranteed to DestructuredFloat::Error
1 parent 7bdae13 commit f1e47c6

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
@@ -102,7 +102,7 @@ enum DestructuredFloat {
102102
/// 1.2 | 1.2e3
103103
MiddleDot(Symbol, Span, Span, Symbol, Span),
104104
/// Invalid
105-
Error,
105+
Error(ErrorGuaranteed),
106106
}
107107

108108
impl<'a> Parser<'a> {
@@ -1048,7 +1048,7 @@ impl<'a> Parser<'a> {
10481048
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
10491049
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
10501050
}
1051-
DestructuredFloat::Error => base,
1051+
DestructuredFloat::Error(_) => base,
10521052
})
10531053
}
10541054
_ => {
@@ -1058,7 +1058,7 @@ impl<'a> Parser<'a> {
10581058
}
10591059
}
10601060

1061-
fn error_unexpected_after_dot(&self) {
1061+
fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
10621062
let actual = pprust::token_to_string(&self.token);
10631063
let span = self.token.span;
10641064
let sm = self.psess.source_map();
@@ -1068,7 +1068,7 @@ impl<'a> Parser<'a> {
10681068
}
10691069
_ => (span, actual),
10701070
};
1071-
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
1071+
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
10721072
}
10731073

10741074
// We need an identifier or integer, but the next token is a float.
@@ -1156,8 +1156,8 @@ impl<'a> Parser<'a> {
11561156
// 1.2e+3 | 1.2e-3
11571157
[IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
11581158
// See the FIXME about `TokenCursor` above.
1159-
self.error_unexpected_after_dot();
1160-
DestructuredFloat::Error
1159+
let guar = self.error_unexpected_after_dot();
1160+
DestructuredFloat::Error(guar)
11611161
}
11621162
_ => panic!("unexpected components in a float token: {components:?}"),
11631163
}
@@ -1223,7 +1223,7 @@ impl<'a> Parser<'a> {
12231223
fields.insert(start_idx, Ident::new(symbol2, span2));
12241224
fields.insert(start_idx, Ident::new(symbol1, span1));
12251225
}
1226-
DestructuredFloat::Error => {
1226+
DestructuredFloat::Error(_) => {
12271227
trailing_dot = None;
12281228
fields.insert(start_idx, Ident::new(symbol, self.prev_token.span));
12291229
}

0 commit comments

Comments
 (0)