Why are zero-sized clones of function items useful?

⚓ rust    📅 2025-06-12    👤 surdeus    👁️ 1      

surdeus

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