refactor(hir): audit #[allow(dead_code)] stubs in cssl-hir#7
Open
tmchow wants to merge 1 commit intoApocky:mainfrom
Open
refactor(hir): audit #[allow(dead_code)] stubs in cssl-hir#7tmchow wants to merge 1 commit intoApocky:mainfrom
tmchow wants to merge 1 commit intoApocky:mainfrom
Conversation
Three `#[allow(dead_code)]` items in cssl-hir reviewed against the
issue's "work pending vs landed" question:
1) compiler-rs/crates/cssl-hir/src/cap_check.rs:137 `fn emit(...)`
T3.4-phase-2.5 (the body-walk slice this helper was reserved for)
is still listed under "Deferred" in DECISIONS.md § T5-D3 and is
not in the Session-1 STATUS line. The function stays; its tracking
comment is upgraded from the bare "reserved for T3.4-phase-2.5
expression walk" hint to an explicit reference to DECISIONS.md
§ T5-D3 (which is where "full linear-use tracking through every
expression" + "handler-one-shot enforcement" are formally deferred).
2) compiler-rs/crates/cssl-hir/src/cap_check.rs:231 `fn matrix(...)`
Same DECISIONS.md § T5-D3 dependency -- it's the AliasMatrix
accessor the deferred body walk needs in order to call
`AliasMatrix::can_pass_through` / `param_subtype_check` at call
sites. Comment upgraded to the same T5-D3 tracker; `#[allow]`
kept.
3) compiler-rs/crates/cssl-hir/src/lower.rs:1271 `const fn _span_referenced`
The stub existed solely to keep the `Span` import from flagging as
unused under cargo -D warnings. Searching lower.rs for other `Span`
uses shows none outside the stub (3 matches: the import, the
stub's comment, and the stub's signature). The stub is dead code
that props up a dead import, so both the stub and the `Span` entry
in `use cssl_ast::{...}` are removed. `SourceFile` remains since
it IS used at lines 49/56/919.
`cargo build --workspace` is clean. `cargo test -p cssl-hir` passes
(195 tests).
Closes Apocky#2
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
Closes #2. Audits the three
#[allow(dead_code)]items in cssl-hir against "has the T3.4-phase-2.5 work landed or is it still pending" per the issue's decision tree, and applies the follow-up the issue prescribes for each case.Outcome per item
1.
compiler-rs/crates/cssl-hir/src/cap_check.rs:137—fn emit(..., span: Span)Pending. DECISIONS.md § T5-D3 (Cap-check pass sig-level only for stage-0; full expr walk deferred) explicitly defers "full linear-use tracking through every expression" and "handler-one-shot enforcement" to T3.4-phase-2.5. The Session-1 STATUS line lists T3.4-phase-2-refinement / T3.4-phase-3-AD-legality / T3.4-phase-3-IFC as ✓, but not T3.4-phase-2.5.
Per the issue: "If the work is still pending: add a tracking comment with the DECISIONS.md entry it's waiting on." Upgraded the bare
// reserved for T3.4-phase-2.5 expression walkto an explicit pointer to § T5-D3 so the next person opening cap_check.rs lands on the actual DECISIONS entry instead of having to grep for T5-D3 themselves.#[allow(dead_code)]kept.2.
compiler-rs/crates/cssl-hir/src/cap_check.rs:231—fn matrix(...) -> &AliasMatrixSame dependency as (1).
matrix()is the accessor the deferred body walk needs to callAliasMatrix::can_pass_through/param_subtype_checkat call sites (per § T5-D3's "ready for use when T3.4-phase-2.5 walks call-args" note). Same tracker comment upgrade.3.
compiler-rs/crates/cssl-hir/src/lower.rs:1271—const fn _span_referenced(_: Span) {}Genuinely dead. The stub exists only so
Spanin theuse cssl_ast::{...}line doesn't trip-D warnings. Greppinglower.rsfor�Span�returns exactly three hits: the import on line 21, the stub's///comment on line 1270, and the stub's signature on line 1272. Nothing outside the stub usesSpan.Per the issue's guidance: "If the work is complete and the function is genuinely unused: remove it, or wire it up if it was meant to be called." Removed both the stub and
Spanfrom the import.SourceFilestays in the import — it IS used at lines 49, 56, and 919.Verification
Clean compile across the workspace (no new
unused_importswarning from theSpanremoval), all 195 cssl-hir tests pass.Scope note
The issue lists three items. This PR addresses exactly those three — no opportunistic removal of other
#[allow(dead_code)]s elsewhere in cssl-hir. If the project wants a broader sweep later, it's a follow-up issue's scope.Closes #2
This contribution was developed with AI assistance (Claude Code).