Is automatic insertion of type inference placeholders possible? #43942
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Would it be possible to automatically insert
_
type inference placeholders where none (or not enough) type placeholders are provided, or does this conflict with any other tokens the parser has to deal with?i.e. can
["foo", "bar"].iter().collect::Vec::()
be turned into["foo", "bar"].iter().collect::Vec<_>::()
automatically?and given a
Struct<X,Y>
, canStruct<Foo>
automatically be understood asStruct<Foo, _>
?These would both simplify boilerplate considerably, and the latter could obviate the need to revisit old code when a type is expanded with an additional generic type parameter that can be inferred from its usage.
The text was updated successfully, but these errors were encountered: