You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
duplicate-bodies red on master after #7747: coerce_plan.t27 copies int_cast_plan's widens and icp_bits #7748
Part of #6063. Follows #7747 (#7740), which auto-merged at 09:24Z with this check red.
duplicate-bodies (tools/dupe_scan.py) fails on master 1d9c596:
a body written under cp_bits is now copied [2] time(s) and was in no ledger
a body written under widens is now copied [2] time(s) and was in no ledger
specs/tri/t27b/coerce_plan.t27 wrote its own widens (Zig's lossless integer rule) and a test helper cp_bits, and specs/tri/t27b/int_cast_plan.t27 already has both (widens, icp_bits).
Fix: reuse them, not bless the copies.
coerce_plan.t27 adds use tri::t27b::int_cast_plan; and calls widens, icp_bits and icp_signed.
t27c gen-rust resolves the use and copies what it needs into gen/rust/tri/t27b/coerce_plan.rs.
The plan's KEEP, WIDEN, FOLD and why are also int_cast_plan's names. They become INT_KEEP, INT_WIDEN, INT_FOLD and compare_why, so neither plan shadows the other in the generated file.
The glue in cli/t27b/src/lower.rs changes 3 lines, for the new names only.
User Scenarios
Given the duplicate-bodies check fails on master because coerce_plan.t27 duplicates widens and cp_bits from int_cast_plan.t27, when the spec is changed to use tri::t27b::int_cast_plan and call its widens, icp_bits, and icp_signed, then tools/dupe_scan.py passes with no duplicate-body complaints.
Given t27c gen-rust resolves the use and emits renamed constants (INT_KEEP, INT_WIDEN, INT_FOLD, compare_why) into gen/rust/tri/t27b/coerce_plan.rs, when the generated code is compiled, then no symbol shadows the int_cast_plan equivalents.
Given cli/t27b/src/lower.rs is updated for the three new names, when the CLI crate builds, then it compiles without errors.
Requirements
FR-001: specs/tri/t27b/coerce_plan.t27 MUST add use tri::t27b::int_cast_plan; and replace its local widens, cp_bits, and related logic with calls to int_cast_plan::widens, int_cast_plan::icp_bits, and int_cast_plan::icp_signed.
FR-002: t27c gen-rust MUST resolve the use and emit the plan constants as INT_KEEP, INT_WIDEN, INT_FOLD, and compare_why in gen/rust/tri/t27b/coerce_plan.rs so they do not shadow int_cast_plan names.
FR-003: cli/t27b/src/lower.rs MUST change exactly three lines to reference the new generated names.
FR-004: Running tools/dupe_scan.py MUST exit 0 with zero duplicate-body warnings for widens and icp_bits/cp_bits.
Success Criteria
tools/dupe_scan.py exits 0 and prints no "copied [2] time(s) and was in no ledger" lines for widens or icp_bits/cp_bits.
t27c gen-rust completes successfully and gen/rust/tri/t27b/coerce_plan.rs contains INT_KEEP, INT_WIDEN, INT_FOLD, and compare_why (no un-prefixed KEEP, WIDEN, FOLD, why from this plan).
Activity