1

i want to add pallet-contract in my project , it show me error when run this command : cargo check Error :

     error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:190:4
      |
  190 |             let Ok(end) = args.end.base10_parse::<u32>() else { return invalid_param(args.end.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:189:4
      |
  189 |             let Ok(start) = args.start.base10_parse::<u32>() else { return invalid_param(args.start.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:188:4
      |
  188 |             let Ok(args) = syn::parse::<RangeArgs>(args) else { return invalid_param(typ.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:186:4
      |
  186 |             let Some(segment) = tpath.path.segments.last() else { return invalid_param(typ.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:185:4
      |
  185 |             let Type::Path(tpath) = typ else { return invalid_param(typ.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:178:4
      |
  178 |             let Some(name_char) = name.chars().next() else { return invalid_param_name() };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:164:4
      |
  164 |             let Pat::Ident(ident) = &*arg.pat else { return invalid_param(arg.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:163:4
      |
  163 |             let FnArg::Typed(arg) = arg else { return invalid_param(arg.span()) };
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:215:6
      |
  215 | /                     let Some(origin) = expr_call.args.first().cloned() else {
  216 | |                         return Some(Err(Error::new(expr_call.span(), "Single-item extrinsic calls must specify their origin as th...
  217 | |                     };
      | |______________________^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:293:3
      |
  293 |         let Item::Fn(func) = stmt else { return None };
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:681:6
      |
  681 |                     let Some(segment) = expr_path.path.segments.last() else { return call_err(); };
      |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  error[E0658]: `let...else` statements are unstable
     --> /home/kianoush/.cargo/git/checkouts/substrate-7e08433d4c370a21/52d72b3/frame/support/procedural/src/benchmark.rs:687:6
      |
  687 |                     let Ok(_) = syn::parse::<Token![_]>(tokens.to_token_stream().into()) else { return call_err(); };
      |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      = help: add `#![feature(let_else)]` to the crate attributes to enable

  For more information about this error, try `rustc --explain E0658`.
  error: could not compile `frame-support-procedural` due to 12 previous errors
warning: build failed, waiting for other jobs to finish...

i did these steps :

Repository

Step One : Add Depency Pallets

    pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git",  " branch" = "polkadot-v0.9.35" }
pallet-contracts-primitives = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git",  " branch" = "polkadot-v0.9.35" }

Step Two : Add Pallets Config

    parameter_types! {
    pub TombstoneDeposit: Balance = deposit(
        1,
        <pallet_contracts::Pallet<Runtime>>::contract_info_size()
    );
    pub DepositPerContract: Balance = TombstoneDeposit::get();
    pub const DepositPerStorageByte: Balance = deposit(0, 1);
    pub const DepositPerStorageItem: Balance = deposit(1, 0);
    pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);
    pub const SurchargeReward: Balance = 150 * MILLICENTS;
    pub const SignedClaimHandicap: u32 = 2;
    pub const MaxValueSize: u32 = 16 * 1024;
    // The lazy deletion runs inside on_initialize.
    pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
     BlockWeights::get().max_block;
    // The weight needed for decoding the queue should be less or equal than a fifth
    // of the overall weight dedicated to the lazy deletion.
    pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (
        <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -
        <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)
     )) / 5) as u32;

    pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
}

impl pallet_contracts::Config for Runtime {
    type Time = Timestamp;
    type Randomness = RandomnessCollectiveFlip;
    type Currency = Balances;
    type Event = Event;
    type RentPayment = ();
    type SignedClaimHandicap = SignedClaimHandicap;
    type TombstoneDeposit = TombstoneDeposit;
    type DepositPerContract = DepositPerContract;
    type DepositPerStorageByte = DepositPerStorageByte;
    type DepositPerStorageItem = DepositPerStorageItem;
    type RentFraction = RentFraction;
    type SurchargeReward = SurchargeReward;
    type WeightPrice = pallet_transaction_payment::Module<Self>;
    type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
    type ChainExtension = ();
    type DeletionQueueDepth = DeletionQueueDepth;
    type DeletionWeightLimit = DeletionWeightLimit;
    type Call = Call;
    /// The safest default is to allow no calls at all.
    ///
    /// Runtimes should whitelist dispatchables that are allowed to be called from contracts
    /// and make sure they are stable. Dispatchables exposed to contracts are not allowed to
    /// change because that would break already deployed contracts. The `Call` structure itself
    /// is not allowed to change the indices of existing pallets, too.
    type CallFilter = Nothing;
    type Schedule = Schedule;
    type CallStack = [pallet_contracts::Frame<Self>; 31];
}

whats the problem ? how can i solve this problem ?

1 Answer 1

1

You need to update your rustc to at least 1.65. With 1.65 this syntax was stabilized.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.