conradludgate / rustyguard

WireGuard(R) impl in pure rust
71 stars 2 forks source link

build failed #4

Closed logeable closed 2 months ago

logeable commented 2 months ago

output of build

rustyguard/rustyguard-utils on  main is 📦 v0.1.0 via 🦀 v1.80.1
❯ cargo build
   Compiling rustyguard-utils v0.1.0 (/Users/logeable/workstation/repos/rustyguard/rustyguard-utils)
error[E0599]: no method named `ceil` found for type `f64` in the current scope
  --> rustyguard-utils/src/rate_limiter.rs:54:46
   |
54 |             (core::f64::consts::E / epsilon).ceil() as usize,
   |                                              ^^^^ method not found in `f64`

error[E0599]: no method named `ln` found for type `f64` in the current scope
    --> rustyguard-utils/src/rate_limiter.rs:55:31
     |
55   |             (1.0_f64 / delta).ln().ceil() as usize,
     |                               ^^
     |
help: there is a method `le` with a similar name, but with different arguments
    --> /Users/logeable/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:1198:5
     |
1198 |     fn le(&self, other: &Rhs) -> bool {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rustyguard-utils` (lib) due to 2 previous errors

The f64.ceil and f64.ln functions are belong to std,but this crate is declared as no_std in lib.rs:

#![no_std]

pub mod anti_replay;
pub mod rate_limiter;
conradludgate commented 2 months ago

Huh, interesting. I suspect we should be able to import libm instead.