diff options
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/tests/data/reparse/fuzz-failures/0004.rs | 4 |
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 @@ | |||
1 | 0 | ||
2 | 0 | ||
3 | } | ||
4 | {; \ No newline at end of file | ||