Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better assists for type annotations needed, consider specifying the generic argument #17202

Open
IndianBoy42 opened this issue May 8, 2024 · 0 comments
Labels
C-feature Category: feature request

Comments

@IndianBoy42
Copy link

For example: given an iter: Iterator<Item=f64> if i call iter.sum() isn't it most likely that I want to sum them up to f64? 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.

@IndianBoy42 IndianBoy42 added the C-feature Category: feature request label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature request
Projects
None yet
Development

No branches or pull requests

1 participant