]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_parse/parser/mod.rs
Update to use new librustc_error_codes library
[rust.git] / src / librustc_parse / parser / mod.rs
index a491d91e20fb23ecdd4def6449993e651671d31e..22aa6b80ab7e1c9d8f425e7f25445b9c35692610 100644 (file)
@@ -37,6 +37,8 @@
 use std::{cmp, mem, slice};
 use std::path::PathBuf;
 
+use rustc_error_codes::*;
+
 bitflags::bitflags! {
     struct Restrictions: u8 {
         const STMT_EXPR         = 1 << 0;
@@ -443,7 +445,9 @@ pub(super) fn this_token_descr(&self) -> String {
     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(),
         }
     }