pub fn mangle(def_id: DefId, name: &str, type_args: &[Ty]) -> StringExpand description
Mangle a function instance into a unique symbol name.
The owning def_id is folded in so that same-named items from different
modules (e.g. a private helper in each) get distinct symbols instead of
colliding into one at monomorphization; type_args further distinguish the
instances of a generic function. A non-generic function mangles to
name.<def> and a monomorphized instance to name.<def>$<args> (e.g.
identity.7$i).
The program entry point is the sole exception: lower_module names it with
the bare symbol main, which the codegen backends look up by name. It is
never passed here for a non-entry function of the same name, because every
other function carries its DefId suffix and so can never spell main.