Rust Closure: fn to Fn*


I do not know what I’m reporting is a bug , issue or what ever. I need your help to figure out.

First question: I want to understand why a function defined by fn key is considered as all Fn*?

This is proved by coding, see my code in

Second question:

I defined, generically, 3 kind of call-execution methods, one using only Fn closure ( having the marker Fn ), second using FnMut closure and the third using only FnOnce closure. I used the same name in the tree call-execution methods, “execution”. The current Rust compiler passed all of them without a single warning sign.

So which one the current Rust compiler will infer from these 3 calls at run time?
When my code has all the closures, Fn*, and when “execute” used a self-defined function as argument, Rust system at run time used:

-) The execution function defined by FnOnce, ( I expected actually the one defined by Fn.)

I kept only Fn and FnMut in the code ( I removed any thing related to FnOnce ) , when “execute” used a self-defined function as argument, Rust system at run time used in this case:

-) The execution function defined by Fn.

Any interpretation of this behaviour?

More details about my questions are in


You can think of the Fn types as a hierarchy: FnOnce is the most restrictive, then FnMut, then Fn. So all Fns are FnMut and FnOnce, and all FnMuts are also FnOnce.

Given that a fn is like a Fn with an empty environment, all fns are Fns, and hence FnMut and FnOnce as well.


Could you share the actual code here? We don’t have overloading, so you shouldn’t have been able to define all three of these without changing the names as well.


The code is in

and more details are in


Thanks for your help!