Skip to content

Commit e517951

Browse files
committed
replace unreachable with error
1 parent bb40417 commit e517951

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/ruff_python_parser/src/parser/expression.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,14 +1685,14 @@ impl<'src> Parser<'src> {
16851685
return;
16861686
}
16871687
tok => {
1688-
// This should never happen because the list parsing will only
1689-
// call this closure for the above token kinds which are the same
1690-
// as in the FIRST set.
1691-
unreachable!(
1692-
"{}: unexpected token `{tok:?}` at {:?}",
1693-
string_kind,
1694-
parser.current_token_range()
1688+
parser.add_error(
1689+
ParseErrorType::OtherError(format!(
1690+
"{string_kind}: unexpected token `{tok:?}`"
1691+
)),
1692+
parser.current_token_range(),
16951693
);
1694+
parser.bump_any();
1695+
return;
16961696
}
16971697
};
16981698
elements.push(element);

0 commit comments

Comments
 (0)