Fix type visitor glue for unboxed closures

This is a quick fix that prevents an ICE by mimicing the visitor
glue for boxed closures and bare functions.  Ideally, the `TyVisitor`
interface will be improved in the future to allow representing
more information about unboxed closures such as Fn/FnMut/FnOnce
status, capture mode, and captured free variable types and offsets.

Closes issue #17737
Add regression test for issue #17737
auto merge of #17760 : bkoropoff/rust/issue-17737, r=eddyb

This is a quick fix.  In the long term, the `TyVisitor` interface should be expanded to better represent closure types.

Closes issue #17737