-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
The following example
// [dependencies]
// crypto-bigint = "0.7.0-rc.17"
use crypto_bigint::{ConcatMixed, U1024, U1536, U2048, U3072, U4096, Uint};
pub struct KeyGenerator<const LIMBS: usize, const LIMBS_HALF: usize, const LIMBS_TIMES_TWO: usize>
{}
impl<const LIMBS: usize, const LIMBS_HALF: usize, const LIMBS_TIMES_TWO: usize>
KeyGenerator<LIMBS, LIMBS_HALF, LIMBS_TIMES_TWO>
where
// LIMBS_HALF * LIMBS_HALF = LIMBS
Uint<LIMBS_HALF>: ConcatMixed<Uint<LIMBS_HALF>, MixedOutput = Uint<LIMBS>>,
// LIMBS * LIMBS = LIMBS_TIMES_TWO
Uint<LIMBS>: ConcatMixed<Uint<LIMBS>, MixedOutput = Uint<LIMBS_TIMES_TWO>>,
{
pub fn new() -> Self {
Self {}
}
}
fn main() {
let key_generator_2k = KeyGenerator::<_, { U1024::LIMBS }, _>::new();
let key_generator_3k = KeyGenerator::<_, { U1536::LIMBS }, _>::new();
let key_generator_4k = KeyGenerator::<_, { U2048::LIMBS }, _>::new();
// TODO: Following line fails
// let key_generator_6k = KeyGenerator::<_, { U3072::LIMBS }, _>::new();
let key_generator_8k = KeyGenerator::<_, { U4096::LIMBS }, _>::new();
}results in the following error if the key_generator_6k line is uncommented:
error[E0599]: the function or associated item `new` exists for struct `KeyGenerator<_, 48, _>`, but its trait bounds were not satisfied
--> src/main.rs:533:68
|
513 | pub struct KeyGenerator<const LIMBS: usize, const LIMBS_HALF: usize, const LIMBS_TIMES_TWO: usize>
| -------------------------------------------------------------------------------------------------- function or associated item `new` not found for this struct
...
533 | let key_generator_6k = KeyGenerator::<_, { U3072::LIMBS }, _>::new();
| ^^^ function or associated item cannot be called on `KeyGenerator<_, 48, _>` due to unsatisfied trait bounds
|
::: /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-bigint-0.7.0-rc.17/src/uint.rs:88:1
|
88 | pub struct Uint<const LIMBS: usize> {
| ----------------------------------- doesn't satisfy `<Uint<96> as ConcatMixed>::MixedOutput = Uint<_>` or `Uint<96>: ConcatMixed`
|
note: trait bound `Uint<96>: ConcatMixed` was not satisfied
--> src/main.rs:522:18
|
517 | KeyGenerator<LIMBS, LIMBS_HALF, LIMBS_TIMES_TWO>
| ------------------------------------------------
...
522 | Uint<LIMBS>: ConcatMixed<Uint<LIMBS>, MixedOutput = Uint<LIMBS_TIMES_TWO>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | unsatisfied trait bound introduced here
| unsatisfied trait bound introduced here
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `new`, perhaps you need to implement it:
candidate #1: `Monty`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `rust-tests` (bin "rust-tests" test) due to 1 previous error
which blocks us from using certain sizes (even with extra-sizes feature) in our code.
Metadata
Metadata
Assignees
Labels
No labels