use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
-use rustc_hir::lang_items::{CoerceUnsizedTraitLangItem, CopyTraitLangItem, SizedTraitLangItem};
+use rustc_hir::lang_items::LangItem;
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
use rustc_middle::ty::{
- self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef,
- ToPredicate, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
+ self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPredicate, Ty,
+ TyCtxt, UserType, UserTypeAnnotationIndex, WithConstness,
};
use rustc_span::{Span, DUMMY_SP};
use rustc_target::abi::VariantIdx;
}
} else {
let tcx = self.tcx();
- if let ty::ConstKind::Unevaluated(def_id, substs, promoted) = constant.literal.val {
+ if let ty::ConstKind::Unevaluated(def, substs, promoted) = constant.literal.val {
if let Some(promoted) = promoted {
let check_err = |verifier: &mut TypeVerifier<'a, 'b, 'tcx>,
promoted: &Body<'tcx>,
ConstraintCategory::Boring,
self.cx.param_env.and(type_op::ascribe_user_type::AscribeUserType::new(
constant.literal.ty,
- def_id,
+ def.did,
UserSubsts { substs, user_self_ty: None },
)),
) {
if let PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) = context {
let tcx = self.tcx();
let trait_ref = ty::TraitRef {
- def_id: tcx.require_lang_item(CopyTraitLangItem, Some(self.last_span)),
+ def_id: tcx.require_lang_item(LangItem::Copy, Some(self.last_span)),
substs: tcx.mk_substs_trait(place_ty.ty, &[]),
};
}
self.prove_predicate(
- ty::PredicateKind::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
+ ty::PredicateAtom::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
Locations::All(span),
ConstraintCategory::TypeAnnotation,
);
let tcx = infcx.tcx;
let param_env = self.param_env;
let body = self.body;
- let concrete_opaque_types = &tcx.typeck_tables_of(anon_owner_def_id).concrete_opaque_types;
+ let concrete_opaque_types = &tcx.typeck(anon_owner_def_id).concrete_opaque_types;
let mut opaque_type_values = Vec::new();
debug!("eq_opaque_type_and_type: mir_def_id={:?}", self.mir_def_id);
obligations.obligations.push(traits::Obligation::new(
ObligationCause::dummy(),
param_env,
- ty::PredicateKind::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
+ ty::PredicateAtom::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
));
obligations.add(
infcx
self.check_rvalue(body, rv, location);
if !self.tcx().features().unsized_locals {
let trait_ref = ty::TraitRef {
- def_id: tcx.require_lang_item(SizedTraitLangItem, Some(self.last_span)),
+ def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
substs: tcx.mk_substs_trait(place_ty, &[]),
};
self.prove_trait_ref(
| StatementKind::StorageDead(..)
| StatementKind::LlvmInlineAsm { .. }
| StatementKind::Retag { .. }
+ | StatementKind::Coverage(..)
| StatementKind::Nop => {}
}
}
self.check_call_dest(body, term, &sig, destination, term_location);
self.prove_predicates(
- sig.inputs_and_output.iter().map(|ty| ty::PredicateKind::WellFormed(ty.into())),
+ sig.inputs_and_output.iter().map(|ty| ty::PredicateAtom::WellFormed(ty.into())),
term_location.to_locations(),
ConstraintCategory::Boring,
);
traits::ObligationCauseCode::RepeatVec(should_suggest),
),
self.param_env,
- ty::PredicateKind::Trait(
- ty::Binder::bind(ty::TraitPredicate {
- trait_ref: ty::TraitRef::new(
- self.tcx().require_lang_item(
- CopyTraitLangItem,
- Some(self.last_span),
- ),
- tcx.mk_substs_trait(ty, &[]),
- ),
- }),
- hir::Constness::NotConst,
- )
+ ty::Binder::bind(ty::TraitRef::new(
+ self.tcx().require_lang_item(
+ LangItem::Copy,
+ Some(self.last_span),
+ ),
+ tcx.mk_substs_trait(ty, &[]),
+ ))
+ .without_const()
.to_predicate(self.tcx()),
),
&traits::SelectionError::Unimplemented,
}
let trait_ref = ty::TraitRef {
- def_id: tcx.require_lang_item(SizedTraitLangItem, Some(self.last_span)),
+ def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
substs: tcx.mk_substs_trait(ty, &[]),
};
CastKind::Pointer(PointerCast::Unsize) => {
let &ty = ty;
let trait_ref = ty::TraitRef {
- def_id: tcx.require_lang_item(
- CoerceUnsizedTraitLangItem,
- Some(self.last_span),
- ),
+ def_id: tcx
+ .require_lang_item(LangItem::CoerceUnsized, Some(self.last_span)),
substs: tcx.mk_substs_trait(op.ty(body, tcx), &[ty.into()]),
};
// example).
if let Some(all_facts) = all_facts {
let _prof_timer = self.infcx.tcx.prof.generic_activity("polonius_fact_generation");
- if let Some(borrow_index) = borrow_set.location_map.get(&location) {
+ if let Some(borrow_index) = borrow_set.get_index_of(&location) {
let region_vid = borrow_region.to_region_vid();
all_facts.borrow_region.push((
region_vid,
- *borrow_index,
+ borrow_index,
location_table.mid_index(location),
));
}
category: ConstraintCategory,
) {
self.prove_predicates(
- Some(ty::PredicateKind::Trait(
- trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
+ Some(ty::PredicateAtom::Trait(
+ ty::TraitPredicate { trait_ref },
hir::Constness::NotConst,
)),
locations,