fix(highlight): use std::sync::OnceCell for various loader fields

`std::unsync::OnceCell` allows for data races and requires an (incorrect) manual impl of the `Sync` trait.
This commit is contained in:
Alex Le Blanc 2026-07-23 18:30:15 -04:00 committed by Will Lillis
parent 8df22e6f0e
commit fd0ccd65a5

View file

@ -24,7 +24,7 @@ use etcetera::BaseStrategy as _;
use fs4::fs_std::FileExt;
use libloading::{Library, Symbol};
use log::{error, info, warn};
use once_cell::unsync::OnceCell;
use once_cell::sync::OnceCell;
use regex::{Regex, RegexBuilder};
use semver::Version;
use serde::{Deserialize, Deserializer, Serialize};
@ -633,8 +633,6 @@ impl<'a> CompileConfig<'a> {
}
}
unsafe impl Sync for Loader {}
impl Loader {
pub fn new() -> LoaderResult<Self> {
let parser_lib_path = if let Ok(path) = env::var("TREE_SITTER_LIBDIR") {