Upgrade fst to 0.4 and swap memmap for memmap2 - #14
Open
bmesuere wants to merge 1 commit into
Open
Conversation
Clears RUSTSEC-2020-0077: fst 0.3 pulled in memmap 0.6, which is unmaintained. fst 0.4 no longer does its own memory mapping, so we do it ourselves with memmap2. Map::from_path and Map::from_bytes are gone in 0.4, replaced by a generic Map::new over anything that is AsRef<[u8]>. The two ways of loading an index therefore produce different types, so the choice moved into utils::load_fst behind a small enum, rather than being repeated in four commands. Index files stay readable: the new code reads indices written by fst 0.3 (format version 2) as well as its own. The reverse does not hold, an index built after this change cannot be read by an older umgap, since fst 0.4 writes format version 3. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clears RUSTSEC-2020-0077.
fst0.3 pulls inmemmap0.6, which is unmaintained;fst0.4 no longer does its own memory mapping, so we do it withmemmap2instead.The change
Map::from_pathandMap::from_bytesare gone in 0.4, replaced by a genericMap::newover anythingAsRef<[u8]>. The two ways of loading an index therefore produce different types, which the oldif/elsecannot express. That choice moved intoutils::load_fstbehind a small enum, instead of being repeated in four commands — which also shrinks each call site to one line.Index compatibility
This is the part worth checking before merging, and it is asymmetric. I built the same TSV with both versions and cross-read them:
expected API version 2, got API version 3So existing index files keep working, including the
tryptic.fstandninemer.fstpublished on the data server: those are read, never rewritten, by users. What does not work is going back — an index built after this change cannot be read by an older umgap. One-way migration, no action needed unless someone distributes a freshly built index to users on an older version.Verification
cargo +nightly fmt --checkclean.pept2lcaagainst a 0.3-built index returns correct taxa on both load paths (mmap and-m).buildindex->printindexround-trips.memmapis out ofCargo.lockentirely.The remaining five (
ansi_term,attyx2,proc-macro-error,structopt) all come from the clap 2 / structopt stack and go together with that upgrade.