Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Migrate Bounded Types to Const Generics #9865

Closed
wants to merge 4 commits into from

Conversation

shawntabrizi
Copy link
Member

I believe const generics were not stable when we first introduced bounded types.

Now that they are, we should use them instead of Get<u32> which may allow a runtime developer to shoot themselves in the foot by NOT providing a constant value.

This should not be a breaking change other than syntax.

@shawntabrizi
Copy link
Member Author

shawntabrizi commented Sep 25, 2021

Seems like we cannot complete this PR yet:

error: generic parameters may not be used in const operations
   --> frame/balances/src/lib.rs:529:45
    |
529 |         WeakBoundedVec<BalanceLock<T::Balance>, { T::MAX_LOCKS }>,
    |                                                   ^^^^^^^^^^^^ cannot perform const operation using `T`
    |
    = note: type parameters may not be used in const expressions

Need this feature to stabilize.

rust-lang/rust#60551 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant