fix: tie the lifetime of the cursor to the query in QueryCursor::captures()

This commit is contained in:
Will Lillis 2024-04-09 12:19:06 -04:00 committed by GitHub
parent 4d8b031bcc
commit cbcb51b857
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2359,8 +2359,8 @@ impl QueryCursor {
/// This is useful if you don't care about which pattern matched, and just want a single,
/// ordered sequence of captures.
#[doc(alias = "ts_query_cursor_exec")]
pub fn captures<'query, 'tree, T: TextProvider<I>, I: AsRef<[u8]>>(
&mut self,
pub fn captures<'query, 'cursor: 'query, 'tree, T: TextProvider<I>, I: AsRef<[u8]>>(
&'cursor mut self,
query: &'query Query,
node: Node<'tree>,
text_provider: T,