Function hir_ty::autoderef::autoderef

source ·
pub fn autoderef(
    db: &dyn HirDatabase,
    env: Arc<TraitEnvironment>,
    ty: Canonical<Ty>,
) -> impl Iterator<Item = Ty>
Expand description

Returns types that ty transitively dereferences to. This function is only meant to be used outside hir-ty.

It is guaranteed that:

  • the yielded types don’t contain inference variables (but may contain TyKind::Error).
  • a type won’t be yielded more than once; in other words, the returned iterator will stop if it detects a cycle in the deref chain.