mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
make types within generate_solution_type macro explicit (#8447)
* make types within `generate_solution_type` macro explicit Closes #8444. Just changes the parsing logic for that macro; does not change any emitted code. The associated types associated with the macro now require explicit, keyword-style declaration. **Old**: ```rust sp_npos_elections::generate_solution_type!( #[compact] pub struct TestCompact::<VoterIndex, TargetIndex, PerU16>(16) ); ``` **New**: ```rust sp_npos_elections::generate_solution_type!( #[compact] pub struct TestCompact::<VoterIndex = VoterIndex, CandidateIndex = TargetIndex, Accuracy = PerU16>(16) ); ``` * un-ignore doc-tests * use new form in bin/node/runtime/ * rename CandidateIndex -> TargetIndex * add tests demonstrating some potential compile failures
This commit is contained in:
committed by
GitHub
parent
2af0de50c9
commit
c2dd5e21a4
@@ -4,7 +4,11 @@ use sp_npos_elections::sp_arithmetic::Percent;
|
||||
use sp_runtime::codec::{Encode, Error};
|
||||
|
||||
fn main() {
|
||||
generate_solution_type!(#[compact] pub struct InnerTestSolutionCompact::<u32, u32, Percent>(16));
|
||||
generate_solution_type!(#[compact] pub struct InnerTestSolutionCompact::<
|
||||
VoterIndex = u32,
|
||||
TargetIndex = u32,
|
||||
Accuracy = Percent,
|
||||
>(16));
|
||||
loop {
|
||||
fuzz!(|fuzzer_data: &[u8]| {
|
||||
let result_decoded: Result<InnerTestSolutionCompact, Error> =
|
||||
|
||||
Reference in New Issue
Block a user