|
| 1 | +# Changelog Healing - 2026-01-24 |
| 2 | + |
| 3 | +## Summary |
| 4 | +Fixed borrow checker errors and warnings in the new `SlidingIocpInline` mode implementation. |
| 5 | + |
| 6 | +## What Failed |
| 7 | + |
| 8 | +### 1. Borrow Checker Errors (E0499, E0502) |
| 9 | +**Location:** `crates/uffs-mft/src/io.rs:1610-1643` |
| 10 | + |
| 11 | +**Error:** |
| 12 | +``` |
| 13 | +error[E0499]: cannot borrow `*index` as mutable more than once at a time |
| 14 | +error[E0502]: cannot borrow `index.links` as immutable because it is also borrowed as mutable |
| 15 | +``` |
| 16 | + |
| 17 | +**Root Cause:** |
| 18 | +The `parse_record_to_index()` function held a mutable reference to `record` (from `index.get_or_create(frs)`) while simultaneously trying to: |
| 19 | +- Call `index.add_name()` (mutable borrow) |
| 20 | +- Access `index.links.len()` (immutable borrow) |
| 21 | +- Call `index.links.push()` (mutable borrow) |
| 22 | + |
| 23 | +### 2. Type Mismatch (E0308) |
| 24 | +**Location:** `crates/uffs-mft/src/io.rs:1645` |
| 25 | + |
| 26 | +**Error:** |
| 27 | +``` |
| 28 | +error[E0308]: mismatched types - expected `u16`, found `u8` |
| 29 | +``` |
| 30 | + |
| 31 | +**Root Cause:** |
| 32 | +`record.name_count` is `u16`, but the code cast to `u8`. |
| 33 | + |
| 34 | +### 3. Warnings |
| 35 | +- **Dead code:** `skip_begin` and `record_count` fields in `IoOp` struct were never read |
| 36 | +- **Dropping reference:** `drop(record)` does nothing on a reference |
| 37 | + |
| 38 | +## How Fixed |
| 39 | + |
| 40 | +### 1. Borrow Checker Fix |
| 41 | +Restructured the code to avoid overlapping borrows: |
| 42 | +1. Pre-process all additional names BEFORE getting the record reference |
| 43 | +2. Add names to buffer and push LinkInfo entries to `index.links` first |
| 44 | +3. Then get the record reference and update it |
| 45 | +4. After the record reference goes out of scope, chain the links together |
| 46 | + |
| 47 | +### 2. Type Fix |
| 48 | +Changed `as u8` to `as u16` for `name_count`. |
| 49 | + |
| 50 | +### 3. Warning Fixes |
| 51 | +- Removed unused `skip_begin` and `record_count` fields from `IoOp` struct |
| 52 | +- Removed unnecessary `drop(record)` call (reference goes out of scope naturally) |
| 53 | + |
| 54 | +## Files Changed |
| 55 | +- `crates/uffs-mft/src/io.rs` |
| 56 | + |
| 57 | +## Verification |
| 58 | +- `cargo check --package uffs-mft` passes with no errors or warnings |
| 59 | +- CI pipeline (`rust-script scripts/ci-pipeline.rs go -v`) passes |
0 commit comments