v2.2.0
Breaking Changes
Bug Fixes
- Avoid unnecessary struct reconstruction. #3739
- Marked account contract trait with starknet interface. #3743
- Fixed error message for missing gas. #3738
- Fixed member usages under
if
s in loops. #3770 - Forbid error propagation inside a loop. #3773
- Fixing snippets view fn without external by @gaetbout in #3857
- Fix issues with self referential generics. #3879
- Fix issue #3863. #3892
New Features
- Formatter Improvements.
- Better line breaks in recursive struct construction.
- No extra space after commas at end of lines.
- Language Server improvements.
- Additional auto completions.
- Additional goto definitions.
- Better syntax highlighting.
- ByteArray + String literals (Experimental: Cannot be used on starknet).
- Signed Integers (Experimental: Cannot be used on starknet).
- Added estimated gas to test result. #3709
- Added
default
impl for tuples up to size 4. #3742 - Added ecdsa recovery. #3735
- Made error message for entry point be dependent on failing var. #3740
- derive
Serde
for BlockInfo/TxInfo by @enitrat in #3781 - Add option for sorting imports in formatter by @ericnordelo in #3778
- Refactored Hash trait, hash implementation is now generic. #3714
- snippets use array! by @gaetbout in #3814
- Added PartialEq impl for Array. #3812
- Add
pop_l2_to_l1_message
cheatcode by @0xChqrles in #3783 - Nullable new method by @enitrat in #3841
- Added line number to sierra printing. #3902
- Made inline macros pluginable. #3873
- Named generic arguments. #3903
- Added derive for
Default
trait. #3935 - Added derive for
Hash
trait. #3936 - Added inline macro
selector!("entry_point_name")
for starknet, that returns the corresponding numeric value of the entry point selector.
Diagnostics Improvements.
code:
#[derive(Copy)]
struct ACopy {}
#[derive(Drop)]
struct ADrop {}
fn use_a_copy(x: ACopy) { .. }
fn use_a_drop(x: ADrop) { .. }
fn foo(x: ACopy, y: ADrop) -> ADrop {
if true {
use_a_copy(x);
use_a_drop(y);
} else {
}
y
}
diagnostics:
error: Variable was previously moved.
--> lib.cairo:14:3
y
^
note: variable was previously used here:
--> lib.cairo:11:16
use_a_drop(y);
^
note: Trait has no implementation in context: core::traits::Copy::<test::ADrop>
error: Variable not dropped.
--> lib.cairo:8:8
fn foo(x: ACopy, y: ADrop) -> ADrop {
^
+note: the variable needs to be dropped due to the divergence here:
+ --> lib.cairo:9:3
+ if true {
+ ^*******^
note: Trait has no implementation in context: core::traits::Drop::<test::ACopy>
note: Trait has no implementation in context: core::traits::Destruct::<test::ACopy>
code:
struct A {}
fn foo(ref a: A) {
1 + 1;
}
diagnostics:
error: Variable not dropped.
--> lib.cairo:2:12
fn foo(ref a: A) {
^
+note: the variable needs to be dropped due to the potential panic here:
+ --> lib.cairo:3:4
+ 1 + 1;
+ ^***^
note: Trait has no implementation in context: core::traits::Drop::<test::A>
note: Trait has no implementation in context: core::traits::Destruct::<test::A>
code:
struct NonCopy {}
struct MyStruct {
a: felt252,
b: NonCopy,
}
fn foo(mut x: MyStruct) -> MyStruct {
x.a = 17;
x.a += 1;
return x;
}
diagnostics:
error: Variable not dropped.
- --> lib.cairo:10:3
- x.a = 17;
- ^*^
+ --> lib.cairo:9:12
+fn foo(mut x: MyStruct) -> MyStruct {
+ ^
+note: the variable needs to be dropped due to the potential panic here:
+ --> lib.cairo:11:3
x.a += 1;
^******^
note: Trait has no implementation in context: core::traits::Drop::<test::NonCopy>
note: Trait has no implementation in context: core::traits::Destruct::<test::NonCopy>
Optimizations
- Statement reorder and remove unused not only for literals. #3696
- Improve encode/decode implementation. #3800
- Faster compile time generally (Various optimizations)
Others
- Fix typos by @xiaolou86 in #3324
- Fix broken Cairo 0.12 link by @MegaRedHand in #3685
- Search asdf directories for scarb executable by @szymmis in #3665
- Update prerequisits.adoc by @kapsteur in #3816
New Contributors
- @xiaolou86 made their first contribution in #3324
- @MegaRedHand made their first contribution in #3685
- @szymmis made their first contribution in #3665
- @kapsteur made their first contribution in #3816
- @0xChqrles made their first contribution in #3783
- @tkstanczak made their first contribution in #3849
Full Changelog: v2.1.1...v2.2.0