about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-11-14 14:16:23 +0900
committerGitHub <noreply@github.com>2019-11-14 14:16:23 +0900
commit8d059974f79015946090e6b2e1b40db7b7cf2abb (patch)
treeea8d56767db7c1ed8d1c7b42ff9abdea0d196e9a /src/librustc_parse/parser
parent28c0e40b44f81eb810643d9286beb26c4e22238e (diff)
parentdcd91d5ceb1990a48c985e01cbe6fca7e274f016 (diff)
downloadrust-8d059974f79015946090e6b2e1b40db7b7cf2abb.tar.gz
rust-8d059974f79015946090e6b2e1b40db7b7cf2abb.zip
Rollup merge of #66361 - Centril:66357, r=pnkfelix
parser: don't use `unreachable!()` in `fn unexpected`.

Fixes #66357

r? @estebank
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index a491d91e20f..d5d8604be85 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -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(),
         }
     }