Why can’t Rust infer the resulting type of Iterator::sum?
The way sum is defined, the return value is open-ended; more than one type can implement the trait Sum<i32>. Here’s an example where different types for a are used, both of which compile: #[derive(Clone, Copy)] struct Summer { s: isize, } impl Summer { fn pow(&self, p: isize) { println!(“pow({})”, p); } } impl std::iter::Sum<i32> … Read more