From ad44ae86b1febd84bffa8f16880ccc00ff1bf6f5 Mon Sep 17 00:00:00 2001 From: Ori Ziv Date: Wed, 8 Jan 2025 02:55:34 +0200 Subject: [PATCH] Finding `@T` impls near `T` definition. --- corelib/src/ops.cairo | 2 +- corelib/src/ops/deref.cairo | 19 --- .../src/expr/inference/solver.rs | 43 ++++--- .../plugin_test_data/components/component | 4 +- .../plugin_test_data/components/diagnostics | 44 +++---- .../plugin_test_data/components/embeddable_as | 4 +- .../plugin_test_data/contracts/contract | 4 +- .../plugin_test_data/contracts/diagnostics | 116 +++++++++--------- .../plugin_test_data/contracts/embedded_impl | 12 +- .../plugin_test_data/contracts/external_event | 4 +- .../plugin_test_data/contracts/hello_starknet | 8 +- .../plugin_test_data/contracts/interfaces | 8 +- .../plugin_test_data/contracts/l1_handler | 4 +- .../plugin_test_data/contracts/mintable | 8 +- .../contracts/multi_component | 8 +- .../contracts/new_storage_interface | 4 +- .../plugin_test_data/contracts/ownable_erc20 | 8 +- .../plugin_test_data/contracts/raw_output | 4 +- .../plugin/plugin_test_data/contracts/storage | 4 +- .../contracts/storage_accesses | 8 +- .../contracts/upgradable_counter | 8 +- .../contracts/user_defined_types | 4 +- .../plugin_test_data/contracts/with_component | 32 ++--- .../contracts/with_component_diagnostics | 84 ++++++------- .../plugin_test_data/contracts/with_erc20 | 8 +- .../contracts/with_erc20_mini | 8 +- .../plugin_test_data/contracts/with_ownable | 8 +- .../contracts/with_ownable_mini | 8 +- .../cairo-lang-starknet/src/plugin/storage.rs | 4 +- 29 files changed, 236 insertions(+), 244 deletions(-) diff --git a/corelib/src/ops.cairo b/corelib/src/ops.cairo index d2200838bf7..6160aba97a4 100644 --- a/corelib/src/ops.cairo +++ b/corelib/src/ops.cairo @@ -4,9 +4,9 @@ pub use index::{Index, IndexView}; mod arith; pub use arith::{AddAssign, DivAssign, MulAssign, RemAssign, SubAssign}; mod deref; +pub use deref::Deref; #[feature("deref_mut")] pub use deref::DerefMut; -pub use deref::{Deref, SnapshotDeref}; mod range; // `RangeOp` is used internally by the compiler. #[allow(unused_imports)] diff --git a/corelib/src/ops/deref.cairo b/corelib/src/ops/deref.cairo index da2d45f5609..c67ba96ee57 100644 --- a/corelib/src/ops/deref.cairo +++ b/corelib/src/ops/deref.cairo @@ -98,25 +98,6 @@ pub trait DerefMut { fn deref_mut(ref self: T) -> Self::Target; } -/// A helper trait for dereferencing a snapshot of a type. Should not be implemented for copyable -/// types. -pub trait SnapshotDeref { - /// The type of the dereferenced value. - type Target; - /// Returns the dereferenced value. - fn snapshot_deref(self: @T) -> Self::Target; -} - -/// Implementation of `Deref` for snapshots that implement `SnapshotDeref`. -// TODO(Gil): Add a negative impl for Copy types, it is not working right now when T is a generic -// type. -impl SnapshotDerefHelper> of Deref<@T> { - type Target = SnapshotDeref::::Target; - fn deref(self: @T) -> Self::Target { - self.snapshot_deref() - } -} - /// Implementation of `Deref` for copyable snapshots. // TODO(Gil): This should not use the `*` operator as the `*` operator will later be calling // `Deref`. diff --git a/crates/cairo-lang-semantic/src/expr/inference/solver.rs b/crates/cairo-lang-semantic/src/expr/inference/solver.rs index 84bd186d6db..ce3209788f6 100644 --- a/crates/cairo-lang-semantic/src/expr/inference/solver.rs +++ b/crates/cairo-lang-semantic/src/expr/inference/solver.rs @@ -138,24 +138,35 @@ pub fn enrich_lookup_context( // Add the defining module of the generic args to the lookup. for generic_arg in &generic_args { if let GenericArgumentId::Type(ty) = generic_arg { - match ty.lookup_intern(db) { - TypeLongId::Concrete(concrete) => { - lookup_context - .insert_module(concrete.generic_type(db).module_file_id(db.upcast()).0); - } - TypeLongId::Coupon(function_id) => { - if let Some(module_file_id) = - function_id.get_concrete(db).generic_function.module_file_id(db) - { - lookup_context.insert_module(module_file_id.0); - } - } - TypeLongId::ImplType(impl_type_id) => { - lookup_context.insert_impl(impl_type_id.impl_id()); - } - _ => (), + enrich_lookup_context_with_ty(db, *ty, lookup_context); + } + } +} + +/// Adds the defining module of the type to the lookup context. +fn enrich_lookup_context_with_ty( + db: &dyn SemanticGroup, + ty: TypeId, + lookup_context: &mut ImplLookupContext, +) { + match ty.lookup_intern(db) { + TypeLongId::Concrete(concrete) => { + lookup_context.insert_module(concrete.generic_type(db).module_file_id(db.upcast()).0); + } + TypeLongId::Coupon(function_id) => { + if let Some(module_file_id) = + function_id.get_concrete(db).generic_function.module_file_id(db) + { + lookup_context.insert_module(module_file_id.0); } } + TypeLongId::ImplType(impl_type_id) => { + lookup_context.insert_impl(impl_type_id.impl_id()); + } + TypeLongId::Snapshot(ty) => { + enrich_lookup_context_with_ty(db, ty, lookup_context); + } + _ => (), } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/component b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/component index 84798fbb382..ebba2913958 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/component +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/component @@ -906,9 +906,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/diagnostics b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/diagnostics index 4e2ba690842..15dc0586529 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/diagnostics +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/diagnostics @@ -87,9 +87,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -271,9 +271,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -455,9 +455,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -635,9 +635,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -815,9 +815,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -999,9 +999,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1182,9 +1182,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1358,9 +1358,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1546,9 +1546,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1779,9 +1779,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1963,9 +1963,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/embeddable_as b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/embeddable_as index a7dc60baef1..7bfc636f98e 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/embeddable_as +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/components/embeddable_as @@ -651,9 +651,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/contract b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/contract index a1e41c709e7..37234df3d9f 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/contract +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/contract @@ -148,9 +148,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics index 5a05b378061..846f84a2938 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics @@ -75,9 +75,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -271,9 +271,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -483,9 +483,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -753,9 +753,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -962,9 +962,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1167,9 +1167,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1397,9 +1397,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1621,9 +1621,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1948,9 +1948,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2175,9 +2175,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2439,9 +2439,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3445,9 +3445,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3760,9 +3760,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3948,9 +3948,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -7981,9 +7981,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -8228,9 +8228,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -8495,9 +8495,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -9456,9 +9456,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -9603,9 +9603,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -9750,9 +9750,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -10713,9 +10713,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -10860,9 +10860,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -11007,9 +11007,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -11829,9 +11829,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -12662,9 +12662,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -12803,9 +12803,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -13742,9 +13742,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -14569,9 +14569,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -14764,9 +14764,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/embedded_impl b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/embedded_impl index 707489e6e64..50ee8356548 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/embedded_impl +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/embedded_impl @@ -834,9 +834,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2330,9 +2330,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3184,9 +3184,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/external_event b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/external_event index 33d510414f5..b65af4c3518 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/external_event +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/external_event @@ -210,9 +210,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/hello_starknet b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/hello_starknet index a9419adc8cb..e1e07d44c72 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/hello_starknet +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/hello_starknet @@ -74,9 +74,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -766,9 +766,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces index b8cd946ab69..2c537811748 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces @@ -1238,9 +1238,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1541,9 +1541,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/l1_handler b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/l1_handler index 64cca07c7b3..655e0bdd40c 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/l1_handler +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/l1_handler @@ -75,9 +75,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/mintable b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/mintable index 1ec2505e389..6fe483a9e7a 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/mintable +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/mintable @@ -136,9 +136,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -992,9 +992,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/multi_component b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/multi_component index 2a2e557dc26..de0f4560870 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/multi_component +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/multi_component @@ -153,9 +153,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1069,9 +1069,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/new_storage_interface b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/new_storage_interface index b6c16bbf258..9686dcfba90 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/new_storage_interface +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/new_storage_interface @@ -2603,9 +2603,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/ownable_erc20 b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/ownable_erc20 index 4802e9db63a..94c205bf19e 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/ownable_erc20 +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/ownable_erc20 @@ -107,9 +107,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -418,9 +418,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/raw_output b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/raw_output index 8b308dd3f44..66905ddc63e 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/raw_output +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/raw_output @@ -87,9 +87,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage index c206a31ad1e..9c1cb91dfe2 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage @@ -333,9 +333,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage_accesses b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage_accesses index 3f2c7aefd73..13d70dd9871 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage_accesses +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/storage_accesses @@ -206,9 +206,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2007,9 +2007,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/upgradable_counter b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/upgradable_counter index 8e9395bbd9e..10819db0454 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/upgradable_counter +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/upgradable_counter @@ -133,9 +133,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1117,9 +1117,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/user_defined_types b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/user_defined_types index ed465bcafec..ab3aab67d71 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/user_defined_types +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/user_defined_types @@ -165,9 +165,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component index a425afaa56f..d6e7c07aea5 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component @@ -120,9 +120,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -275,9 +275,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -586,9 +586,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -725,9 +725,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -878,9 +878,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1236,9 +1236,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1375,9 +1375,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1528,9 +1528,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component_diagnostics b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component_diagnostics index 76bb060128d..d82a8e0518a 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component_diagnostics +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_component_diagnostics @@ -106,9 +106,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -235,9 +235,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -496,9 +496,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -625,9 +625,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -874,9 +874,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1003,9 +1003,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1265,9 +1265,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1394,9 +1394,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1662,9 +1662,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -1827,9 +1827,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2106,9 +2106,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2235,9 +2235,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2478,9 +2478,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2614,9 +2614,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -2857,9 +2857,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3001,9 +3001,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3310,9 +3310,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3451,9 +3451,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3712,9 +3712,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -3851,9 +3851,9 @@ pub struct ComponentState { impl ComponentStateDrop of Drop> {} -impl ComponentStateDeref of core::ops::SnapshotDeref> { +impl ComponentStateDeref of core::ops::Deref<@ComponentState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ComponentState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -4004,9 +4004,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20 b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20 index 4e303764e69..32966966756 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20 +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20 @@ -86,9 +86,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -328,9 +328,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20_mini b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20_mini index b89b71c124c..048237b8fb6 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20_mini +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_erc20_mini @@ -96,9 +96,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -327,9 +327,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable index 6cc2e41d72a..72faaae51f3 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable @@ -97,9 +97,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -379,9 +379,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable_mini b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable_mini index e0e5e451cf8..154bd92e50c 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable_mini +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/with_ownable_mini @@ -106,9 +106,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } @@ -359,9 +359,9 @@ pub struct ContractState { impl ContractStateDrop of Drop {} -impl ContractStateDeref of core::ops::SnapshotDeref { +impl ContractStateDeref of core::ops::Deref<@ContractState> { type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @ContractState) -> starknet::storage::FlattenedStorage { + fn deref(self: @ContractState) -> starknet::storage::FlattenedStorage { starknet::storage::FlattenedStorage {} } } diff --git a/crates/cairo-lang-starknet/src/plugin/storage.rs b/crates/cairo-lang-starknet/src/plugin/storage.rs index 37ce76896c6..d4e63b03909 100644 --- a/crates/cairo-lang-starknet/src/plugin/storage.rs +++ b/crates/cairo-lang-starknet/src/plugin/storage.rs @@ -87,9 +87,9 @@ pub fn handle_storage_struct( impl {state_struct_name}Drop{generic_arg_str} of Drop<{full_state_struct_name}> {{}} impl {state_struct_name}Deref{generic_arg_str} of \ - core::ops::SnapshotDeref<{full_state_struct_name}> {{ + core::ops::Deref<@{full_state_struct_name}> {{ type Target = starknet::storage::FlattenedStorage; - fn snapshot_deref(self: @{full_state_struct_name}) -> \ + fn deref(self: @{full_state_struct_name}) -> \ starknet::storage::FlattenedStorage {{ starknet::storage::FlattenedStorage {{}} }}