From 2e258df9a73f7771ac354de974ace19a37191dad Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Thu, 27 Aug 2026 17:25:19 -0700 Subject: [PATCH] vlog_parser: the defines round-trip pieces the cache commit left behind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DefineTable::from_entries and the PartialEq/Eq derives on Define/DefineTable belong to the index-persistence round (e4b1f55) — its facts.rs references from_entries — but the lead's explicit-path staging missed the vlog_parser crate, so e4b1f55 does not build on a clean checkout. Caught by the next round's dev noticing an uncommitted change it did not make. The working tree was always green, which is why every gate passed locally; the remote CI on e4b1f55 is the run this fixes. Co-Authored-By: Claude Fable 5 --- crates/vlog_parser/src/defines.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/vlog_parser/src/defines.rs b/crates/vlog_parser/src/defines.rs index d4b27fb..986b858 100644 --- a/crates/vlog_parser/src/defines.rs +++ b/crates/vlog_parser/src/defines.rs @@ -22,7 +22,7 @@ pub enum DefineKind { } /// One `` `define`` or `` `undef`` directive, as written. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Define { /// Whether this entry defines the name or undefines it. pub kind: DefineKind, @@ -48,12 +48,24 @@ pub struct Define { /// /// Redefinition is legal Verilog, so a name can have several definitions; they /// are all kept and [`DefineTable::latest`] picks the last one. -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct DefineTable { entries: Vec, } impl DefineTable { + /// A table from entries that are already known, in source order. + /// + /// The inverse of [`DefineTable::entries`], for the one caller that has a + /// file's directives without the file's tokens: the workspace index's + /// persistent cache, which stores what a parse found and restores it + /// (`docs/features/index-persistence/README.md`). Nothing is re-derived + /// here — `collect_defines` is still the only thing that *reads* a table + /// out of a file. + pub fn from_entries(entries: Vec) -> DefineTable { + DefineTable { entries } + } + /// Every recorded directive, `` `undef``s included, in source order. pub fn entries(&self) -> &[Define] { &self.entries