Function type_check

Source
pub(crate) fn type_check<'a, 'tcx>(
    infcx: &BorrowckInferCtxt<'tcx>,
    body: &Body<'tcx>,
    promoted: &IndexSlice<Promoted, Body<'tcx>>,
    universal_regions: UniversalRegions<'tcx>,
    location_table: &PoloniusLocationTable,
    borrow_set: &BorrowSet<'tcx>,
    polonius_facts: &mut Option<PoloniusFacts>,
    flow_inits: ResultsCursor<'a, 'tcx, MaybeInitializedPlaces<'a, 'tcx>>,
    move_data: &MoveData<'tcx>,
    location_map: Rc<DenseLocationMap>,
    concrete_opaque_types: &mut ConcreteOpaqueTypes<'tcx>,
) -> MirTypeckResults<'tcx>
Expand description

Type checks the given mir in the context of the inference context infcx. Returns any region constraints that have yet to be proven. This result includes liveness constraints that ensure that regions appearing in the types of all local variables are live at all points where that local variable may later be used.

This phase of type-check ought to be infallible – this is because the original, HIR-based type-check succeeded. So if any errors occur here, we will get a bug! reported.

§Parameters

  • infcx – inference context to use
  • body – MIR body to type-check
  • promoted – map of promoted constants within body
  • universal_regions – the universal regions from bodys function signature
  • location_table – for datalog polonius, the map between Locations and RichLocations
  • borrow_set – information about borrows occurring in body
  • polonius_facts – when using Polonius, this is the generated set of Polonius facts
  • flow_inits – results of a maybe-init dataflow analysis
  • move_data – move-data constructed when performing the maybe-init dataflow analysis
  • location_map – map between MIR Location and PointIndex