Repository navigation
fix(lint): gate var_table freshness accessors on debug_assertions - #4261
Merged
Merged
Conversation
track_cell and stale_names are consumed only by the debug_assertions boundary verifier in executor/variable_state.rs (plus var_table unit tests for track_cell). In a release-profile lib build both are dead code, which turns niubash CI red: it builds the vendored rubash in release with -D warnings. Gate each method on its consumers cfg, mirroring #4258: track_cell on any(debug_assertions, test), stale_names on debug_assertions. No behavior change: in release the tracked set is always empty already.
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
Gate
VarTable::track_cellandVarTable::stale_names(src/shell/var_table.rs) on their consumers' cfg, so a release-profile lib build no longer reports them as dead code. This is the remaining half of the niubash main CI red (companion to #4258, which gatedExecutor::owns_process_image).UNVERIFIED-BY-CAPTAIN — code-only lane delivery; captain verification pending.
Root cause
Both methods' only live consumers sit behind
#[cfg(debug_assertions)]insrc/executor/variable_state.rs:track_cell(var_table.rs:298): called at variable_state.rs:1212 (verify_typed_cells_impl, wholly#[cfg(debug_assertions)]) and :1287 (a#[cfg(debug_assertions)]block innote_typed_cell_synced); additionally called directly by var_table's own unit tests.stale_names(var_table.rs:341): called only at variable_state.rs:1185, inside the same debug verifier.In a release-profile build (debug_assertions off, non-test) neither method has a live call site →
dead_code. niubash CI builds the vendored rubash in release with-D warnings, so it has been red on this since 2026-11-27. This is a build-profile difference, not a feature-set one (rubash's features do not touch var_table).Fix (single mechanism, mirroring #4258)
Gate each method on its consumers' cfg — no
#[allow(dead_code)], no deletion (the debug verifier is a live consumer), following the in-file precedent ofuntrack_cell/mark_cell_synced(#[cfg(test)]):track_cell→#[cfg(any(debug_assertions, test))](test must be included: unit tests call it directly, otherwisecargo test --releasefails to compile)stale_names→#[cfg(debug_assertions)]Attribution: the fix lands in rubash; niubash picks it up on its next vendored sync. No niubash change needed.
No behavior change: in release builds the
trackedset is always empty already (its only inserter's callers are all on the debug surface), and the sibling surface stays live and untouched —cell_is_freshandmirror_epoch_ofhave non-gated call sites, and the freshness fields are held by live code (note_mirror_write/cell_is_fresh).What this PR deletes
Nothing. Net diff: +2 lines (two cfg attribute lines), 0 deletions, one file. The gated methods are not a second path: each remains the single implementation, compiled exactly when its consumers are compiled.
Verification (devin-mac, tree based on 8407b40; file blob identical on current master)
RUSTFLAGS="-D warnings" cargo check --release --lib --locked→ exactly one error:methods track_cell and stale_names are never used(var_table.rs:298).-D warningscheck green; debug-D warningscheck green; clippy scan shows 0 dead_code hits.cargo test --release --lib var_table: compiles and 12/12 pass (proves thetestleg of the gate —tracked_write_marks_stale_and_sync_clearsexercisestrack_cellwith debug_assertions off).cargo test --libfull: 1337 passed / 0 failed / 4 ignored (the one initial failure,issue2875_input_procsub_child_runs_as_rubash_shell, is a documented missing-bin precondition on a fresh target; green oncecargo build --bin rubashhas run).