maybe_record_as_seed

Function maybe_record_as_seed 

Source
fn maybe_record_as_seed<'tcx>(
    tcx: TyCtxt<'tcx>,
    owner_id: OwnerId,
    worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>,
    unsolved_items: &mut Vec<LocalDefId>,
)
Expand description

Examine the given definition and record it in the worklist if it should be considered live.

We want to explicitly consider as live:

  • Item annotated with #[allow(dead_code)] This is done so that if we want to suppress warnings for a group of dead functions, we only have to annotate the “root”. For example, if both f and g are dead and f calls g, then annotating f with #[allow(dead_code)] will suppress warning for both f and g.

  • Item annotated with #[lang=“..”] Lang items are always callable from elsewhere.

For trait methods and implementations of traits, we are not certain that the definitions are live at this stage. We record them in unsolved_items for later examination.