1
Fork 0

Rollup merge of #51099 - Crazycolorz5:expectedcloseparen, r=estebank

Fix Issue 38777

When looking through for a closing bracket in the loop condition, adds them to expecteds.
https://github.com/rust-lang/rust/issues/38777
This commit is contained in:
Mark Rousskov 2018-06-08 17:20:57 -06:00 committed by GitHub
commit 71865fb947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 61 additions and 14 deletions

View file

@ -652,7 +652,7 @@ impl<'a> Parser<'a> {
Err(err)
}
} else {
self.expect_one_of(unsafe { slice::from_raw_parts(t, 1) }, &[])
self.expect_one_of(slice::from_ref(t), &[])
}
}
@ -1108,7 +1108,12 @@ impl<'a> Parser<'a> {
{
let mut first: bool = true;
let mut v = vec![];
while !kets.contains(&&self.token) {
while !kets.iter().any(|k| {
match expect {
TokenExpectType::Expect => self.check(k),
TokenExpectType::NoExpect => self.token == **k,
}
}) {
match self.token {
token::CloseDelim(..) | token::Eof => break,
_ => {}