External Publication
Visit Post

Pre-RFC: Function parameter defaults

Rust Internals [Unofficial] February 25, 2026
Source

What I was thinking of was patterns like axum and bevy use to accept functions of various arities in higher-order methods. (e.g. routing::get for axum).

Adding a default to a parameter of a function that's passed to such a higher-order function w/o specifying type params would break compilation due to those type params no longer having one unambiguous substitution at that callsite.

I can post a concrete example later.

Discussion in the ATmosphere

Loading comments...