Releases: starkware-libs/cairo
Releases · starkware-libs/cairo
Release list
v2.19.6
v2.19.5
v2.20.0
What's Changed
Highlights
- Tuple element access via
t.0syntax. Tuple elements can now be accessed positionally with dot notation (t.0,t.1, …), including nested access, assignments,refarguments, and access through snapshots. #10111 #10153 #[panic_with]is deprecated. Using the attribute without opting in via#[feature("deprecated-panic-with")]now emits a warning; prefer plain calculations (now supported inconstcontext) or explicit.expect(...)calls. As part of this, the generated wrapper functions were removed from the corelib — see the breaking change under Corelib below. #10096- Faster incremental recompilation. Syntax node ids are now kept stable across reparses and plugin-generated files are cached, restoring salsa early cutoff so a structure-preserving edit no longer re-walks the rest of the file — noticeably speeding up the language server. #10105 #10164
Features
- Support tuple element access via
t.0syntax. #10111 #10153 - Deprecated the
#[panic_with]attribute; opt in with#[feature("deprecated-panic-with")]to silence the warning. #10096 - Warn (
E2201) when anexterntype or function is declared outside the core library; suppress with#[allow(extern_outside_corelib)]. #10147 - Support struct-update (
..base) syntax inconstexpressions. #10136 - Evaluate
!,&,|, and^onbooloperands inconstcontexts. #10212 - Populate
MacroPluginMetadata::allowed_featuresso macro plugins can honor#[feature(...)]. #10094
Bug Fixes
- Reject types that are (or transitively contain) a phantom type when used as values, in signatures, or as array elements, including nested and cyclic cases (
E2019), instead of silently compiling or hitting an ICE. #10120 #10169 #10171 #10175 - Disable
Felt252Dictconstruction for illegal value types. #10118 - Emit a diagnostic (
E2075) for glob (*)useitems in statement position instead of silently accepting them. #10148 - Reject
#[default]on a struct member instead of silently ignoring it. #10228 - Fixed
derive(Hash)/derive(Serde)codegen for enums, and sanitized the generated hash/serde implementations. #10080 #10117 - Emit derive member bounds for associated-type-path members. #10176
- Validate the quotient in
constDivRemto avoid a signedMIN/-1ICE. #10140 - Substitute the result of generic
constfunction calls with the concrete call-site types. #10143 - Include
captured_typesin the closure occurs-check. #10086 - Don't ICE on a
Derefimpl with the wrong number of associated types. #10183 - Don't ICE when an impl provides an associated item of the wrong kind. #10206
- Report every invalid associated-item constraint, not just the first. #10207
- Don't ICE on a wrong generic-argument count reached through a local
usealias. #10211 - Report a glob name collision of non-visible items as not-visible rather than ambiguous. #10209
- Apply feature/visibility gating to glob re-exports of generic items. #10217
- Enforce the fixed-size-array size cap on the type form. #10218
- Attribute
format!/print!bracket errors to the right macro. #10222 writeln!(f)with no format string now writes a newline. #10182- Apply full type-based diagnostics to all parts of a function signature. #10170
- Removed an extra diagnostic emitted for type mismatches on
missing. #10121 - Fixed punctuation/newline of bare crate-root diagnostics. #10087
- Skipped-token diagnostic now spans the token, not its leading comment. #10088
- Validate the literal in a negative const generic argument, and anchor literal-validation diagnostics at the token text. #10091 #10103
- Treat
////as a regular comment, not a doc comment. #10107 - Make
macroa valid recovery terminal and tree token. #10149 - Stop block recovery at a following control-flow statement. #10227
- Dedup
panic_destructcalls for a variable at a shared panic location. #10205 - Normalize
storage_base_address_from_felt252const folding. #10210 - Prune usage after change promotion in loop usage finalization. #10201
- Name macro-call modules by macro name and offset instead of raw call text. #10197
- Close the
]in theFixedSizeArraytype short name. #10172 - Fixed a
from_tracepanic by profilingcoupon_calllikefunction_callin the runner. #10081 - Make inline doc links with markup point to their URL. #10151
- Collect executables from modules generated by macro calls. by @integraledelebesgue in #10184
Starknet
- Fully-qualify prelude types in contract codegen. #10137
- Clearer error for a non-
ref selfconstructor. #10223 - Calling
meta_tx_v0no longer crashescairo test. #10219 - Fixed test-deployment hygiene issues in the Starknet plugin. #10173
- Reject crafted out-of-range type ids instead of panicking when building a Starknet class. #10224
- Validate entry-point signatures before compilation in class-to-casm. #10221
- Validate that entry-point builtins are in canonical order in class-to-casm. #10213
Corelib
- Breaking: removed the generated
#[panic_with]wrapper functions (e.g.array_at,u128_from_felt252,u128_sub,u256_sub, and theu*_as_non_zerohelpers) in favor of the_try_*/.expect(...)equivalents. #10095 - Made
Encode::size_hintmore exact. #10108
Formatter
- Sort merged
useitems viacompare_names, and madeusemerging more consistent. #10123 #10150 - Don't glue a comment to
{in an empty block. #10188 - Made
cairofmt::skipwork properly for additional items. #10220
Optimizations
- Stream the lexer with a lookahead window instead of cloning all tokens up front, reducing peak memory during parsing. #10141
- Keep syntax node ids stable across reparses (canonical roots, kind-keyed child index, parent-relative offsets), restoring salsa early cutoff for structure-preserving edits. #10105 #10190 #10191
- Cache external (plugin-generated) file content in the defs cache. #10164
- Track arrays as a bounded suffix behind a forgotten prefix in equality analysis, and keep tracking remainders popped through it. #10076 #10085
- Avoid cloning blocks and analysis info in inlining and dataflow. #10127
- Made
substitutefaster on empty substitutions. #10146 - Reduced intermediary string allocations across the compiler. #10124 #10125 #10126
Documentation
- Corrected corelib doc examples and comments:
DivRem,keccak_u256s_be_inputs,get_curve_size,egcd's# Panics,Iterator::sum, byte-array example, and misc doc-comment fixes. #10092 https://gi...
v2.20.0-rc.2
Cairo compiler.
v2.19.4
Bumped version to v2.20.0-rc.1.
Cairo compiler.
v2.19.3
v2.20.0-rc.0
Cairo compiler.
v2.19.2
v2.19.0
What's Changed
Features
- Support
Span<T>destructuring via fixed-size array patterns. #9823 - Added support for const calculation of inner variants and lets. #9899
- Implemented sha512 syscall and libfuncs. #9947
- Added sha384 implementation. #9990
- Added struct and enum names and variants to sierra debug info. #9923
- Added type debug info for contracts. #9957
Bug Fixes
- semantic/cache: dedupe const generic args by const value id by @s0mnathh in #9850
- semantic/cache: dedupe FixedSizeArray const size id by @Keemosty12 in #9851
- Include all reachable modules in cache generation via BFS over submodule and macro call edges. #9860
- Report UnsupportedConstant for non-concrete args in eq/ne/not const eval. #9879
- Preventing infinite inlining of cycle functions. #9917
- Fixed ICE on nested const fn in const fn. #9901
- Emit diagnostic on division/modulo by zero in consteval_int by @anon-researchers-123 in #9904
- Reject non-concrete const logical lhs by @Elena343-ai in #9919
- Fixed numeric_value_and_suffix to handle compound suffixes; error on typed literals in consteval_int and test attrs. #9927
- Introduce
NumericLiteraltype variant for numeric literals. #9929 - Point const-decl literal errors at the value expression. #9930
- Narrow return-type mismatch span to the value-producing expression. #9931
- Validate inferred numeric literal values against their type. #10040
- Skip macro rules with parser-rejected patterns instead of expanding them. #9960
- Avoid panic when an item-scope inline macro lacks an arg-list bracket. #9961
- Don't panic on $(...) without operator in macro calls. #10005
- Preserve escapes in simple panic! macro expansion. #9980
- Correct diagnostic span for write! named placeholders after escapes. #9986
- Correct ClassHash/ContractAddress downcast upper bound off-by-one by @SAY-5 in #9967
- Fixed off-by-one boundary in non-allowed qm31 libfunc. #10009
- Correct NegativeImplLongId::is_fully_concrete. #10010
- Extract generic params from FixedSizeArray size field in negative impl resolution. #10002
- Emit RefutablePattern diagnostic instead of ICE on Span fixed-array let. #9969
- Emit E2008 for generic-type numeric literal suffixes instead of ICE. #9978
- Prevent crash on
?on generics. #9999 - Emit unterminated string error for strings ending with backslash-quote. #9998
- Accept resolver-modifier paths in pattern position. #10039
- Improved missing comma diag. #10063
- Made compile_error! diag not include
"s. #10064 - Use all cfg args to extract diagnostics. #10065
- Respect #[cfg] when generating deploy_for_test. #10011
- Fixed suggested
crate::context paths. #10044 - Prevented doubled
use self;diagnostic. #10067 - Eliminate spurious E3002 alongside E3001 for moved struct members. #9994
- Give reconstructed structs the original variable's location in E3002. #9996
- Removed extra diag in cases of out of range u256 match. #10006
- early_unsafe_panic must keep side-effecting statements. #10033
- Propagate destruct-impl error in closure lowering. #10007
- Match on @Never with enum_snapshot_match. #10046
- Handle empty enum in
Storederive. #10069 - Fixed issue with identical variants on return building. #10056
- Ignoring later fields instead of overriding when getting dup fields. #10053
- Correct n_steps by removing erroneous -1 offsets. #10003
- Include RangeCheck96 in ConstCost::into_full_cost_iter. #10038
- Canonicalize felt252 const-eval values to a unique field-element representative. #9959
- const_values_eq must canonicalize felt252 inside compounds. #10037
- Canonicalize felt252 inside NonZero when matching const patterns. #10058
- Use exclusive upper bound in ExpansionOffset::mapped. #10017
- Include TokenMissing in generated is_missing(). #10020
- Fixed
u128_guarantee_mulsimulation. #10050 - Fixed implementation of u128s_from_felt simulation. #10068
- Bound test result queue in test runner by @vh0rvath in #9979
Corelib
- Made bounded-int type pub. #9882
- Removed non-safe variant of array-hash. #9988
- Take::nth(usize::MAX) returns None instead of overflowing. #10022
- Make Take::advance_by arithmetic panic-free. #10036
- Add /= and %= for i32/i64/i128 via non-deprecated *Assign. #10027
- Fixed ByteSpan::get OOB empty range. #10051
- Made the panic message more exact for
i128_mul. #10042
Formatter
- Sort
use self::...items by their full path. #10018 - Avoid usize underflow on over-wide comment prefixes. #10035
- Made all single line comment prevent removing line-breaks. #10045
- Drop trailing empty lines when building the output. #10057
Optimizations
- Non-copy variable forwarding with chain removal. #9905
- Remove cancel_ops phase, subsumed by variable forwarding. #10015
- Using equality analysis to improve match optimization. #9893
- Preallocate lowering pipeline buffers and skip SubStrategy clone. #9995
- Preallocate Sierra emission buffers. #10000
- Memoize per-module feature_config. #9997
- Cache Result/Option EnumIds in CoreInfo, use ID comparison. #9985
Other
- Bumped sierra version. #9972
- Migrated HashMap/HashSet to deterministic Unordered/Ordered wrappers, disallowing std types via clippy. #9953
- dev and rc tags are not marked as latest release. #10030
New Contributors
- @s0mnathh made their first contribution in #9850
- @Keemosty12 made their first contribution in #9851
- @purelualight made their first contribution in #9878
- @mk0walsk made their first contribution in #9881
- @criciss made their first contribution in #9890
- @anon-researchers-123 made their first contribution in #9904
- @serikssonn made their first contribution in #9910
- @jschnelder made their first contribution in #9898
- @box4wangjing made their first contribution in #9918
- @ml0mbardi made their first contribution in #9915
- @knagy2 made their first contribution in #9920
- @ralme1da made their first contribution in https://github.com/starkware-libs/...