aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index eb1c54639..7d908f987 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -174,7 +174,13 @@ pub(crate) fn highlight(
174 } 174 }
175 175
176 assert_eq!(res.len(), 1, "after DFS traversal, the stack should only contain a single element"); 176 assert_eq!(res.len(), 1, "after DFS traversal, the stack should only contain a single element");
177 res.pop().unwrap() 177 let res = res.pop().unwrap();
178 // Check that ranges are sorted and disjoint
179 assert!(res
180 .iter()
181 .zip(res.iter().skip(1))
182 .all(|(left, right)| left.range.end() <= right.range.start()));
183 res
178} 184}
179 185
180fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> { 186fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> {