compute_definition_site_hidden_types

Function compute_definition_site_hidden_types 

Source
pub(crate) fn compute_definition_site_hidden_types<'tcx>(
    infcx: &BorrowckInferCtxt<'tcx>,
    universal_region_relations: &Frozen<UniversalRegionRelations<'tcx>>,
    constraints: &MirTypeckRegionConstraints<'tcx>,
    location_map: Rc<DenseLocationMap>,
    hidden_types: &mut FxIndexMap<LocalDefId, DefinitionSiteHiddenType<'tcx>>,
    opaque_types: &[(OpaqueTypeKey<'tcx>, ProvisionalHiddenType<'tcx>)],
) -> Vec<DeferredOpaqueTypeError<'tcx>>
Expand description

This computes the actual hidden types of the opaque types and maps them to their definition sites. Outside of registering the computed hidden types this function does not mutate the current borrowck state.

While it may fail to infer the hidden type and return errors, we always apply the computed hidden type to all opaque type uses to check whether they are correct. This is necessary to support non-defining uses of opaques in their defining scope.

It also means that this whole function is not really soundness critical as we recheck all uses of the opaques regardless.