orf/gping

Unable to compile due to type inference issue on rustc 1.74.0 or higher

jwbowen opened this issue · 1 comments

I'm unable to compile the current trunk due to the following error if using beta (1.74.0-beta.4 (489647f98 2023-10-21)) or nightly (1.75.0-nightly (4b85902b4 2023-11-04)) Rust.

With both, I get the following error:

error[E0283]: type annotations needed
   --> gping/src/main.rs:486:26
    |
486 |                         .constraints(
    |                          ^^^^^^^^^^^ cannot infer type of the type parameter `C` declared on the method `constraints`
...
491 |                                 .as_ref(),
    |                                  ------ type must be known at this point
    |
    = note: multiple `impl`s satisfying `Vec<Constraint>: AsRef<_>` found in the `alloc` crate:
            - impl<T, A> AsRef<Vec<T, A>> for Vec<T, A>
              where A: Allocator;
            - impl<T, A> AsRef<[T]> for Vec<T, A>
              where A: Allocator;
help: consider specifying the generic argument
    |
486 |                         .constraints::<&T>(
    |                                     ++++++

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

It still compiles fine with stable (1.73.0 (cc66ad468 2023-10-03))

orf commented

Thanks for this! It's been fixed by @aragonnetje6 (🙏!)