krisprice / ipnet

IpNet, Ipv4Net, and Ipv6Net types and methods for Rust
Apache License 2.0
122 stars 26 forks source link

Build fails with nightly #21

Closed imp closed 4 years ago

imp commented 4 years ago
rustc -V
rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
error: this arithmetic operation will overflow
   --> src/ipext.rs:569:13
    |
569 |             std::usize::MAX + 1 + count as usize
    |             ^^^^^^^^^^^^^^^^^^^ attempt to add with overflow
    |
    = note: `#[deny(arithmetic_overflow)]` on by default

error: this arithmetic operation will overflow
   --> src/ipext.rs:489:21
    |
489 |                     std::usize::MAX + 2 + count as usize
    |                     ^^^^^^^^^^^^^^^^^^^ attempt to add with overflow

error: aborting due to 2 previous errors
krisprice commented 4 years ago

Removed this error in nightly 2.3.0 with #[allow(arithmetic_overflow)]. The panic behavior was intentional here to mimic Rusts own count() behavior.