aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpcpthm <[email protected]>2019-03-21 19:33:05 +0000
committerpcpthm <[email protected]>2019-03-21 23:09:11 +0000
commitedbc18516d211c8dbf07539358c7d8aeca24bb30 (patch)
tree8248cbc937b1cf332fae009a41472e4f2eccf841
parent7669113e7c9088a2b656c720cca5c2e46e3cb896 (diff)
Fix reparsing bug on "{}{}"
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs2
-rw-r--r--crates/ra_syntax/tests/data/reparse/fuzz-failures/0004.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index 3b5471bf8..d54669a95 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -111,7 +111,7 @@ fn is_balanced(tokens: &[Token]) -> bool {
111 return false; 111 return false;
112 } 112 }
113 let mut balance = 0usize; 113 let mut balance = 0usize;
114 for t in tokens.iter() { 114 for t in &tokens[1..tokens.len() - 1] {
115 match t.kind { 115 match t.kind {
116 L_CURLY => balance += 1, 116 L_CURLY => balance += 1,
117 R_CURLY => { 117 R_CURLY => {
diff --git a/crates/ra_syntax/tests/data/reparse/fuzz-failures/0004.rs b/crates/ra_syntax/tests/data/reparse/fuzz-failures/0004.rs
new file mode 100644
index 000000000..481617a70
--- /dev/null
+++ b/crates/ra_syntax/tests/data/reparse/fuzz-failures/0004.rs
@@ -0,0 +1,4 @@
10
20
3}
4{; \ No newline at end of file