Repository navigation
BuildLang 1.10.0: M4 pilot fixes
Compiler fixes found while porting the Low Water combat step to BuildLang. Each of these programs passed buildc check on 1.9.0 and then failed in the C compiler or gave a wrong result.
Install
cargo install buildlang --version 1.10.0 --locked
Fixed
- Stores into a vector element's fields are kept:
v[i].x = e,w.ps[i].act.f += e,rs[i].items[j].x = e, andv[i] = ethrough a&mut Vec. The index runs once. Test: tests/heldout/vec_element_stores.bld. - A struct literal's fields go to their declared slots when written out of order, and a
Vec::new()field takes the field's type. Test: tests/heldout/struct_literal_fields.bld. - A match arm
Vec::new()in an unannotatedletbuilds the right vector type (#98). Test: tests/heldout/match_vec_new_arm.bld. - A diverging arm (
return,break,continue,panic!) no longer types the match as()when the callee is defined later in the file (#99). Test: tests/heldout/diverging_arm_later_fn.bld. - An early
return;inmainwritesreturn 0;in the Cint32_t main; GCC 14 rejected the barereturn;. Tests: compiler/tests/check_implies_compile.rs on tests/heldout/diverging_arm_later_fn.bld, andtest_c_backend_main_early_return_returns_zeroin compiler/src/codegen/backend/c.rs. format!("{}", a as char)prints the character (#100). Test: tests/heldout/format_inline_char_cast.bld.- A module function called inside
println!or another macro's arguments resolves. Tests: tests/heldout/module_macro_args.bld, tests/modmacro/main.bld. - f64
sqrtrounds correctly on MinGW, andf64::INFINITY,NAN,MAX,EPSILONandMIN_POSITIVEare floats. Test: tests/heldout/float_sqrt_constants.bld.
Every program above runs in compiler/tests/heldout_regressions.rs, which compares its output with the .expected file beside it.
Licence
AGPL-3.0-only, as from 1.9.0. Output that buildc generates stays yours.