diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-06-08 17:20:57 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-08 17:20:57 -0600 |
| commit | 71865fb94753da6e4eff4de5e5ddc165d87e8ff4 (patch) | |
| tree | e17ecd771f935a3172d562224ea781cb4d47be4d /src/libsyntax/parse | |
| parent | 91b6842dc9b795cdee9bfe552f42cdd463e1a8dd (diff) | |
| parent | df0c6a97b4a7897931c6e4b21b9f4398272d552e (diff) | |
| download | rust-71865fb94753da6e4eff4de5e5ddc165d87e8ff4.tar.gz rust-71865fb94753da6e4eff4de5e5ddc165d87e8ff4.zip | |
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
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ebb53335da3..dd3559798ec 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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, _ => {} |
