# Function rustc_middle::ty::print::characteristic_def_id_of_type_cached

source ·

    fn characteristic_def_id_of_type_cached<'a>(
        ty: Ty<'a>,
        visited: &mut SsoHashSet<Ty<'a>>,
    ) -> Option<DefId>

Expand description

As a heuristic, when we see an impl, if we see that the ‘self type’ is a type defined in the same module as the impl, we can omit including the path to the impl itself. This function tries to find a “characteristic `DefId`” for a type. It’s just a heuristic so it makes some questionable decisions and we may want to adjust it later.

Visited set is needed to avoid full iteration over deeply nested tuples that have no DefId.