github starkware-libs/cairo v2.12.0

latest release: v2.12.1
29 days ago

New Features

  • Added user defined macros
    • Defined as items with the keyword macro.
    • Currently only supported for expressions and statements.
    • Hygienic by default: vars defined outside the macro aren't available by default in the macro expanded code, and vars defined in the macro expanded code aren't available after the expansion.
macro assert_zero {
     ($x:expr) => {
            assert!($x == 0);
     };
}
  • Added support for self as a leaf of path. #7560
  • Recursive match on enums
match opt_opt_v {
      Some(Some(v)) => v,
      Some(None) = 1,
      None => 2,
}
  • let-else support
let Some(x) = y else { ... }
  • let-chains support.
    • let chain + else is not supported yet.
if let Some(x) = y && let Some(z) = x { ... }

Bug Fixes

  • Fixed issue with sort instability of use statements. #7440
  • Fixed the assertion macros to not move variables into them if not required. #7443
  • Improved block return type to be never in more places. #7858
  • Prevented crash caused in cases of destructuring of a snapshot of var. #7907
  • Return an error when a loop return core::never and another type. #7904
  • Removed unused warning caused by not finding function or method. #7940
  • Stopped updating snap-refs - and only introducing top level. #8048

Corelib Updates

  • Moved upcast and downcast to bounded_int. #7575
  • Made bounded-int pub, and blocked by unstable feature. #7576
  • Make VecIter public. #7627
  • Made meta_tx_v0_syscall usable for starknet. #7605
  • Add gas_reserve_create libfunc. #7756
  • Add gas_reserve_utilize libfunc. #7757
  • Made core::internal::bounded_int pub, as it is feature bound. #7937
  • Removed Identifier not found diagnostics when vars introduced. #7946

Optimizations

Code Size

  • Add code deduplication optimization. #7382
  • add no-gas option to get-lowering. #7400
  • Support Enum and Struct construction in return optimization. #5828
  • Add trim_unreachable optimization to trim unreachable code. #7546
  • Deduped panic_with_const_felt252 into calling panic_with_felt252. #7556
  • Improve match optimization. #7578
  • Support compilation with unsafe_panic for local proofs. #7568
  • Removed some unwraps from keccak. #7635
  • Added an internal numeric Split trait, and used it to remove unwraps. #7636
  • Removed some more unwraps in bytearray. #7642
  • Using checked_sub instead of compare and then subtract. #7665
  • Major refactoring of ByteArray vastly reducing its size. #7669
  • Add redeposit_gas only before convergence points. #7686
  • Avoid adding redeposit_gas before panic flows. #7687
  • Added functions specialization optimization.
  • Better heuristic for inlining and specialization of functions based on actual final function size.
  • Added inc and dec to const-folding. #7799
  • When possible - making a enum-match into a goto. #7839

Compiler runtime

  • Allowing caching of compiled crate - allows scarb to cache these and avoid a large part of recompilation.
  • Improved block return type to be never in more places. #7858
  • Removed extra vectors from semantic statements processing. #7887
  • Changed QueryAttrs to be more iterator based. #7889
  • Less green lookups. #7921
  • added shot circuiting to get text of terminals. #7934
  • Removed extra get_children calls at span without trivia. #7948
  • improved candidate solver to not use inference when possible. #7949

New Contributors

Full Changelog: v2.11.4...v2.12.0

Don't miss a new cairo release

NewReleases is sending notifications on new releases.