Rollup merge of #66361 - Centril:66357, r=pnkfelix

parser: don't use `unreachable!()` in `fn unexpected`.

Fixes #66357

r? @estebank
This commit is contained in:
Yuki Okushi 2019-11-14 14:16:23 +09:00 committed by GitHub
commit 8d059974f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View file

@ -443,7 +443,9 @@ impl<'a> Parser<'a> {
crate fn unexpected<T>(&mut self) -> PResult<'a, T> {
match self.expect_one_of(&[], &[]) {
Err(e) => Err(e),
Ok(_) => unreachable!(),
// We can get `Ok(true)` from `recover_closing_delimiter`
// which is called in `expected_one_of_not_found`.
Ok(_) => FatalError.raise(),
}
}