pub fn collect_unrecorded_ids<I: Interner, DB: RustIrDatabase<I>>(
    db: &DB,
    identifiers: &IndexSet<RecordedItemId<I>>,
) -> IndexSet<RecordedItemId<I>>
Expand description

Collects the identifiers needed to resolve all the names for a given set of identifers, excluding identifiers we already have.

When recording identifiers to print, the LoggingRustIrDatabase only records identifiers the solver uses. But the solver assumes well-formedness, and thus skips over many names referenced in the definitions.

For instance, if we have:

struct S {}

trait Parent {}
trait Child where Self: Parent {}
impl Parent for S {}
impl Child for S {}

And our goal is S: Child, we will only render S, impl Child for S, and trait Child. This will not parse because the Child trait’s definition references parent. IdCollector solves this by collecting all of the directly related identifiers, allowing those to be rendered as well, ensuring name resolution is successful.