Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ambiguous call to
constraints.as_ref()
(#22)
If `fast-ssh` is built with an up-to-date version of `rustc`, the compiler complains about `constraints.as_ref()` being ambiguous, demanding the types involved in the `.constraints()` call be clarified with a `::<&[Constraint]>` turbofish annotation: ``` Compiling fast-ssh v0.3.1 (/build/source) error[E0283]: type annotations needed --> src/layout.rs:60:10 | 60 | .constraints(constraints.as_ref()) | ^^^^^^^^^^^ ------ type must be known at this point | | | cannot infer type of the type parameter `C` declared on the method `constraints` | = 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 | 60 | .constraints::<&T>(constraints.as_ref()) | ++++++ For more information about this error, try `rustc --explain E0283`. error: could not compile `fast-ssh` (bin "fast-ssh") due to previous error ``` Luckily, if we use `constraints.as_slice()` instead, the types involved are still apparent to the compiler, and the resulting code still remains about as readable as before.
- Loading branch information