fix: resolve type inference failures in docx parser and fictionbook extractor (#622)#624
Merged
Merged
Conversation
…xtractor Second occurrence of the class of issue fixed in #519. Two sites in docx/parser.rs matched attr.value.as_ref() without an explicit &[u8] cast, causing the compiler to lock the type to &[u8; 5] from the first arm and reject the other arms ("separate" = 8 bytes, "end" = 3 bytes). Two sites in fictionbook.rs called normalized.as_ref() on a Cow<str> without an explicit &str annotation, triggering E0282 on newer toolchains. Fixes #622
Goldziher
added a commit
that referenced
this pull request
Apr 2, 2026
…ce-regression fix: resolve type inference failures in docx parser and fictionbook extractor (#622)
Goldziher
added a commit
that referenced
this pull request
May 17, 2026
…ce-regression fix: resolve type inference failures in docx parser and fictionbook extractor (#622)
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.
Summary
Second occurrence of the type inference regression class fixed in #519.
Two missed sites in
docx/parser.rsmatchedattr.value.as_ref()without an explicitas &[u8]cast. The compiler locked the inferred type to&[u8; 5]from the first arm (b"begin"), then rejectedb"separate"(8 bytes) andb"end"(3 bytes) with E0308. The prior fix in #519 caughte.name().as_ref()call sites but missed theattr.value.as_ref()pattern.Two sites in
fictionbook.rscalled.as_ref()on aCow<'_, str>without an explicit&strannotation, producing E0282 on newer toolchains where type inference is stricter.Changes
extraction/docx/parser.rs: addedas &[u8]cast at bothattr.value.as_ref()match sites (lines 1282 and 1416)extractors/fictionbook.rs: added: &strannotation to bothlet trimmed = normalized.as_ref()bindings (lines 112 and 831)Test plan
cargo check -p kreuzbergpasses (verified locally)cargo test -p kreuzberg— docx and fictionbook extraction tests passCloses #622