From 8f5bff61fb67d0dfcca33a4bde0344cc75e6c744 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 25 Sep 2025 10:41:37 +0800 Subject: [PATCH] chore: Fix sum_tree API changes. (#1286) https://github.com/zed-industries/zed/pull/38776 --- Cargo.lock | 36 ++++++++++++------------ crates/ui/src/highlighter/diagnostics.rs | 8 +++--- crates/ui/src/highlighter/highlighter.rs | 6 ++-- crates/ui/src/input/state.rs | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd9e2d3d..f3d97ad1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -757,7 +757,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.11.0", "lazy_static", "lazycell", "log", @@ -780,7 +780,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.11.0", "log", "prettyplease", "proc-macro2", @@ -1449,7 +1449,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "indexmap 2.10.0", "rustc-hash 2.1.1", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "proc-macro2", "quote", @@ -3112,7 +3112,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -3297,7 +3297,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3566,7 +3566,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "bytes", @@ -3586,7 +3586,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "rustls", "rustls-platform-verifier", @@ -3690,7 +3690,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.61.2", + "windows-core 0.58.0", ] [[package]] @@ -4544,7 +4544,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "bindgen 0.71.1", @@ -4980,7 +4980,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.105", @@ -5602,7 +5602,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "collections", "serde", @@ -6519,7 +6519,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "derive_refineable", "workspace-hack", @@ -6672,7 +6672,7 @@ dependencies = [ [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "bytes", @@ -7257,7 +7257,7 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749" [[package]] name = "semantic_version" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "serde", @@ -7900,7 +7900,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "arrayvec", "log", @@ -9216,7 +9216,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "anyhow", "async-fs 2.1.3", @@ -9251,7 +9251,7 @@ dependencies = [ [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed.git#4532765ae845b8c98c73c88cc916f7d771b429d5" +source = "git+https://github.com/zed-industries/zed.git#17e55daf6f43b6e902d63320daed3154d6e22026" dependencies = [ "perf", "quote", diff --git a/crates/ui/src/highlighter/diagnostics.rs b/crates/ui/src/highlighter/diagnostics.rs index 2db4d331..1ff93a55 100644 --- a/crates/ui/src/highlighter/diagnostics.rs +++ b/crates/ui/src/highlighter/diagnostics.rs @@ -211,8 +211,8 @@ impl sum_tree::Item for DiagnosticEntry { } impl sum_tree::Summary for DiagnosticSummary { - type Context = (); - fn zero(_: &Self::Context) -> Self { + type Context<'a> = &'a (); + fn zero(_: Self::Context<'_>) -> Self { DiagnosticSummary { count: 0, start: usize::MIN, @@ -220,7 +220,7 @@ impl sum_tree::Summary for DiagnosticSummary { } } - fn add_summary(&mut self, other: &Self, _: &Self::Context) { + fn add_summary(&mut self, other: &Self, _: Self::Context<'_>) { self.start = other.start; self.end = other.end; self.count += other.count; @@ -240,7 +240,7 @@ impl SeekTarget<'_, DiagnosticSummary, DiagnosticSummary> for usize { } } -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone)] pub struct DiagnosticSet { text: Rope, diagnostics: SumTree, diff --git a/crates/ui/src/highlighter/highlighter.rs b/crates/ui/src/highlighter/highlighter.rs index 65b3299a..925ed501 100644 --- a/crates/ui/src/highlighter/highlighter.rs +++ b/crates/ui/src/highlighter/highlighter.rs @@ -114,8 +114,8 @@ impl sum_tree::Item for HighlightItem { } impl sum_tree::Summary for HighlightSummary { - type Context = (); - fn zero(_: &Self::Context) -> Self { + type Context<'a> = &'a (); + fn zero(_: Self::Context<'_>) -> Self { HighlightSummary { count: 0, start: usize::MIN, @@ -125,7 +125,7 @@ impl sum_tree::Summary for HighlightSummary { } } - fn add_summary(&mut self, other: &Self, _: &Self::Context) { + fn add_summary(&mut self, other: &Self, _: Self::Context<'_>) { self.min_start = self.min_start.min(other.min_start); self.max_end = self.max_end.max(other.max_end); self.start = other.start; diff --git a/crates/ui/src/input/state.rs b/crates/ui/src/input/state.rs index b55a6f52..34fb1d43 100644 --- a/crates/ui/src/input/state.rs +++ b/crates/ui/src/input/state.rs @@ -452,7 +452,7 @@ impl InputState { language, highlighter: Rc::new(RefCell::new(None)), line_number: true, - diagnostics: DiagnosticSet::default(), + diagnostics: DiagnosticSet::new(&Rope::new()), }; self.searchable = true; self