autoderef

Function autoderef 

Source
pub fn autoderef<'db>(
    db: &'db dyn HirDatabase,
    env: ParamEnvAndCrate<'db>,
    ty: Canonical<'db, Ty<'db>>,
) -> impl Iterator<Item = Ty<'db>> + use<'db>
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.