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