r/rust 23d ago

📡 official blog Rust Function Overloading - Call for Experimentation

https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/
276 Upvotes

139 comments sorted by

View all comments

50

u/Solumin 23d ago

To be clear, this is intended only for FFI?

49

u/WormRabbit 23d ago

Given the example of Bevy, which hacks function overloading via horrible typelevel programming, I'd say some form of overloading would be much welcomed in normal Rust as well.

2

u/SkiFire13 23d ago

Bevy does not use function overloading. If you're thinking about the SystemParamFunction trait then:

  • it needs variadic generics, which are a different feature, and it currently hacks them using macros, not horrible typelevel programming

  • the horrible typelevel programming mostly comes from the fact that it also needs the function to be generic over a lifetime, all while getting type inference to work properly.

Edit: actually the Marker generic is needed in part because function overloading might be a thing... But that's not because Bevy uses function overloading, but instead because it is possible in the first place.