Why is closure/coroutine type that references itself forbidden?

Do you mean the closure type of

let f = |a|{}
f(&f);

would be

struct Closure< /*CK =*/ Fn, /*CS =*/ fn(Closure<Fn, fn(Closure<Fn,...,U>, U>), U >(...U);

where CS = fn(Closure<Fn, CS, U>) such that the type name is infinite.

It appears that's the case during inference at least, which -- as is probably clear from everything else I've said in this thread -- is news to me. And pre-NLL or so it didn't use to be.

These nerd-snipes can be so informative :slight_smile:.

Random thought: if you allow closures with signatures that can't be expressed with a function pointer type, you have to check more than "no captures" to see if a cast to a function pointer is sound. (Apparently that was happening to some extent.)