Why are zero-sized clones of function items useful?

⚓ Rust    📅 2025-06-12    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 65 days ago. The information described in this article may have changed.

OP of an internals thread wrote:

I can see the value of being able to .clone() a function item and get a zero sized result, so the coercion shouldn't happen in all cases.

What is the practical use of zero-sized clones of function items in Rust? It seems that if it wasn't for such use cases, function items could automatically be coerced to function pointers by the compiler.

3 posts - 2 participants

Read full topic

🏷️ rust_feed