Skip to content

build issues with rust < 1.80 #221

Closed
@keldonin

Description

@keldonin

Symptom

It seems that fix #217 created another issue, namely with rust 1.79, and possibly with earlier versions as well. Interstingly enough, 1.66 (MSRV) is not affected.

Example

$ rustup override set 1.79
info: override toolchain for '/home/eric/github/rust-cryptoki' set to '1.79-aarch64-unknown-linux-gnu' 
$ cargo b
   Compiling cryptoki-sys v0.1.8 (/home/eric/github/rust-cryptoki/cryptoki-sys)
   Compiling paste v1.0.14
   Compiling cfg-if v1.0.0
   Compiling zeroize v1.7.0
   Compiling log v0.4.20
   Compiling bitflags v1.3.2
   Compiling libloading v0.7.4
   Compiling secrecy v0.8.0
   Compiling cryptoki v0.7.0 (/home/eric/github/rust-cryptoki/cryptoki)
error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/mechanism/mod.rs:979:33
    |
979 |                 ulParameterLen: size_of::<CK_GCM_PARAMS>()
    |                                 ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
11  + use core::mem::size_of;
    |
11  + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
    --> cryptoki/src/mechanism/mod.rs:1042:25
     |
1042 |         ulParameterLen: size_of::<T>()
     |                         ^^^^^^^ not found in this scope
     |
help: consider importing one of these items
     |
11   + use core::mem::size_of;
     |
11   + use std::mem::size_of;
     |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:620:48
    |
620 |             | Attribute::WrapWithTrusted(_) => size_of::<bool>(),
    |                                                ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:623:17
    |
623 |                 size_of::<CK_UTF8CHAR>() * bytes.len()
    |                 ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:627:46
    |
627 |             Attribute::CertificateType(_) => size_of::<CK_CERTIFICATE_TYPE>(),
    |                                              ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:629:36
    |
629 |             Attribute::Class(_) => size_of::<CK_OBJECT_CLASS>(),
    |                                    ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:639:46
    |
639 |             Attribute::KeyGenMechanism(_) => size_of::<CK_MECHANISM_TYPE>(),
    |                                              ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:640:38
    |
640 |             Attribute::KeyType(_) => size_of::<CK_KEY_TYPE>(),
    |                                      ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:642:42
    |
642 |             Attribute::ModulusBits(_) => size_of::<CK_ULONG>(),
    |                                          ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:654:39
    |
654 |             Attribute::ValueLen(_) => size_of::<CK_ULONG>(),
    |                                       ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:655:64
    |
655 |             Attribute::EndDate(_) | Attribute::StartDate(_) => size_of::<CK_DATE>(),
    |                                                                ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:658:17
    |
658 |                 size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
    |                 ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> cryptoki/src/object.rs:770:24
    |
770 |     let as_array: [u8; size_of::<CK_BBOOL>()] = slice.try_into()?;
    |                        ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
5   + use core::mem::size_of;
    |
5   + use std::mem::size_of;
    |

error: unused import: `TryInto`
  --> cryptoki/src/mechanism/mod.rs:14:29
   |
14 | use std::convert::{TryFrom, TryInto};
   |                             ^^^^^^^
   |
note: the lint level is defined here
  --> cryptoki/src/lib.rs:38:8
   |
38 |        unused,
   |        ^^^^^^
   = note: `#[deny(unused_imports)]` implied by `#[deny(unused)]`

For more information about this error, try `rustc --explain E0425`.

Root cause

use std::mem::size_of expressions missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions