infcx: &InferCtxt<'_, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
+ promoted: &IndexVec<Promoted, Body<'tcx>>,
mir_def_id: DefId,
universal_regions: &Rc<UniversalRegions<'tcx>>,
location_table: &LocationTable,
mir_def_id,
param_env,
body,
+ promoted,
®ion_bound_pairs,
implicit_region_bound,
&mut borrowck_context,
mir_def_id: DefId,
param_env: ty::ParamEnv<'tcx>,
body: &'a Body<'tcx>,
+ promoted: &'a IndexVec<Promoted, Body<'tcx>>,
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
implicit_region_bound: ty::Region<'tcx>,
borrowck_context: &'a mut BorrowCheckContext<'a, 'tcx>,
universal_region_relations,
);
let errors_reported = {
- let mut verifier = TypeVerifier::new(&mut checker, body);
+ let mut verifier = TypeVerifier::new(&mut checker, body, promoted);
verifier.visit_body(body);
verifier.errors_reported
};
struct TypeVerifier<'a, 'b, 'tcx> {
cx: &'a mut TypeChecker<'b, 'tcx>,
body: &'b Body<'tcx>,
+ promoted: &'b IndexVec<Promoted, Body<'tcx>>,
last_span: Span,
mir_def_id: DefId,
errors_reported: bool,
}
impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
- fn new(cx: &'a mut TypeChecker<'b, 'tcx>, body: &'b Body<'tcx>) -> Self {
+ fn new(
+ cx: &'a mut TypeChecker<'b, 'tcx>,
+ body: &'b Body<'tcx>,
+ promoted: &'b IndexVec<Promoted, Body<'tcx>>,
+ ) -> Self {
TypeVerifier {
body,
+ promoted,
mir_def_id: cx.mir_def_id,
cx,
last_span: body.span,
let mut place_ty = match place_base {
PlaceBase::Local(index) =>
PlaceTy::from_ty(self.body.local_decls[*index].ty),
- PlaceBase::Static(box Static { kind, ty: sty }) => {
+ PlaceBase::Static(box Static { kind, ty: sty, def_id }) => {
let sty = self.sanitize_type(place, sty);
let check_err =
|verifier: &mut TypeVerifier<'a, 'b, 'tcx>,
};
};
match kind {
- StaticKind::Promoted(promoted) => {
+ StaticKind::Promoted(promoted, _) => {
if !self.errors_reported {
- let promoted_body = &self.body.promoted[*promoted];
+ let promoted_body = &self.promoted[*promoted];
self.sanitize_promoted(promoted_body, location);
let promoted_ty = promoted_body.return_ty();
check_err(self, place, promoted_ty, sty);
}
}
- StaticKind::Static(def_id) => {
+ StaticKind::Static => {
let ty = self.tcx().type_of(*def_id);
let ty = self.cx.normalize(ty, location);
let is_promoted = match place {
Place {
base: PlaceBase::Static(box Static {
- kind: StaticKind::Promoted(_),
+ kind: StaticKind::Promoted(..),
..
}),
projection: None,