External Publication
Visit Post

[Pre-pre-RFC] "splatting" for named arguments and function overloading

Rust Internals [Unofficial] February 26, 2026
Source

If all "overload" implementations must have "same argument name = > same type or same bounds", how would that make type inference any more difficult?

My OP proposal does not include that, nor do I know how we'd impose that in the trait system. I do see that others have proposed it but idk how that would work.

But as far as I can tell many don't want that (except perhaps for FFI compatibility).

C++ FFI is my main motivation for having any kind of overloading. I don't particularly want overloading in the language outside of that, it just so happened that there was a tiny-looking syntactic feature that would give it "for free".

If the splatted trait is not sealed, can any crate add new "overloads" to the function?

You can only splat a generic that implements Tuple, which is only implemented for built-in tuples, so only the crate that defines the trait can define impls for it, unless I'm forgetting some piece of orphan rules magic.

Discussion in the ATmosphere

Loading comments...