Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clippy annotations in extern "Rust" blocks #1061

Closed
daira opened this issue Jul 4, 2022 · 1 comment · Fixed by #1062
Closed

Allow clippy annotations in extern "Rust" blocks #1061

daira opened this issue Jul 4, 2022 · 1 comment · Fixed by #1062

Comments

@daira
Copy link

daira commented Jul 4, 2022

The code generated for a function in an extern "Rust" block strips any annotations, including clippy annotations. So for example,

#[cxx::bridge(namespace = "sapling")]
mod ffi {
    extern "Rust" {
        #![allow(clippy::too_many_arguments)]
        fn check_spend(
            &mut self,
            cv: &[u8; 32],
            anchor: &[u8; 32],
            nullifier: &[u8; 32],
            rk: &[u8; 32],
            zkproof: &[u8; 192],
            spend_auth_sig: &[u8; 64],
            sighash_value: &[u8; 32],
        ) -> bool;
    }
}

will still produce a too_many_arguments lint.

Workaround: put the clippy annotation on the whole module:

// This is added because `check_spend` takes several arguments over FFI. This
// annotation gets removed by the cxx procedural macro so it needs to be enabled
// on the entire module.
#![allow(clippy::too_many_arguments)]
@dtolnay
Copy link
Owner

dtolnay commented Jul 4, 2022

Fixed in 1.0.70.

daira added a commit to daira/zcash that referenced this issue Jul 25, 2022
…/src/sapling.rs.

This depends on the fix for dtolnay/cxx#1061 in cxx 1.0.70.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants