Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
Adds UI test for error when _ is used without dev_mode
  • Loading branch information
codekitz committed Apr 4, 2023
commit 0dfd671fb12b15e233f3a5412dd1922f23d59b8a
2 changes: 1 addition & 1 deletion frame/support/procedural/src/pallet/expand/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
},
};
use quote::ToTokens;
use std::{collections::HashMap, ops::{IndexMut, Index}};
use std::{collections::HashMap, ops::{IndexMut}};
use syn::spanned::Spanned;

/// Generate the prefix_ident related to the storage.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#![cfg_attr(not(feature = "std"), no_std)]

pub use pallet::*;

#[frame_support::pallet]
pub mod pallet {
use frame_support::pallet_prelude::*;

// The struct on which we build all of our Pallet logic.
#[pallet::pallet]
pub struct Pallet<T>(_);

// Your Pallet's configuration trait, representing custom external types and interfaces.
#[pallet::config]
pub trait Config: frame_system::Config {}

#[pallet::storage]
type MyStorage<T: Config> = StorageValue<_, Vec<u8>>;

#[pallet::storage]
type MyStorageMap<T: Config> = StorageMap<_, _, u32, u64>;

#[pallet::storage]
type MyStorageDoubleMap<T: Config> = StorageDoubleMap<_, _, u32, _, u64, u64>;

#[pallet::storage]
type MyCountedStorageMap<T: Config> = CountedStorageMap<_, _, u32, u64>;

// Your Pallet's internal functions.
impl<T: Config> Pallet<T> {}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
--> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:21:47
|
21 | type MyStorageMap<T: Config> = StorageMap<_, _, u32, u64>;
| ^ not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
--> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:24:59
|
24 | type MyStorageDoubleMap<T: Config> = StorageDoubleMap<_, _, u32, _, u64, u64>;
| ^ ^ not allowed in type signatures
| |
| not allowed in type signatures

error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
--> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:27:61
|
27 | type MyCountedStorageMap<T: Config> = CountedStorageMap<_, _, u32, u64>;
| ^ not allowed in type signatures
4 changes: 2 additions & 2 deletions frame/support/test/tests/pallet_ui/pass/dev_mode_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ pub mod pallet {
type MyStorageMap<T: Config> = StorageMap<_, _, u32, u64>;

#[pallet::storage]
type MyStorageDoubleMap<T: Config> = StorageDoubleMap<_, _, u32, _, u64>;
type MyStorageDoubleMap<T: Config> = StorageDoubleMap<_, _, u32, _, u64, u64>;

#[pallet::storage]
type MyCountedStorageMap<T: Config> = CountedStorageMap<_, _, u32, _, u64>;
type MyCountedStorageMap<T: Config> = CountedStorageMap<_, _, u32, u64>;

// Your Pallet's callable functions.
#[pallet::call]
Expand Down