Why does this code not compile?
fn returns_closure() -> dyn Fn(i32) -> i32 { |x| x + 1 }
The returned fn pointer and value need to be represented by another trait.
fn
Closures are types and can be returned only if the concrete trait is implemented.
Closures are represented by traits, so they cannot be a return type. Rust book reference
Closures are types, so they cannot be returned directly from a function.