Cairo v2.21.0
- Version
v2.21.0- Repository
- starkware-libs/cairo
Release notes
What's Changed
Highlights
• Faster compilation and diagnostics. A series of optimizations across parsing, semantic analysis and lowering: module discovery (including plugin expansion) is now warmed up in parallel, the red-tree arena is built in place and chunked per item, trait-solving lookup contexts and code-size estimation are memoized, calls that would be inlined are no longer specialized first, and hash containers use foldhash. Diagnostics on large Starknet projects improved by up to ~40%. See Optimizations below.
• Build-independent Sierra output. The function chosen to carry the withdraw_gas check in a recursive cycle, and the order of impl candidates and impl type bounds, are now determined by a structural order instead of salsa internal ids, so the same program always compiles to the same Sierra regardless of parallel warmup. #10437 #10436
• Rustc-style names for generated functions. Closures and loops are named {closure#N} / {loop#N} under their defining function (e.g. test::foo::{closure#0}::{loop#0}) instead of by source location, keeping Sierra debug names stable across edits. The Sierra parser accepts the new form alongside the old ones. #10359 #10360
• Shorter diagnostic paths. Types, traits, impls and generic arguments in type mismatch, trait resolution and inference diagnostics are now shown relative to the current module (Copy::<NoSerde> instead of core::traits::Copy::<test::NoSerde>). #10327 #10328 #10330
• Cheaper circuit guarantee verification. New u96_limbs_less_than_guarantee_verify_v2 libfunc verifies a U96LimbsLtGuarantee in a single call with one range check, and the corelib Destruct for U96LimbsLtGuarantee<4> now uses it. #10377 #10443
Features
• Contextualize paths in inference errors and type diagnostics, without prelude-shortening paths shadowed by local items. #10327 #10328 #10330
• Name generated functions (closures, loops) by a rustc-style path instead of their source location, and parse the new paths in generated Sierra. #10359 #10360
• Added the u96_limbs_less_than_guarantee_verify_v2 libfunc and used it in the corelib. #10377 #10443
• Trim unused parameters of compiler-generated loop functions, from both the signature and every call site. by @TomerStarkware in #10246
• Added support for injecting constant values externally via ExternalConstPlugins, through the reserved __externally_provided_const__ extern function. #10274
• Parameter debug paths now include the defining function (test::foo::x instead of test::x). #10269
Bug Fixes
• Report macro expansion failures as diagnostics instead of panicking, and reject an expansion block with nothing repeating at its depth. #10297 #10298
• Validate the param kind of every macro rule param, not just the first. #10238
• Reject multiple #[path(..)] attributes on a module. #10239
• Fixed const evaluation of == / != going through core's generic PartialEq impls while ignoring a user PartialEq impl; such comparisons are now rejected with UnsupportedConstant. by @0xShadowX in #10395
• Report an infinitely-sized type only at the member or variant that closes the cycle, instead of at every use. #10280
• Don't leak a closure's early return into the enclosing loop. #10258
• Desnap snapshot-only captured members instead of ICEing. #10240
• Don't forward a moved non-copyable enum payload in const folding (fixes a Failed to specialize: dup panic in Sierra generation). by @Bruce039 in #10388
• Don't orphan non-droppable inputs in variable forwarding. by @eytan-starkware in #10260
• Don't ICE on a deref chain whose downstream impl has the wrong associated-type count. #10257
• Report an unresolved trait in a negative impl bound. #10255
• Return the real full path for a constant ResolvedGenericItem. #10243
• Recover from salsa cycles in enum_definition_data and the item generic-params queries instead of panicking. #10268 #10272
• Ignore trivia around #[cfg] operator names and around the #[inline] attribute argument. by @Bruce039 and…