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