@@ -437,7 +437,7 @@ impl Syntax {
438 /// Iterate over the highlighted regions for a given slice of source code.
438 /// Iterate over the highlighted regions for a given slice of source code.
439 pub fn highlight_iter<'a>(
439 pub fn highlight_iter<'a>(
440− &self,
440+ &'a self,
441 source: RopeSlice<'a>,
441 source: RopeSlice<'a>,
442 range: Option<std::ops::Range<usize>>,
442 range: Option<std::ops::Range<usize>>,
443 cancellation_flag: Option<&'a AtomicUsize>,
443 cancellation_flag: Option<&'a AtomicUsize>,
@@ -452,11 +452,10 @@ impl Syntax {
452 let highlighter = &mut ts_parser.borrow_mut();
452 let highlighter = &mut ts_parser.borrow_mut();
453 highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
453 highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
455− let tree_ref = unsafe { mem::transmute::<_, &'static Tree>(self.tree()) };
455+ let tree_ref = self.tree();
456 let cursor_ref = unsafe { mem::transmute::<_, &'static mut QueryCursor>(&mut cursor) };
456 let cursor_ref = unsafe { mem::transmute::<_, &'static mut QueryCursor>(&mut cursor) };
457− let query_ref = unsafe { mem::transmute::<_, &'static Query>(&self.config.query) };
457+ let query_ref = &self.config.query;
458− let config_ref =
458+ let config_ref = self.config.as_ref();
459− unsafe { mem::transmute::<_, &'static HighlightConfiguration>(self.config.as_ref()) };
461 // if reusing cursors & no range this resets to whole range
460 // if reusing cursors & no range this resets to whole range
462 cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
461 cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));