@@ -745,7 +745,7 @@ struct LocalScope<'a> {
745745 local_defs: Vec<LocalDef<'a>>,
746746}
747747
748−struct HighlightIter<'a, F>
748+struct HighlightIter<'a, 'tree: 'a, F>
749749where
750750 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
751751{
@@ -753,16 +753,16 @@ where
753753 byte_offset: usize,
754754 injection_callback: F,
755755 cancellation_flag: Option<&'a AtomicUsize>,
756− layers: Vec<HighlightIterLayer<'a>>,
756+ layers: Vec<HighlightIterLayer<'a, 'tree>>,
757757 iter_count: usize,
758758 next_event: Option<HighlightEvent>,
759759 last_highlight_range: Option<(usize, usize, usize)>,
760760}
761761
762−struct HighlightIterLayer<'a> {
762+struct HighlightIterLayer<'a, 'tree: 'a> {
763763 _tree: Option<Tree>,
764764 cursor: QueryCursor,
765− captures: iter::Peekable<QueryCaptures<'a, Cow<'a, [u8]>>>,
765+ captures: iter::Peekable<QueryCaptures<'a, 'tree, Cow<'a, [u8]>>>,
766766 config: &'a HighlightConfiguration,
767767 highlight_end_stack: Vec<usize>,
768768 scope_stack: Vec<LocalScope<'a>>,
@@ -929,7 +929,7 @@ impl HighlightConfiguration {
929929 }
930930}
931931
932−impl<'a> HighlightIterLayer<'a> {
932+impl<'a, 'tree: 'a> HighlightIterLayer<'a, 'tree> {
933933 /// Create a new 'layer' of highlighting for this document.
934934 ///
935935 /// In the even that the new layer contains "combined injections" (injections where multiple
@@ -1193,7 +1193,7 @@ impl<'a> HighlightIterLayer<'a> {
11931193 }
11941194}
11951195
1196−impl<'a, F> HighlightIter<'a, F>
1196+impl<'a, 'tree: 'a, F> HighlightIter<'a, 'tree, F>
11971197where
11981198 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
11991199{
@@ -1244,7 +1244,7 @@ where
12441244 }
12451245 }
12461246
1247− fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a>) {
1247+ fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a, 'tree>) {
12481248 if let Some(sort_key) = layer.sort_key() {
12491249 let mut i = 1;
12501250 while i < self.layers.len() {
@@ -1263,7 +1263,7 @@ where
12631263 }
12641264}
12651265
1266−impl<'a, F> Iterator for HighlightIter<'a, F>
1266+impl<'a, 'tree: 'a, F> Iterator for HighlightIter<'a, 'tree, F>
12671267where
12681268 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
12691269{