parallaxsecond / rust-cryptoki

Rust wrapper for the PKCS #11 API, Cryptoki
https://docs.rs/cryptoki/
Apache License 2.0
75 stars 61 forks source link

project won't compile under Rust 1.80 - CI broken #216

Closed keldonin closed 2 months ago

keldonin commented 2 months ago

Description

The current CI is currently rejecting all PRs, as it seems it is using rust v1.80. Under this version, the process fails with the following errors:

  ./ci.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PKCS11_SOFTHSM2_MODULE: /usr/lib/softhsm/libsofthsm2.so
    SOFTHSM2_CONF: /tmp/softhsm2.conf
    Updating crates.io index
 Downloading crates ...
  Downloaded bitflags v1.3.2
  Downloaded zeroize v1.7.0
  Downloaded secrecy v0.8.0
  Downloaded cfg-if v1.0.0
  Downloaded paste v1.0.14
  Downloaded log v0.4.20
  Downloaded libloading v0.7.4
   Compiling cfg-if v1.0.0
   Compiling cryptoki-sys v0.1.8 (/home/runner/work/rust-cryptoki/rust-cryptoki/cryptoki-sys)
   Compiling paste v1.0.14
   Compiling zeroize v1.7.0
   Compiling libloading v0.7.4
   Compiling secrecy v0.8.0
   Compiling log v0.4.20
   Compiling bitflags v1.3.2
   Compiling cryptoki v0.7.0 (/home/runner/work/rust-cryptoki/rust-cryptoki/cryptoki)
error: unnecessary qualification
   --> cryptoki/src/mechanism/mod.rs:979:33
    |
979 |                 ulParameterLen: std::mem::size_of::<CK_GCM_PARAMS>()
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> cryptoki/src/lib.rs:51:8
    |
51  |        unused_qualifications,
    |        ^^^^^^^^^^^^^^^^^^^^^
help: remove the unnecessary path segments
    |
979 -                 ulParameterLen: std::mem::size_of::<CK_GCM_PARAMS>()
979 +                 ulParameterLen: size_of::<CK_GCM_PARAMS>()
    |

error: unnecessary qualification
    --> cryptoki/src/mechanism/mod.rs:1042:25
     |
1042 |         ulParameterLen: std::mem::size_of::<T>()
     |                         ^^^^^^^^^^^^^^^^^^^^^^
     |
help: remove the unnecessary path segments
     |
1042 -         ulParameterLen: std::mem::size_of::<T>()
1042 +         ulParameterLen: size_of::<T>()
     |

error: unnecessary qualification
   --> cryptoki/src/object.rs:620:48
    |
620 |             | Attribute::WrapWithTrusted(_) => std::mem::size_of::<bool>(),
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
639 -             Attribute::KeyGenMechanism(_) => std::mem::size_of::<CK_MECHANISM_TYPE>(),
639 +             Attribute::KeyGenMechanism(_) => size_of::<CK_MECHANISM_TYPE>(),
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:640:38
    |
640 |             Attribute::KeyType(_) => std::mem::size_of::<CK_KEY_TYPE>(),
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
640 -             Attribute::KeyType(_) => std::mem::size_of::<CK_KEY_TYPE>(),
640 +             Attribute::KeyType(_) => size_of::<CK_KEY_TYPE>(),
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:642:42
    |
642 |             Attribute::ModulusBits(_) => std::mem::size_of::<CK_ULONG>(),
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
642 -             Attribute::ModulusBits(_) => std::mem::size_of::<CK_ULONG>(),
642 +             Attribute::ModulusBits(_) => size_of::<CK_ULONG>(),
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:654:39
    |
654 |             Attribute::ValueLen(_) => std::mem::size_of::<CK_ULONG>(),
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
654 -             Attribute::ValueLen(_) => std::mem::size_of::<CK_ULONG>(),
654 +             Attribute::ValueLen(_) => size_of::<CK_ULONG>(),
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:655:64
    |
655 |             Attribute::EndDate(_) | Attribute::StartDate(_) => std::mem::size_of::<CK_DATE>(),
    |                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
655 -             Attribute::EndDate(_) | Attribute::StartDate(_) => std::mem::size_of::<CK_DATE>(),
655 +             Attribute::EndDate(_) | Attribute::StartDate(_) => size_of::<CK_DATE>(),
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:658:17
    |
658 |                 std::mem::size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
658 -                 std::mem::size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
658 +                 size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
    |

error: unnecessary qualification
   --> cryptoki/src/object.rs:770:24
    |
770 |     let as_array: [u8; std::mem::size_of::<CK_BBOOL>()] = slice.try_into()?;
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
770 -     let as_array: [u8; std::mem::size_of::<CK_BBOOL>()] = slice.try_into()?;
770 +     let as_array: [u8; size_of::<CK_BBOOL>()] = slice.try_into()?;
    |

error: could not compile `cryptoki` (lib) due to 13 previous errors

Impact

The CI integrated to github does not work anymore. No PR can be merged.

Workaround

Adjust the toolchain to override rust version. 1.79 worked fine for me.

keldonin commented 2 months ago

Issue solved.