From fd0ccd65a597ffdaf9cd4c199c47564ef4f5c709 Mon Sep 17 00:00:00 2001 From: Alex Le Blanc Date: Thu, 23 Jul 2026 18:30:15 -0400 Subject: [PATCH] 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. --- crates/loader/src/loader.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/loader/src/loader.rs b/crates/loader/src/loader.rs index 178aa2d10..67b3f118c 100644 --- a/crates/loader/src/loader.rs +++ b/crates/loader/src/loader.rs @@ -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 { let parser_lib_path = if let Ok(path) = env::var("TREE_SITTER_LIBDIR") {