I tried this code:
#![feature(associated_type_bounds)]
struct S;
fn fn1<I: IntoIterator<Item: AsRef<S>>>(_iter: I) -> Result<(), ()> {
Ok(())
}
async fn fn2(s: &str) -> Result<(), ()> {
let s = s.parse().map_err(|_| ())?; // <- Spurious type deduced
fn1(std::iter::once(s)).map_err(|e| ())?;
Ok(())
}
I expected to see this happen:
error[E0282]: type annotations needed, because type of s cannot be determined.
Instead, this happened:
error[E0277]: the trait bound '(): std::str::FromStr' is not satisfied
As if s is assigned type ()
I tried this code:
I expected to see this happen:
error[E0282]: type annotations needed, because type ofscannot be determined.Instead, this happened:
error[E0277]: the trait bound '(): std::str::FromStr' is not satisfiedAs if
sis assigned type()