fastly/Viceroy

Undeclared dependence on newer Rust features

Opened this issue · 0 comments

v0.12.2 relies on #is_non_or from Rust 1.82.0 and #is_bits stabilization from Rust 1.83.0 (if I'm not mistaken from looking at changelogs).

I previously had Rust 1.78.0 on my machine and attempting to install resulted in:

error[E0599]: no method named `is_none_or` found for enum `std::option::Option` in the current scope
  --> /home/geemus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/viceroy-lib-0.12.2/src/acl.rs:61:24
   |
61 |                 if acc.is_none_or(|prev_match: &Entry| mask >= prev_match.prefix.mask) {
   |                        ^^^^^^^^^^
   |
help: there is a method `is_none` with a similar name, but with different arguments
  --> /tmp/rust-20240518-13478-4dthw7/rustc-1.78.0-src/library/core/src/option.rs:651:5

error[E0658]: use of unstable library feature 'ip_bits'
  --> /home/geemus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/viceroy-lib-0.12.2/src/acl.rs:92:32
   |
92 |                     IpAddr::V4(Ipv4Addr::from_bits(v4.to_bits() & bit_mask)),
   |                                ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #113744 <https://github.com/rust-lang/rust/issues/113744> for more information

error[E0658]: use of unstable library feature 'ip_bits'
  --> /home/geemus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/viceroy-lib-0.12.2/src/acl.rs:92:55
   |
92 |                     IpAddr::V4(Ipv4Addr::from_bits(v4.to_bits() & bit_mask)),
   |                                                       ^^^^^^^
   |
   = note: see issue #113744 <https://github.com/rust-lang/rust/issues/113744> for more information

error[E0658]: use of unstable library feature 'ip_bits'
   --> /home/geemus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/viceroy-lib-0.12.2/src/acl.rs:100:32
    |
100 |                     IpAddr::V6(Ipv6Addr::from_bits(v6.to_bits() & bit_mask)),
    |                                ^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #113744 <https://github.com/rust-lang/rust/issues/113744> for more information

error[E0658]: use of unstable library feature 'ip_bits'
   --> /home/geemus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/viceroy-lib-0.12.2/src/acl.rs:100:55
    |
100 |                     IpAddr::V6(Ipv6Addr::from_bits(v6.to_bits() & bit_mask)),
    |                                                       ^^^^^^^
    |
    = note: see issue #113744 <https://github.com/rust-lang/rust/issues/113744> for more information

We also have github actions that use viceroy which were failing with the is_non_or problem. It attempts to pull the latest viceroy, but is relying on whatever version of rust is available, which will be 1.83.0 it looks like from github-actions/runner-images, but isn't there yet. We will probably also fix this to lock the viceroy version so it advances when we tell it to, rather than always tracking latest.

Updating to Rust 1.83.0 fixed both kinds of issues, which was easy enough on my machine, but is more complicated in github actions.

Anyway, I wanted to call this out as it would be nice if the cargo manifest explicitly specified the minimum expected Rust version (or else the code was more backwards compatible).