Skip to content

Commit

Permalink
Remove ErrorGuaranteed retval from error_unexpected_after_dot.
Browse files Browse the repository at this point in the history
It was added in rust-lang#130349, but it's not used meaningfully, and causes
difficulties for Nonterminal removal in rust-lang#124141.
  • Loading branch information
nnethercote authored and icmccorm committed Nov 22, 2024
1 parent c074417 commit 5104d27
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(super) enum DestructuredFloat {
/// 1.2 | 1.2e3
MiddleDot(Symbol, Span, Span, Symbol, Span),
/// Invalid
Error(ErrorGuaranteed),
Error,
}

impl<'a> Parser<'a> {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ impl<'a> Parser<'a> {
self.mk_expr_tuple_field_access(lo, ident1_span, base, sym1, None);
self.mk_expr_tuple_field_access(lo, ident2_span, base1, sym2, suffix)
}
DestructuredFloat::Error(_) => base,
DestructuredFloat::Error => base,
})
}
_ => {
Expand All @@ -1015,7 +1015,7 @@ impl<'a> Parser<'a> {
}
}

fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
fn error_unexpected_after_dot(&self) {
let actual = pprust::token_to_string(&self.token);
let span = self.token.span;
let sm = self.psess.source_map();
Expand All @@ -1025,7 +1025,7 @@ impl<'a> Parser<'a> {
}
_ => (span, actual),
};
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual })
self.dcx().emit_err(errors::UnexpectedTokenAfterDot { span, actual });
}

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

0 comments on commit 5104d27

Please sign in to comment.