In most cases it is handled in the same way as closures.
For more information about how rustc works, see the rustc dev guide.