-
Notifications
You must be signed in to change notification settings - Fork 2.6k
make types within generate_solution_type
macro explicit
#8447
Conversation
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) ); ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the jargon of npos_election
stuff, we have voters
and targets
, let's stick to that and rename CandidateIndex
to TargetIndex
, otherwise looks good, thanks!
Would be good to have a test to make sure
fails. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
bot merge |
Waiting for commit status. |
Checks failed; merge aborted. |
…ion-keyword-types
bot merge |
Waiting for commit status. |
Checks failed; merge aborted. |
Looking for recommendations for how to proceed with this. The polkadot companion stage fails because that PR is not mergeable. The only reason I can see that paritytech/polkadot#2707 is not mergeable is that its I can replicate the failure in that CI check only if I do not have the |
did you merge polkadot master into the companion ? |
The companion wasn't approved. |
The Way that polkadot companions are merged is that their own CI is supposed to fail, so what you are seeing is correct. For a companion, you check the build status in the substrate Once the substrate PR is merged, the bot does a |
bot merge |
Trying merge. |
* master: (84 commits) Duplicate logging to stdout (#8495) Fix sync restart (#8497) client: fix justifications migration (#8489) helper macro to create storage types on the fly (#8456) Make `BlockImport` and `Verifier` async (#8472) Get rid of `test-helpers` feature in sc-consensus-babe (#8486) Enhancement on Substrate Node Template (#8473) Add Social Network (#8065) Prepare UI tests for Rust 1.51 & new CI image (#8474) Benchmarking pallet-example (#8301) Use pathbuf for remote externalities (#8480) Bring back the on_finalize weight of staking. (#8463) Implement `fungible::*` for Balances (#8454) make types within `generate_solution_type` macro explicit (#8447) [pallet-staking] Refund unused weight for `payout_stakers` (#8458) Use `async_trait` in sc-consensus-slots (#8461) Repot frame_support::traits; introduce some new currency stuff (#8435) Fix &mut self -> &self in add_known_address (#8468) Add NetworkService::add_known_address (#8467) Fix companion check (#8464) ...
…#8447) * make types within `generate_solution_type` macro explicit Closes paritytech#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
Closes #8444.
polkadot companion: paritytech/polkadot#2707
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.
Note: while the new syntax looks like keyword arguments from a language such as Python,
unlike real keyword arguments, the order still matters. Checks in the syntax parser ensure that
the right arguments appear in the right order.
Old:
New: