diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-13 12:05:37 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-13 12:05:37 +0100 |
| commit | dcd91d5ceb1990a48c985e01cbe6fca7e274f016 (patch) | |
| tree | d34462f679451f7767dc9df83ddfaf61fdda6ef8 /src/librustc_parse/parser | |
| parent | 374ad1b0063963060a00a3110e44d76e7105d059 (diff) | |
| download | rust-dcd91d5ceb1990a48c985e01cbe6fca7e274f016.tar.gz rust-dcd91d5ceb1990a48c985e01cbe6fca7e274f016.zip | |
parser: don't use `unreachable!()` in `fn unexpected`.
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/mod.rs | 4 |
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(), } } |
