Mismatched types error

impl<'c, 'm> Decrypt<DecryptionKey, &'c RawCiphertext<'c>, RawPlaintext<'m>> for JoyeLibert {
    fn decrypt(dk: &DecryptionKey, c: &'c RawCiphertext<'c>) -> RawPlaintext<'m> {
        let mut m = BigInt::zero();
        let n = dk.k;
        let r = dk.k % n;
        
        // Step 1: Precompute table TB (y^p^{-1} 2^s mod p)
        let g = BigInt::mod_pow(&dk.y, &BigInt::from(2_u32).pow(n as u32), &dk.p); // g = y^p^{-1} 2^s mod p
        let mut tb = vec![];
        for i in 0..(1 << n) {
            let entry = BigInt::mod_pow(&g, &BigInt::from(i), &dk.p);
            tb.push((entry.clone(), i)); 
        }
        tb.sort_by(|a, b| a.0.cmp(&b.0));

        // Step 2: Initial C mod p computation
        let exp_n = BigInt::from(2_u32).pow(n as u32);  // 2^n
        let mut c_mod_p = BigInt::mod_pow(&c.0, &(dk.p - 1) / &exp_n, &dk.p);  // Compute (dk.p - 1) / 2^n
        
        // Step 3: Fast decryption using the precomputed table
        for i in (0..dk.k).step_by(n) {
            let exp_segment = BigInt::from(2_u32).pow((n - i) as u32);
            let z = BigInt::mod_pow(&c_mod_p, &exp_segment, &dk.p);

            // Step 4: Update m and c_mod_p using table TB
            if let Some(&(ref value, index)) = tb.iter().find(|&&(ref value, _)| *value == z) {
                m += BigInt::from(index) << i;
                c_mod_p = (c_mod_p * value) % &dk.p;
            }
        }

        // Step 5: Handle remaining bits if needed (final alignment)
        if r > 0 {
            let exp_r = BigInt::from(2_u32).pow(r as u32);
            let final_z = BigInt::mod_pow(&c_mod_p, &exp_r, &dk.p);
            if let Some(&(ref value, index)) = tb.iter().find(|&&(ref value, _)| *value == final_z) {
                m += BigInt::from(index);
            }
        }

        // Step 6: Return the final decrypted message
        RawPlaintext(Cow::Owned(m)) // decrypted m
    }
}

I'm currently writing an edit list in code, but I keep getting errors like the ones below. If I modify it with &BigInt, it says to use BigInt. How do I solve this?

you didn't say which crate BigInt is from, but I guess it's the divide operator / that is producing a BigInt by value. try this to see if it compiles:

BigInt::mod_pow(&c.0, &((dk.p - 1) / exp_n), &dk.p);