Forbid coercing unsafe functions to closures

Closes #9582