Skip to content

Commit f7f5ed2

Browse files
committed
Add ErrorGuaranteed to DestructuredFloat::Error
1 parent 5b1d58c commit f7f5ed2

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> {
@@ -1070,7 +1070,7 @@ impl<'a> Parser<'a> {
10701070
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
10711071
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
10721072
}
1073-
DestructuredFloat::Error => base,
1073+
DestructuredFloat::Error(_) => base,
10741074
})
10751075
}
10761076
_ => {
@@ -1080,7 +1080,7 @@ impl<'a> Parser<'a> {
10801080
}
10811081
}
10821082

1083-
fn error_unexpected_after_dot(&self) {
1083+
fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
10841084
let actual = pprust::token_to_string(&self.token);
10851085
let span = self.token.span;
10861086
let sm = self.psess.source_map();
@@ -1090,7 +1090,7 @@ impl<'a> Parser<'a> {
10901090
}
10911091
_ => (span, actual),
10921092
};
1093-
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
1093+
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
10941094
}
10951095

10961096
// We need an identifier or integer, but the next token is a float.
@@ -1178,8 +1178,8 @@ impl<'a> Parser<'a> {
11781178
// 1.2e+3 | 1.2e-3
11791179
[IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
11801180
// See the FIXME about `TokenCursor` above.
1181-
self.error_unexpected_after_dot();
1182-
DestructuredFloat::Error
1181+
let guar = self.error_unexpected_after_dot();
1182+
DestructuredFloat::Error(guar)
11831183
}
11841184
_ => panic!("unexpected components in a float token: {components:?}"),
11851185
}
@@ -1245,7 +1245,7 @@ impl<'a> Parser<'a> {
12451245
fields.insert(start_idx, Ident::new(symbol2, span2));
12461246
fields.insert(start_idx, Ident::new(symbol1, span1));
12471247
}
1248-
DestructuredFloat::Error => {
1248+
DestructuredFloat::Error(_) => {
12491249
trailing_dot = None;
12501250
fields.insert(start_idx, Ident::new(symbol, self.prev_token.span));
12511251
}

0 commit comments

Comments
 (0)