Better assists for type annotations needed, consider specifying the generic argument
#17202
Labels
C-feature
Category: feature request
For example: given an
iter: Iterator<Item=f64>
if i calliter.sum()
isn't it most likely that I want to sum them up tof64
? In fact I believe that is the only possible output, yet sometimes the rustc type inference engine refuses to use that (iter.sum() / x
). I kind of understand why, but maybe rust-analyzer can make smarter suggestions?We could either program in a few common patterns like the one I mentioned above (maybe ask the community?) . Or implement more complete exhaustive checking on-demand as part of assists where the rustc trait resolver/type inference engine failed. Maybe both as I imagine the former is a lot more performant.
Note: I would actually be open to doing the implementation legwork on this if its a good beginner issue to get into the rust-analyzer codebase.
The text was updated successfully, but these errors were encountered: