Nadrieril / dhall-rust

Maintainable configuration files, for Rust users
Other
306 stars 27 forks source link

can't build serde_dhall as dep of my project #210

Closed Miezhiko closed 3 years ago

Miezhiko commented 3 years ago
   Compiling serde_dhall v0.9.0 (https://github.com/Nadrieril/dhall-rust.git?branch=master#1397a53d)
error[E0283]: type annotations needed
   --> .cargo/git/checkouts/dhall-rust-d64922cbec5ad46e/1397a53/serde_dhall/src/deserialize.rs:141:42
    |
141 |                 m.iter().map(|(k, v)| (k.as_ref(), val(v))),
    |                                        --^^^^^^--
    |                                        | |
    |                                        | cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                                        this method call resolves to `&T`
    |
    = note: cannot satisfy `std::string::String: AsRef<_>

Sometimes just having extra traits in existence can break type inference. I think that here another crate is implementing AsRef<{some other type}> for String and so Rust can no longer infer that all .as_ref()s on a string will use the AsRef<str> implementation.

talios commented 3 years ago

Has a release been made with this included at all?

Nadrieril commented 3 years ago

Oops, thanks for reminding me. v0.10.0 has it.

talios commented 3 years ago

Cheers!