Repository navigation
fix(gen): compile all 102 generated Rust modules and gate the corpus - #409
dmitrii-f-t27 wants to merge 1 commit into
Conversation
Ten generated Rust modules did not compile under rustc 1.96 with -D warnings, although the drift check passed, because the drift check only compares text with the pinned t27c output. Spec changes, regenerated with the unchanged pin eb8b4208: - Nine specs assigned to value parameters (E0384, E0594). Each such function now copies the parameter into a local `var` and writes the copy. This is the value semantics that the generated C (struct by value) and Zig (shadow) already had, so no result changes. - api_documenter: the array repeat count is a literal, because the pinned Rust emitter copies a u32 count verbatim (E0308). - auto_config: drop five `value >= 0` tests on u32 (unused_comparisons). - integration_framework: rename type_documentation to TYPE_DOCUMENTATION (non_upper_case_globals). Public argument and return types are unchanged. Typecheck warning counts are unchanged for all ten specs. tests/gen_rust_corpus_compiles.rs compiles every gen/rust module as its own crate with -D warnings, enforces a floor of 102 modules, and first proves that five negative controls (E0384, E0594, E0308, unused_comparisons, non_upper_case_globals) are rejected. tests/gen_rust_value_params.rs checks results and the caller contract of the changed functions. Closes gHashTag#399
Summary by t27-beesChecked by the t27 compilert27c parse, parse-complete and typecheck on each changed .t27 file at
Read by the modelThis PR fixes Rust compilation errors in 10 generated modules by updating their Worth a look
Read: 43 files, +1313 -429, the whole diff up to 60000 characters (the rest was not read). Head |
|
@gHashTag, please merge #409 and then #411. Both are from my fork; I cannot merge in
#411 is stacked on #409 because both change the same three specs. Until #409 merges, the #411 diff also shows the #409 commit. #411 fixes the out-of-bounds indexing and the division by zero in Dmitrii Fedorov (@dmitrii-f-t27) |
Pipeline Compliance Checklist
.t27spec (not hand-written in.rs)testorinvariantblockst27c parse <spec>returns 0 (all ten changed specs, pinned t27c)cargo build --releasecompiles (not run locally;src/is unchanged, CI runscargo build)gen/directoryWhat changed
A Rust 1.96 compile sweep of all 102
gen/rustartifacts found 92 passing onmain(d6deeb3). The drift check stays green for the other ten because it compares text with the pinned t27c output and does not compile it.Spec changes, regenerated with the unchanged compiler pin
eb8b4208168557b36dca3a771f6901a5b10d9ef0:varand writes the copy. The generated C already passes arrays as structs by value, and the generated Zig already shadows the parameter, so no result changes.varkeeps every typecheck warning count unchanged;letwould add warnings.[0; 16]. The declared[u32; MAX_PARAMETERS]type still fixes the length.value >= 0checks onu32are removed. The E0594 errors had hidden them.type_documentationis nowTYPE_DOCUMENTATION. Nothing else references it.Public argument and return types are unchanged.
New gate, which runs in the required
build + testjob:tests/gen_rust_corpus_compiles.rscompiles everygen/rust/*.rsfile as a separate crate withrustc --edition=2021 --crate-type=lib -D warnings. It uses the generated-module policyallow(clippy::all, unused)and a floor of 102 modules. First, it proves that five negative controls are rejected: E0384, E0594, E0308,unused_comparisonsandnon_upper_case_globals. It also proves that a valid control compiles.tests/gen_rust_value_params.rschecks the results of every changed function. It also checks that the caller's arrays are unchanged.Spec -> Code mapping
specs/{api_documenter,auto_config,bandwidth_allocator,cache_management,compression_engine,integration_framework,network_simulator,performance_profiler,topology_visualizer,traffic_animator}.t27->gen/{rust,zig,c}/<same>.{rs,zig,c}. The Rust files are committed rustfmt-formatted, because the new test includes them andcargo fmt --all --checkcovers them. The drift check normalizes both sides.Validation (local, macOS arm64; CI runs on this PR)
tools/regen.rs --check-staged: 30 staged artifacts verified.cargo fmt --all --checkandcargo clippy --all-targets -D warningspass. The two new test targets pass: 2 + 7 tests. The corpus result is 102/102.mainversions of the Rust artifacts restored, the gate fails on exactly those ten modules (92 of 102).zig testand C-DT27_TEST_MAINexecute all the spec tests of the ten changed modules.t27c icarus-simulatepasses for the ten specs. Typecheck warning counts are equal to the WARNBASE pins.main, the new C and the new Rust give identical outputs. Eight spec mutants were regenerated, and the comparison detected each one. One more mutant is equivalent, becauseparam_docsis never read.Limits
age_cache,access_cache,remove_entry,set_config_valueand similar functions still do not reach the caller. Changing that would change public return types.inject_faultwithtarget_id >= 32,update_animation_packetswithpacket_count > 64andcalculate_circular_layoutwithnode_count > 32.calculate_hierarchical_layoutdivides by zero whennode_count < 4. Each of these panics in the generated Rust. All of them predate this change.Dmitrii Fedorov (@dmitrii-f-t27)