cleanup(codegen): delete dead emit_struct_literal and two stale dead_code allows - #2872
Open
gertybotbot wants to merge 1 commit into
Open
cleanup(codegen): delete dead emit_struct_literal and two stale dead_code allows#2872gertybotbot wants to merge 1 commit into
gertybotbot wants to merge 1 commit into
Conversation
…d_code allows Part of hew-lang#1885's dead-code lane, re-derived against current main (d4793f8) — the audit's line numbers and its claim of "8 stale suppressions" no longer hold, but the underlying finding does. `emit_struct_literal` has no production consumer: its only caller was a unit test exercising the helper itself, and its own docstring recorded that `monitor()` reaches `lower_record_init` directly without it. Deleted along with that test and `fixture_monitor_ref_layout`, which existed solely to feed it (clippy flagged the fixture the moment the test went, which is the dead-code signal this lane is meant to restore). The other two `#[allow(dead_code)]` attributes in llvm.rs were annotated "consumers in Stage 2/3 + W2.005". Those consumers have since landed, so the suppressions were masking live code: emit_result_err -> suspend.rs:6095,6152; runtime_abi.rs:1005,1151 emit_enum_variant_literal -> layout.rs:4717,4725,4850,4858 Both removed; clippy is clean with `-D warnings`, confirming neither was load-bearing. Updated the substrate header comment from four helpers to three and dropped the emit_struct_literal signature rationale. No behavior change: 239 lib tests pass.
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.
Picks up the "dead code" lane of #1885 (the "near-free" starter), re-derived against current
main(d4793f894) rather than taken from the audit text — the line numbers there have drifted and the claimed "8 stale suppressions" is now 2, but the substantive finding holds and one part of it turned out to be the opposite of what was filed.Genuinely dead:
emit_struct_literalNo production consumer. Its only caller was a unit test of the helper itself, and its own docstring already recorded why:
monitor()buildsMonitorRef { ref_id }throughInstr::RecordInit→lower_record_initdirectly, reaching the same underlying path without the wrapper.Deleted the function, that test, and
fixture_monitor_ref_layout— the fixture had no other caller and clippy flagged it the instant the test was removed, which is exactly the restored dead-code signal this lane is about.Stale, and masking live code
The other two
#[allow(dead_code)]attributes inllvm.rswere annotatedW2.004 Stage 1 substrate; consumers in Stage 2/3 + W2.005. Those consumers have landed, so the suppressions were no longer describing dead code at all:emit_result_errsuspend.rs:6095,6152;runtime_abi.rs:1005,1151(9 total)emit_enum_variant_literallayout.rs:4717,4725,4850,4858(14 total)Both removed.
cargo clippy -p hew-codegen-rs --lib --all-features --all-targetsis clean, which is the proof neither was load-bearing — had either still been dead,-D warningswould have caught it.This is worth noting for #1885 generally: the audit's dead-code section assumed the suppressions were stale because the helpers were still dead. For two of three, they were stale because the helpers came alive and nobody removed the annotation.
Also
Updated the substrate header comment (
llvm.rs:~24885) from "Four substrate helpers" to three, dropped theemit_struct_literalprecedent bullet, and removed the now-orphaned signature-rationale block that explained itsFieldOffset/struct_namechoices.Verification
cargo clippy -p hew-codegen-rs --lib --all-features --all-targets— clean, no warningscargo test -p hew-codegen-rs --lib— 239 passed, 0 failedNo behavior change; deletions only (+2/−106).
Does not close #1885 (the duplication lanes and the
MembershipCallbackGenerationdecision-gated item remain).