From 1b8e9a697623993c43306ae11ebfbb6247475d01 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Fri, 11 Apr 2025 08:46:51 +0200 Subject: [PATCH 1/5] chore: rust 2024 --- .rustfmt.toml | 4 ++-- Cargo.toml | 2 +- integration-tests/public/call-runtime/Cargo.toml | 2 +- integration-tests/public/combined-extension/Cargo.toml | 2 +- .../public/complex-storage-structures/Cargo.toml | 2 +- integration-tests/public/conditional-compilation/Cargo.toml | 2 +- integration-tests/public/contract-invocation/Cargo.toml | 2 +- .../public/contract-invocation/contract1/Cargo.toml | 2 +- .../public/contract-invocation/contract2/Cargo.toml | 2 +- .../public/contract-invocation/virtual_contract/Cargo.toml | 2 +- .../contract-invocation/virtual_contract_ver1/Cargo.toml | 2 +- .../contract-invocation/virtual_contract_ver2/Cargo.toml | 2 +- integration-tests/public/contract-storage/Cargo.toml | 2 +- integration-tests/public/contract-terminate/Cargo.toml | 2 +- integration-tests/public/contract-transfer/Cargo.toml | 2 +- integration-tests/public/contract-xcm/Cargo.toml | 2 +- integration-tests/public/cross-contract-calls/Cargo.toml | 2 +- .../public/cross-contract-calls/other-contract/Cargo.toml | 2 +- integration-tests/public/custom-allocator/Cargo.toml | 2 +- integration-tests/public/custom-environment/Cargo.toml | 2 +- integration-tests/public/debugging-strategies/Cargo.toml | 2 +- integration-tests/public/dns/Cargo.toml | 2 +- integration-tests/public/e2e-call-runtime/Cargo.toml | 2 +- integration-tests/public/erc1155/Cargo.toml | 2 +- integration-tests/public/erc20/Cargo.toml | 2 +- integration-tests/public/erc721/Cargo.toml | 2 +- integration-tests/public/events/Cargo.toml | 2 +- integration-tests/public/events/event-def-unused/Cargo.toml | 2 +- integration-tests/public/events/event-def/Cargo.toml | 2 +- integration-tests/public/events/event-def2/Cargo.toml | 2 +- integration-tests/public/flipper/Cargo.toml | 2 +- integration-tests/public/incrementer/Cargo.toml | 2 +- integration-tests/public/lazyvec/Cargo.toml | 2 +- integration-tests/public/multi-contract-caller/Cargo.toml | 2 +- .../public/multi-contract-caller/accumulator/Cargo.toml | 2 +- .../public/multi-contract-caller/adder/Cargo.toml | 2 +- .../public/multi-contract-caller/subber/Cargo.toml | 2 +- integration-tests/public/multisig/Cargo.toml | 2 +- integration-tests/public/own-code-hash/Cargo.toml | 2 +- integration-tests/public/payment-channel/Cargo.toml | 2 +- integration-tests/public/psp22-extension/Cargo.toml | 2 +- integration-tests/public/rand-extension/Cargo.toml | 2 +- integration-tests/public/runtime-call-contract/Cargo.toml | 2 +- .../public/runtime-call-contract/traits/Cargo.toml | 2 +- integration-tests/public/sol-cross-contract/Cargo.toml | 2 +- .../public/sol-cross-contract/other-contract-sol/Cargo.toml | 2 +- integration-tests/public/sol_encoding/Cargo.toml | 2 +- integration-tests/public/solidity-calls-flipper/Cargo.toml | 2 +- .../public/trait-dyn-cross-contract-calls/Cargo.toml | 2 +- .../contracts/incrementer/Cargo.toml | 2 +- .../public/trait-dyn-cross-contract-calls/traits/Cargo.toml | 2 +- integration-tests/public/trait-erc20/Cargo.toml | 2 +- integration-tests/public/trait-flipper/Cargo.toml | 2 +- integration-tests/public/trait-incrementer/Cargo.toml | 2 +- integration-tests/public/trait-incrementer/traits/Cargo.toml | 2 +- .../public/upgradeable-contracts/delegator/Cargo.toml | 2 +- .../upgradeable-contracts/delegator/delegatee/Cargo.toml | 2 +- .../upgradeable-contracts/delegator/delegatee2/Cargo.toml | 2 +- .../upgradeable-contracts/set-code-hash-migration/Cargo.toml | 2 +- .../set-code-hash-migration/migration/Cargo.toml | 2 +- .../set-code-hash-migration/updated-incrementer/Cargo.toml | 2 +- .../public/upgradeable-contracts/set-code-hash/Cargo.toml | 2 +- .../set-code-hash/updated-incrementer/Cargo.toml | 2 +- integration-tests/public/wildcard-selector/Cargo.toml | 2 +- linting/Cargo.toml | 2 +- 65 files changed, 66 insertions(+), 66 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 90456fa14ec..ad7b0d27345 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -43,8 +43,8 @@ trailing_comma = "Vertical" match_block_trailing_comma = false blank_lines_upper_bound = 1 blank_lines_lower_bound = 0 -edition = "2021" # changed -style_edition = "2021" +edition = "2024" # changed +style_edition = "2024" merge_derives = true use_try_shorthand = true # changed use_field_init_shorthand = true # changed diff --git a/Cargo.toml b/Cargo.toml index bc0221693f8..72d673d532b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ exclude = [ [workspace.package] authors = ["Use Ink "] categories = ["no-std", "embedded"] -edition = "2021" +edition = "2024" homepage = "https://use.ink" keywords = ["polkavm", "ink", "riscv", "blockchain", "edsl"] license = "Apache-2.0" diff --git a/integration-tests/public/call-runtime/Cargo.toml b/integration-tests/public/call-runtime/Cargo.toml index 037ffc30e5c..02c4eab9f49 100644 --- a/integration-tests/public/call-runtime/Cargo.toml +++ b/integration-tests/public/call-runtime/Cargo.toml @@ -2,7 +2,7 @@ name = "call-runtime" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/combined-extension/Cargo.toml b/integration-tests/public/combined-extension/Cargo.toml index 169d4b2ebc5..4a83701b603 100755 --- a/integration-tests/public/combined-extension/Cargo.toml +++ b/integration-tests/public/combined-extension/Cargo.toml @@ -2,7 +2,7 @@ name = "combined_extension" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/complex-storage-structures/Cargo.toml b/integration-tests/public/complex-storage-structures/Cargo.toml index c0cf89c1cfc..c869b69b938 100644 --- a/integration-tests/public/complex-storage-structures/Cargo.toml +++ b/integration-tests/public/complex-storage-structures/Cargo.toml @@ -2,7 +2,7 @@ name = "complex_storage_structures" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/conditional-compilation/Cargo.toml b/integration-tests/public/conditional-compilation/Cargo.toml index b3b9c7c9717..4832829a151 100755 --- a/integration-tests/public/conditional-compilation/Cargo.toml +++ b/integration-tests/public/conditional-compilation/Cargo.toml @@ -2,7 +2,7 @@ name = "conditional-compilation" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../crates/ink", default-features = false, features = ["unstable-hostfn"] } diff --git a/integration-tests/public/contract-invocation/Cargo.toml b/integration-tests/public/contract-invocation/Cargo.toml index 3cb9070ca6d..dcca199b179 100644 --- a/integration-tests/public/contract-invocation/Cargo.toml +++ b/integration-tests/public/contract-invocation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "instantiate_contract" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-invocation/contract1/Cargo.toml b/integration-tests/public/contract-invocation/contract1/Cargo.toml index 673e4851922..68c597bfb6d 100644 --- a/integration-tests/public/contract-invocation/contract1/Cargo.toml +++ b/integration-tests/public/contract-invocation/contract1/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "contract1" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-invocation/contract2/Cargo.toml b/integration-tests/public/contract-invocation/contract2/Cargo.toml index 690769ad908..4dfa095761a 100644 --- a/integration-tests/public/contract-invocation/contract2/Cargo.toml +++ b/integration-tests/public/contract-invocation/contract2/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "contract2" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-invocation/virtual_contract/Cargo.toml b/integration-tests/public/contract-invocation/virtual_contract/Cargo.toml index 8ae0adc03d4..b180522f708 100644 --- a/integration-tests/public/contract-invocation/virtual_contract/Cargo.toml +++ b/integration-tests/public/contract-invocation/virtual_contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "virtual_contract" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-invocation/virtual_contract_ver1/Cargo.toml b/integration-tests/public/contract-invocation/virtual_contract_ver1/Cargo.toml index b82ec867d65..f5d90de2536 100644 --- a/integration-tests/public/contract-invocation/virtual_contract_ver1/Cargo.toml +++ b/integration-tests/public/contract-invocation/virtual_contract_ver1/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "virtual_contract_ver1" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-invocation/virtual_contract_ver2/Cargo.toml b/integration-tests/public/contract-invocation/virtual_contract_ver2/Cargo.toml index 2362d17fdf9..507fbcff141 100644 --- a/integration-tests/public/contract-invocation/virtual_contract_ver2/Cargo.toml +++ b/integration-tests/public/contract-invocation/virtual_contract_ver2/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "virtual_contract_ver2" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Víctor M. González "] [lib] diff --git a/integration-tests/public/contract-storage/Cargo.toml b/integration-tests/public/contract-storage/Cargo.toml index 23f29865b0a..3c0c91763f9 100755 --- a/integration-tests/public/contract-storage/Cargo.toml +++ b/integration-tests/public/contract-storage/Cargo.toml @@ -2,7 +2,7 @@ name = "contract-storage" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/contract-terminate/Cargo.toml b/integration-tests/public/contract-terminate/Cargo.toml index b8f5052e3b2..d26bf85ccd8 100644 --- a/integration-tests/public/contract-terminate/Cargo.toml +++ b/integration-tests/public/contract-terminate/Cargo.toml @@ -2,7 +2,7 @@ name = "contract_terminate" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/contract-transfer/Cargo.toml b/integration-tests/public/contract-transfer/Cargo.toml index d25ac271fc6..23589a51d21 100644 --- a/integration-tests/public/contract-transfer/Cargo.toml +++ b/integration-tests/public/contract-transfer/Cargo.toml @@ -2,7 +2,7 @@ name = "contract_transfer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/contract-xcm/Cargo.toml b/integration-tests/public/contract-xcm/Cargo.toml index e6d58287316..b9f3ce03ee4 100644 --- a/integration-tests/public/contract-xcm/Cargo.toml +++ b/integration-tests/public/contract-xcm/Cargo.toml @@ -2,7 +2,7 @@ name = "contract-xcm" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/cross-contract-calls/Cargo.toml b/integration-tests/public/cross-contract-calls/Cargo.toml index e17480245cd..ae6a5892f23 100755 --- a/integration-tests/public/cross-contract-calls/Cargo.toml +++ b/integration-tests/public/cross-contract-calls/Cargo.toml @@ -2,7 +2,7 @@ name = "cross-contract-calls" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/cross-contract-calls/other-contract/Cargo.toml b/integration-tests/public/cross-contract-calls/other-contract/Cargo.toml index aeaad24f9d8..ae9134ee373 100755 --- a/integration-tests/public/cross-contract-calls/other-contract/Cargo.toml +++ b/integration-tests/public/cross-contract-calls/other-contract/Cargo.toml @@ -2,7 +2,7 @@ name = "other-contract" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/custom-allocator/Cargo.toml b/integration-tests/public/custom-allocator/Cargo.toml index beb15271559..4e7d6dd1a18 100755 --- a/integration-tests/public/custom-allocator/Cargo.toml +++ b/integration-tests/public/custom-allocator/Cargo.toml @@ -2,7 +2,7 @@ name = "custom-allocator" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/custom-environment/Cargo.toml b/integration-tests/public/custom-environment/Cargo.toml index 355ed687977..5109f6d433c 100644 --- a/integration-tests/public/custom-environment/Cargo.toml +++ b/integration-tests/public/custom-environment/Cargo.toml @@ -2,7 +2,7 @@ name = "custom-environment" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/debugging-strategies/Cargo.toml b/integration-tests/public/debugging-strategies/Cargo.toml index f8901f3518e..9dd7ee62d5c 100755 --- a/integration-tests/public/debugging-strategies/Cargo.toml +++ b/integration-tests/public/debugging-strategies/Cargo.toml @@ -3,7 +3,7 @@ name = "debugging_strategies" description = "Illustrates different debugging strategies" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/dns/Cargo.toml b/integration-tests/public/dns/Cargo.toml index 0261f700b7d..7596a7868b3 100644 --- a/integration-tests/public/dns/Cargo.toml +++ b/integration-tests/public/dns/Cargo.toml @@ -2,7 +2,7 @@ name = "dns" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/e2e-call-runtime/Cargo.toml b/integration-tests/public/e2e-call-runtime/Cargo.toml index e79c77f1988..6fbe6141bbf 100644 --- a/integration-tests/public/e2e-call-runtime/Cargo.toml +++ b/integration-tests/public/e2e-call-runtime/Cargo.toml @@ -2,7 +2,7 @@ name = "e2e_call_runtime" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/erc1155/Cargo.toml b/integration-tests/public/erc1155/Cargo.toml index f7d84b9a848..14250d475cb 100644 --- a/integration-tests/public/erc1155/Cargo.toml +++ b/integration-tests/public/erc1155/Cargo.toml @@ -2,7 +2,7 @@ name = "erc1155" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/erc20/Cargo.toml b/integration-tests/public/erc20/Cargo.toml index cfcf27e10dd..5f3aa0efa38 100644 --- a/integration-tests/public/erc20/Cargo.toml +++ b/integration-tests/public/erc20/Cargo.toml @@ -2,7 +2,7 @@ name = "erc20" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/erc721/Cargo.toml b/integration-tests/public/erc721/Cargo.toml index 45d0947c0b9..d7999e5d35c 100644 --- a/integration-tests/public/erc721/Cargo.toml +++ b/integration-tests/public/erc721/Cargo.toml @@ -2,7 +2,7 @@ name = "erc721" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/events/Cargo.toml b/integration-tests/public/events/Cargo.toml index dc3a0ddcf4f..1ea671dde77 100644 --- a/integration-tests/public/events/Cargo.toml +++ b/integration-tests/public/events/Cargo.toml @@ -2,7 +2,7 @@ name = "events" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/events/event-def-unused/Cargo.toml b/integration-tests/public/events/event-def-unused/Cargo.toml index 0f22aaa8082..11ea369825a 100644 --- a/integration-tests/public/events/event-def-unused/Cargo.toml +++ b/integration-tests/public/events/event-def-unused/Cargo.toml @@ -2,7 +2,7 @@ name = "event-def-unused" authors = ["Use Ink "] version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/events/event-def/Cargo.toml b/integration-tests/public/events/event-def/Cargo.toml index 7c4ec74b32c..d934d2ddfff 100644 --- a/integration-tests/public/events/event-def/Cargo.toml +++ b/integration-tests/public/events/event-def/Cargo.toml @@ -2,7 +2,7 @@ name = "event-def" authors = ["Use Ink "] version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/events/event-def2/Cargo.toml b/integration-tests/public/events/event-def2/Cargo.toml index ae45732d6c4..3bcec864947 100644 --- a/integration-tests/public/events/event-def2/Cargo.toml +++ b/integration-tests/public/events/event-def2/Cargo.toml @@ -2,7 +2,7 @@ name = "event-def2" authors = ["Use Ink "] version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/flipper/Cargo.toml b/integration-tests/public/flipper/Cargo.toml index 7f77efce3e0..a3cb5f4e7c3 100644 --- a/integration-tests/public/flipper/Cargo.toml +++ b/integration-tests/public/flipper/Cargo.toml @@ -2,7 +2,7 @@ name = "flipper" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/incrementer/Cargo.toml b/integration-tests/public/incrementer/Cargo.toml index 7cde84afca7..121eedb8957 100644 --- a/integration-tests/public/incrementer/Cargo.toml +++ b/integration-tests/public/incrementer/Cargo.toml @@ -2,7 +2,7 @@ name = "incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/lazyvec/Cargo.toml b/integration-tests/public/lazyvec/Cargo.toml index 622bfeeebe9..382730cd96d 100755 --- a/integration-tests/public/lazyvec/Cargo.toml +++ b/integration-tests/public/lazyvec/Cargo.toml @@ -2,7 +2,7 @@ name = "lazyvec" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/multi-contract-caller/Cargo.toml b/integration-tests/public/multi-contract-caller/Cargo.toml index ea5e4d1f306..dab03aeb489 100644 --- a/integration-tests/public/multi-contract-caller/Cargo.toml +++ b/integration-tests/public/multi-contract-caller/Cargo.toml @@ -2,7 +2,7 @@ name = "multi-contract-caller" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/multi-contract-caller/accumulator/Cargo.toml b/integration-tests/public/multi-contract-caller/accumulator/Cargo.toml index 9f75347d8af..cd4ba3ab429 100644 --- a/integration-tests/public/multi-contract-caller/accumulator/Cargo.toml +++ b/integration-tests/public/multi-contract-caller/accumulator/Cargo.toml @@ -2,7 +2,7 @@ name = "accumulator" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/multi-contract-caller/adder/Cargo.toml b/integration-tests/public/multi-contract-caller/adder/Cargo.toml index a33e56135b7..db01d0a3299 100644 --- a/integration-tests/public/multi-contract-caller/adder/Cargo.toml +++ b/integration-tests/public/multi-contract-caller/adder/Cargo.toml @@ -2,7 +2,7 @@ name = "adder" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/multi-contract-caller/subber/Cargo.toml b/integration-tests/public/multi-contract-caller/subber/Cargo.toml index e9c6f1fab2a..cabd75ed661 100644 --- a/integration-tests/public/multi-contract-caller/subber/Cargo.toml +++ b/integration-tests/public/multi-contract-caller/subber/Cargo.toml @@ -2,7 +2,7 @@ name = "subber" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" [dependencies] ink = { path = "../../../../crates/ink", default-features = false } diff --git a/integration-tests/public/multisig/Cargo.toml b/integration-tests/public/multisig/Cargo.toml index a41eb60d151..64b3f706760 100755 --- a/integration-tests/public/multisig/Cargo.toml +++ b/integration-tests/public/multisig/Cargo.toml @@ -2,7 +2,7 @@ name = "multisig" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/own-code-hash/Cargo.toml b/integration-tests/public/own-code-hash/Cargo.toml index a4af3020ae7..34307d3ef06 100644 --- a/integration-tests/public/own-code-hash/Cargo.toml +++ b/integration-tests/public/own-code-hash/Cargo.toml @@ -2,7 +2,7 @@ name = "own-code-hash" version = "4.3.0" authors = ["Parity Technologies "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/payment-channel/Cargo.toml b/integration-tests/public/payment-channel/Cargo.toml index 3ba00258dd8..08223c2d2e1 100755 --- a/integration-tests/public/payment-channel/Cargo.toml +++ b/integration-tests/public/payment-channel/Cargo.toml @@ -2,7 +2,7 @@ name = "payment_channel" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/psp22-extension/Cargo.toml b/integration-tests/public/psp22-extension/Cargo.toml index e5bef30ab20..0bb89f9af94 100755 --- a/integration-tests/public/psp22-extension/Cargo.toml +++ b/integration-tests/public/psp22-extension/Cargo.toml @@ -2,7 +2,7 @@ name = "psp22_extension" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/rand-extension/Cargo.toml b/integration-tests/public/rand-extension/Cargo.toml index 3febc89414a..0dbfa49e757 100755 --- a/integration-tests/public/rand-extension/Cargo.toml +++ b/integration-tests/public/rand-extension/Cargo.toml @@ -2,7 +2,7 @@ name = "rand_extension" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/runtime-call-contract/Cargo.toml b/integration-tests/public/runtime-call-contract/Cargo.toml index 2d7be363048..08d327a611f 100644 --- a/integration-tests/public/runtime-call-contract/Cargo.toml +++ b/integration-tests/public/runtime-call-contract/Cargo.toml @@ -3,7 +3,7 @@ members = ["sandbox-runtime", "traits"] [workspace.package] authors = ["Use Ink "] -edition = "2021" +edition = "2024" homepage = "https://use.ink" license = "Apache-2.0" repository = "https://github.com/use-ink/ink" diff --git a/integration-tests/public/runtime-call-contract/traits/Cargo.toml b/integration-tests/public/runtime-call-contract/traits/Cargo.toml index a760fa8a3bc..86d7dee6e3c 100644 --- a/integration-tests/public/runtime-call-contract/traits/Cargo.toml +++ b/integration-tests/public/runtime-call-contract/traits/Cargo.toml @@ -2,7 +2,7 @@ name = "flipper-traits" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/sol-cross-contract/Cargo.toml b/integration-tests/public/sol-cross-contract/Cargo.toml index 3113522f0b4..b6f81d063cb 100755 --- a/integration-tests/public/sol-cross-contract/Cargo.toml +++ b/integration-tests/public/sol-cross-contract/Cargo.toml @@ -2,7 +2,7 @@ name = "sol-cross-contract" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/sol-cross-contract/other-contract-sol/Cargo.toml b/integration-tests/public/sol-cross-contract/other-contract-sol/Cargo.toml index 5e79c230e52..76ad7f595a6 100755 --- a/integration-tests/public/sol-cross-contract/other-contract-sol/Cargo.toml +++ b/integration-tests/public/sol-cross-contract/other-contract-sol/Cargo.toml @@ -2,7 +2,7 @@ name = "other-contract-sol" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/sol_encoding/Cargo.toml b/integration-tests/public/sol_encoding/Cargo.toml index b07a2ce75a1..c91c5d355c3 100755 --- a/integration-tests/public/sol_encoding/Cargo.toml +++ b/integration-tests/public/sol_encoding/Cargo.toml @@ -2,7 +2,7 @@ name = "sol_encoding" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/solidity-calls-flipper/Cargo.toml b/integration-tests/public/solidity-calls-flipper/Cargo.toml index 37e26dc05e2..7fea78b96d6 100644 --- a/integration-tests/public/solidity-calls-flipper/Cargo.toml +++ b/integration-tests/public/solidity-calls-flipper/Cargo.toml @@ -2,7 +2,7 @@ name = "flipper" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-dyn-cross-contract-calls/Cargo.toml b/integration-tests/public/trait-dyn-cross-contract-calls/Cargo.toml index b33f767b503..7a8ebbbf987 100644 --- a/integration-tests/public/trait-dyn-cross-contract-calls/Cargo.toml +++ b/integration-tests/public/trait-dyn-cross-contract-calls/Cargo.toml @@ -2,7 +2,7 @@ name = "trait-incrementer-caller" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-dyn-cross-contract-calls/contracts/incrementer/Cargo.toml b/integration-tests/public/trait-dyn-cross-contract-calls/contracts/incrementer/Cargo.toml index 088a7a5fde3..f36214e4683 100644 --- a/integration-tests/public/trait-dyn-cross-contract-calls/contracts/incrementer/Cargo.toml +++ b/integration-tests/public/trait-dyn-cross-contract-calls/contracts/incrementer/Cargo.toml @@ -2,7 +2,7 @@ name = "trait-incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-dyn-cross-contract-calls/traits/Cargo.toml b/integration-tests/public/trait-dyn-cross-contract-calls/traits/Cargo.toml index 646ff3c5279..c308566f15e 100644 --- a/integration-tests/public/trait-dyn-cross-contract-calls/traits/Cargo.toml +++ b/integration-tests/public/trait-dyn-cross-contract-calls/traits/Cargo.toml @@ -2,7 +2,7 @@ name = "dyn-traits" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-erc20/Cargo.toml b/integration-tests/public/trait-erc20/Cargo.toml index 430b6d3cd71..71b72aa5e90 100644 --- a/integration-tests/public/trait-erc20/Cargo.toml +++ b/integration-tests/public/trait-erc20/Cargo.toml @@ -2,7 +2,7 @@ name = "trait_erc20" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-flipper/Cargo.toml b/integration-tests/public/trait-flipper/Cargo.toml index d22a706f77f..364597fcdf3 100644 --- a/integration-tests/public/trait-flipper/Cargo.toml +++ b/integration-tests/public/trait-flipper/Cargo.toml @@ -2,7 +2,7 @@ name = "trait_flipper" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-incrementer/Cargo.toml b/integration-tests/public/trait-incrementer/Cargo.toml index b07b76ae664..7e8edbae6c4 100644 --- a/integration-tests/public/trait-incrementer/Cargo.toml +++ b/integration-tests/public/trait-incrementer/Cargo.toml @@ -2,7 +2,7 @@ name = "trait-incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/trait-incrementer/traits/Cargo.toml b/integration-tests/public/trait-incrementer/traits/Cargo.toml index fa6ea59e4f2..d700ff454d5 100644 --- a/integration-tests/public/trait-incrementer/traits/Cargo.toml +++ b/integration-tests/public/trait-incrementer/traits/Cargo.toml @@ -2,7 +2,7 @@ name = "traits" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/delegator/Cargo.toml b/integration-tests/public/upgradeable-contracts/delegator/Cargo.toml index 18888d2185b..8d6416052ec 100644 --- a/integration-tests/public/upgradeable-contracts/delegator/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/delegator/Cargo.toml @@ -2,7 +2,7 @@ name = "delegator" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/delegator/delegatee/Cargo.toml b/integration-tests/public/upgradeable-contracts/delegator/delegatee/Cargo.toml index 034daaabdd5..7feb70ea9af 100644 --- a/integration-tests/public/upgradeable-contracts/delegator/delegatee/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/delegator/delegatee/Cargo.toml @@ -2,7 +2,7 @@ name = "delegatee" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/delegator/delegatee2/Cargo.toml b/integration-tests/public/upgradeable-contracts/delegator/delegatee2/Cargo.toml index b43a9251094..092f58e9720 100644 --- a/integration-tests/public/upgradeable-contracts/delegator/delegatee2/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/delegator/delegatee2/Cargo.toml @@ -2,7 +2,7 @@ name = "delegatee2" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/Cargo.toml b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/Cargo.toml index 7ba4f85fe5c..1ad6900c129 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/Cargo.toml @@ -2,7 +2,7 @@ name = "incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/migration/Cargo.toml b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/migration/Cargo.toml index c0c2d8f93a5..b9fbb6bd96c 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/migration/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/migration/Cargo.toml @@ -2,7 +2,7 @@ name = "migration" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/updated-incrementer/Cargo.toml b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/updated-incrementer/Cargo.toml index bee5dc255da..4b4525314ac 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/updated-incrementer/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/updated-incrementer/Cargo.toml @@ -2,7 +2,7 @@ name = "updated-incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash/Cargo.toml b/integration-tests/public/upgradeable-contracts/set-code-hash/Cargo.toml index a15225cfb04..853ec8f141e 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/set-code-hash/Cargo.toml @@ -2,7 +2,7 @@ name = "incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml b/integration-tests/public/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml index bee5dc255da..4b4525314ac 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml +++ b/integration-tests/public/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml @@ -2,7 +2,7 @@ name = "updated-incrementer" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/integration-tests/public/wildcard-selector/Cargo.toml b/integration-tests/public/wildcard-selector/Cargo.toml index fa5aabeda95..7b606eb1f83 100644 --- a/integration-tests/public/wildcard-selector/Cargo.toml +++ b/integration-tests/public/wildcard-selector/Cargo.toml @@ -2,7 +2,7 @@ name = "wildcard-selector" version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/linting/Cargo.toml b/linting/Cargo.toml index 8a6aef07d24..c80c72ecf3e 100644 --- a/linting/Cargo.toml +++ b/linting/Cargo.toml @@ -9,7 +9,7 @@ members = [ [workspace.package] version = "6.0.0-alpha" authors = ["Use Ink "] -edition = "2021" +edition = "2024" license = "Apache-2.0" repository = "https://github.com/use-ink/ink" homepage = "https://use.ink" From 0092cfe0ebaab857be0a7ab79c661480f0df38fc Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Fri, 11 Apr 2025 08:53:51 +0200 Subject: [PATCH 2/5] chore: minimal rust version env and ink crate --- crates/env/Cargo.toml | 2 +- crates/ink/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index a4844f3f3fc..546fdfbeb27 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -3,7 +3,7 @@ name = "ink_env" version.workspace = true authors = ["Use Ink "] edition.workspace = true -rust-version = "1.81" +rust-version = "1.85" license.workspace = true readme = "README.md" diff --git a/crates/ink/Cargo.toml b/crates/ink/Cargo.toml index 12f8329d957..05a3176569e 100644 --- a/crates/ink/Cargo.toml +++ b/crates/ink/Cargo.toml @@ -3,7 +3,7 @@ name = "ink" version.workspace = true authors = ["Use Ink "] edition.workspace = true -rust-version = "1.63" +rust-version = "1.85" license.workspace = true readme = "README.md" From 225c338a7aefaf3e68e626dc53cc9a513f74a750 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Fri, 11 Apr 2025 14:58:12 +0200 Subject: [PATCH 3/5] refactor: lifetime may not live long enough --- crates/env/src/engine/off_chain/test_api.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/env/src/engine/off_chain/test_api.rs b/crates/env/src/engine/off_chain/test_api.rs index d6c9f35f721..32324645fcd 100644 --- a/crates/env/src/engine/off_chain/test_api.rs +++ b/crates/env/src/engine/off_chain/test_api.rs @@ -317,6 +317,8 @@ pub fn recorded_events() -> impl Iterator { .engine .get_emitted_events() .map(|evt: ink_engine::test_api::EmittedEvent| evt.into()) + .collect::>() + .into_iter() }) } From 8e024838bcc7821b9e1291606232dcfa35bfb9a2 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Fri, 11 Apr 2025 14:59:28 +0200 Subject: [PATCH 4/5] fix: extern blocks must be safe --- crates/ink/tests/events_metadata.rs | 2 +- crates/ink/tests/return_type_metadata.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ink/tests/events_metadata.rs b/crates/ink/tests/events_metadata.rs index 82470e38c90..9e0cc5ef706 100644 --- a/crates/ink/tests/events_metadata.rs +++ b/crates/ink/tests/events_metadata.rs @@ -56,7 +56,7 @@ mod contract { #[cfg(test)] mod tests { fn generate_metadata() -> ink_metadata::InkProject { - extern "Rust" { + unsafe extern "Rust" { fn __ink_generate_metadata() -> ink_metadata::InkProject; } diff --git a/crates/ink/tests/return_type_metadata.rs b/crates/ink/tests/return_type_metadata.rs index ab0f4775ada..a83984be83d 100644 --- a/crates/ink/tests/return_type_metadata.rs +++ b/crates/ink/tests/return_type_metadata.rs @@ -52,7 +52,7 @@ mod tests { }; fn generate_metadata() -> ink_metadata::InkProject { - extern "Rust" { + unsafe extern "Rust" { fn __ink_generate_metadata() -> ink_metadata::InkProject; } From 041a473ac2ca94f341ed7a8cb89f1b5889ec49a9 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Fri, 11 Apr 2025 17:20:03 +0200 Subject: [PATCH 5/5] fix: as_option macro --- crates/ink/src/option_info.rs | 116 ++++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 35 deletions(-) diff --git a/crates/ink/src/option_info.rs b/crates/ink/src/option_info.rs index 3574118e33c..1949dd7361c 100644 --- a/crates/ink/src/option_info.rs +++ b/crates/ink/src/option_info.rs @@ -12,35 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub struct AsOption<'lt, T>(pub &'lt T); - -impl AsOption<'_, ::core::option::Option> { - #[inline] - // We need to allow for dead code at this point because - // the Rust compiler thinks this function is unused even - // though it acts as the specialized case for detection. - #[allow(dead_code)] - pub fn value(&self) -> Option<&T> { - self.0.as_ref() - } -} - -impl<'lt, T> AsOption<'lt, &'lt ::core::option::Option> { - #[inline] - pub fn value(&self) -> Option<&T> { - self.0.as_ref() - } -} - -pub trait AsOptionFallback { - fn value(&self) -> Option<&T>; -} -impl AsOptionFallback for AsOption<'_, T> { - #[inline] - fn value(&self) -> Option<&T> { - Some(self.0) - } -} /// Evaluates to `None` if the given expression is a `Option::None`. /// @@ -50,10 +21,29 @@ impl AsOptionFallback for AsOption<'_, T> { #[macro_export] #[doc(hidden)] macro_rules! as_option { - ( $e:expr $(,)? ) => {{ - #[allow(unused_imports)] - use $crate::option_info::AsOptionFallback as _; - $crate::option_info::AsOption(&$e).value() + (None $(,)?) => {{ None }}; + (&None $(,)?) => {{ None }}; + (Option::<$t:ty>::None $(,)?) => {{ + None::<&$t> + }}; + (&Option::<$t:ty>::None $(,)?) => {{ + None::<&$t> + }}; + + // Special case for Some literals + (Some($val:expr) $(,)?) => {{ + Some(&$val) + }}; + (&Some($val:expr) $(,)?) => {{ + Some(&$val) + }}; + + ( &$local:expr $(,)? ) => {{ + Some(&$local) + }}; + + ( $local:expr $(,)? ) => {{ + Some(&$local) }}; } @@ -64,14 +54,70 @@ mod tests { assert_eq!(Some(&true), as_option!(true)); assert_eq!(Some(&42), as_option!(42)); assert_eq!(Some(&"Hello, World!"), as_option!("Hello, World!")); - + assert_eq!(Some(&()), as_option!(Some(()))); assert_eq!(Some(&5), as_option!(Some(5))); assert_eq!(Some(&true), as_option!(Some(true))); assert_eq!(Some(&true), as_option!(&Some(true))); - + assert_eq!(None, as_option!(Option::::None)); assert_eq!(None, as_option!(Option::::None)); assert_eq!(None, as_option!(&Option::::None)); } + + #[test] + fn struct_fields_and_metadata_work() { + struct TestStruct { + field_1: u32, + field_2: u64, + } + + let test = TestStruct { + field_1: 1, + field_2: 2, + }; + + assert_eq!(Some(&test.field_1), as_option!(test.field_1)); + assert_eq!(Some(&test.field_1), as_option!(&test.field_1)); + assert_eq!(Some(&test.field_2), as_option!(test.field_2)); + assert_eq!(Some(&test.field_2), as_option!(&test.field_2)); + + // This simulates the event_metadata.rs case that was failing + #[derive(Debug)] + struct EventField { + value: u64, + } + + // Test with temporary struct and field access - critical for Rust 2024 + let field_ref = as_option!(EventField { value: 123 }.value); + assert_eq!(Some(&123), field_ref); + } + + #[test] + fn event_stable_field_pattern_works() { + // This test simulates the exact pattern used in the event macro + // where a field is bound to a variable and then wrapped in as_option + + struct EventStruct { + field_1: u32, + field_2: u64, + } + + let event = EventStruct { + field_1: 42, + field_2: 100, + }; + + // This is how fields are processed in the event macro: + let stable_field = event.field_1; + assert_eq!(Some(&42), as_option!(stable_field)); + + // Test with normal field access + assert_eq!(Some(&100), as_option!(event.field_2)); + + // Test with temporary values + let get_value = || 123; + let stable_field_2 = get_value(); + assert_eq!(Some(&123), as_option!(stable_field_2)); + } }