Closed
Description
I hit a false positive when contributing to rusqlite
. The code in the PR can not be written without that closure as it doesn't seem to unify for some reason. Not sure if it's a bug in the compiler or some kind of deficiency in my code (please look at that TryFrom
impl, if you think you could help). Would love to file issue against rustc, if relevant, but I don't even know what keywords to use for searching for existing issues. :(
Without the closure I got:
--> src/row.rs:382:76
|
382 | let val = conn.query_row("SELECT a FROM test", std::iter::empty(), <(u32,)>::try_from)
| ^^^^^^^^^^^^^^^^^^
| |
| expected signature of `for<'r, 's> fn(&'r row::Row<'s>) -> _`
| found signature of `fn(_) -> _`
error[E0271]: type mismatch resolving `for<'r, 's> <fn(_) -> std::result::Result<(u32,), <(u32,) as std::convert::TryFrom<_>>::Error> {<(u32,) as std::convert::TryFrom<_>>::try_from} as std::ops::FnOnce<(&'r row::Row<'s>,)>>::Output == std::result::Result<_, error::Error>`
Edit: sorry for forgetting to paste version. I don't know the version from rusqlite
CI, but same issue is present in clippy 0.0.212 (69f99e7 2019-12-14)
. I also tried to impl TryFrom
using a single lifetime - same problem.