1
Fork 0

Review changes

This commit is contained in:
Jack Huey 2021-01-07 11:20:28 -05:00
parent 66c179946b
commit 3dea68de1d
67 changed files with 581 additions and 590 deletions

View file

@ -1177,9 +1177,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
obligation.predicate
);
let bound_predicate = obligation.predicate.bound_atom();
let bound_predicate = obligation.predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(pred, _) => {
ty::PredicateKind::Trait(pred, _) => {
let pred = bound_predicate.rebind(pred);
associated_types.entry(span).or_default().extend(
tcx.associated_items(pred.def_id())
@ -1188,7 +1188,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
.map(|item| item.def_id),
);
}
ty::PredicateAtom::Projection(pred) => {
ty::PredicateKind::Projection(pred) => {
let pred = bound_predicate.rebind(pred);
// A `Self` within the original bound will be substituted with a
// `trait_object_dummy_self`, so check for that.

View file

@ -544,9 +544,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.infcx.instantiate_opaque_types(id, self.body_id, self.param_env, ty, span);
let mut suggest_box = !impl_trait_ret_ty.obligations.is_empty();
for o in impl_trait_ret_ty.obligations {
match o.predicate.bound_atom().skip_binder() {
ty::PredicateAtom::Trait(t, constness) => {
let pred = ty::PredicateAtom::Trait(
match o.predicate.kind().skip_binder() {
ty::PredicateKind::Trait(t, constness) => {
let pred = ty::PredicateKind::Trait(
ty::TraitPredicate {
trait_ref: ty::TraitRef {
def_id: t.def_id(),

View file

@ -192,9 +192,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
obligation.predicate
);
let bound_predicate = obligation.predicate.bound_atom();
if let ty::PredicateAtom::Projection(proj_predicate) =
obligation.predicate.skip_binders()
let bound_predicate = obligation.predicate.kind();
if let ty::PredicateKind::Projection(proj_predicate) =
obligation.predicate.kind().skip_binder()
{
// Given a Projection predicate, we can potentially infer
// the complete signature.
@ -622,8 +622,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// where R is the return type we are expecting. This type `T`
// will be our output.
let output_ty = self.obligations_for_self_ty(ret_vid).find_map(|(_, obligation)| {
let bound_predicate = obligation.predicate.bound_atom();
if let ty::PredicateAtom::Projection(proj_predicate) = bound_predicate.skip_binder() {
let bound_predicate = obligation.predicate.kind();
if let ty::PredicateKind::Projection(proj_predicate) = bound_predicate.skip_binder() {
self.deduce_future_output_from_projection(
obligation.cause.span,
bound_predicate.rebind(proj_predicate),

View file

@ -583,9 +583,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
while !queue.is_empty() {
let obligation = queue.remove(0);
debug!("coerce_unsized resolve step: {:?}", obligation);
let bound_predicate = obligation.predicate.bound_atom();
let bound_predicate = obligation.predicate.kind();
let trait_pred = match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_pred, _)
ty::PredicateKind::Trait(trait_pred, _)
if traits.contains(&trait_pred.def_id()) =>
{
if unsize_did == trait_pred.def_id() {

View file

@ -226,13 +226,13 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
// could be extended easily also to the other `Predicate`.
let predicate_matches_closure = |p: Predicate<'tcx>| {
let mut relator: SimpleEqRelation<'tcx> = SimpleEqRelation::new(tcx, self_param_env);
let predicate = predicate.bound_atom();
let p = p.bound_atom();
let predicate = predicate.kind();
let p = p.kind();
match (predicate.skip_binder(), p.skip_binder()) {
(ty::PredicateAtom::Trait(a, _), ty::PredicateAtom::Trait(b, _)) => {
(ty::PredicateKind::Trait(a, _), ty::PredicateKind::Trait(b, _)) => {
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
}
(ty::PredicateAtom::Projection(a), ty::PredicateAtom::Projection(b)) => {
(ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
}
_ => predicate == p,

View file

@ -542,7 +542,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.register_predicate(traits::Obligation::new(
cause,
self.param_env,
ty::PredicateAtom::WellFormed(arg).to_predicate(self.tcx),
ty::PredicateKind::WellFormed(arg).to_predicate(self.tcx),
));
}
@ -764,21 +764,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.pending_obligations()
.into_iter()
.filter_map(move |obligation| {
let bound_predicate = obligation.predicate.bound_atom();
let bound_predicate = obligation.predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Projection(data) => {
ty::PredicateKind::Projection(data) => {
Some((bound_predicate.rebind(data).to_poly_trait_ref(self.tcx), obligation))
}
ty::PredicateAtom::Trait(data, _) => {
ty::PredicateKind::Trait(data, _) => {
Some((bound_predicate.rebind(data).to_poly_trait_ref(), obligation))
}
ty::PredicateAtom::Subtype(..) => None,
ty::PredicateAtom::RegionOutlives(..) => None,
ty::PredicateAtom::TypeOutlives(..) => None,
ty::PredicateAtom::WellFormed(..) => None,
ty::PredicateAtom::ObjectSafe(..) => None,
ty::PredicateAtom::ConstEvaluatable(..) => None,
ty::PredicateAtom::ConstEquate(..) => None,
ty::PredicateKind::Subtype(..) => None,
ty::PredicateKind::RegionOutlives(..) => None,
ty::PredicateKind::TypeOutlives(..) => None,
ty::PredicateKind::WellFormed(..) => None,
ty::PredicateKind::ObjectSafe(..) => None,
ty::PredicateKind::ConstEvaluatable(..) => None,
ty::PredicateKind::ConstEquate(..) => None,
// N.B., this predicate is created by breaking down a
// `ClosureType: FnFoo()` predicate, where
// `ClosureType` represents some `Closure`. It can't
@ -787,8 +787,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// this closure yet; this is exactly why the other
// code is looking for a self type of a unresolved
// inference variable.
ty::PredicateAtom::ClosureKind(..) => None,
ty::PredicateAtom::TypeWellFormedFromEnv(..) => None,
ty::PredicateKind::ClosureKind(..) => None,
ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
}
})
.filter(move |(tr, _)| self.self_type_matches_expected_vid(*tr, ty_var_root))

View file

@ -923,8 +923,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
continue;
}
if let ty::PredicateAtom::Trait(predicate, _) =
error.obligation.predicate.skip_binders()
if let ty::PredicateKind::Trait(predicate, _) =
error.obligation.predicate.kind().skip_binder()
{
// Collect the argument position for all arguments that could have caused this
// `FulfillmentError`.
@ -974,8 +974,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let hir::ExprKind::Path(qpath) = &path.kind {
if let hir::QPath::Resolved(_, path) = &qpath {
for error in errors {
if let ty::PredicateAtom::Trait(predicate, _) =
error.obligation.predicate.skip_binders()
if let ty::PredicateKind::Trait(predicate, _) =
error.obligation.predicate.kind().skip_binder()
{
// If any of the type arguments in this path segment caused the
// `FullfillmentError`, point at its span (#61860).

View file

@ -194,8 +194,8 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
parent: None,
predicates: tcx.arena.alloc_from_iter(
self.param_env.caller_bounds().iter().filter_map(|predicate| {
match predicate.skip_binders() {
ty::PredicateAtom::Trait(data, _) if data.self_ty().is_param(index) => {
match predicate.kind().skip_binder() {
ty::PredicateKind::Trait(data, _) if data.self_ty().is_param(index) => {
// HACK(eddyb) should get the original `Span`.
let span = tcx.def_span(def_id);
Some((predicate, span))

View file

@ -478,8 +478,8 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
traits::elaborate_predicates(self.tcx, predicates.predicates.iter().copied())
// We don't care about regions here.
.filter_map(|obligation| match obligation.predicate.skip_binders() {
ty::PredicateAtom::Trait(trait_pred, _) if trait_pred.def_id() == sized_def_id => {
.filter_map(|obligation| match obligation.predicate.kind().skip_binder() {
ty::PredicateKind::Trait(trait_pred, _) if trait_pred.def_id() == sized_def_id => {
let span = predicates
.predicates
.iter()

View file

@ -399,7 +399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
obligations.push(traits::Obligation::new(
cause,
self.param_env,
ty::PredicateAtom::WellFormed(method_ty.into()).to_predicate(tcx),
ty::PredicateKind::WellFormed(method_ty.into()).to_predicate(tcx),
));
let callee = MethodCallee { def_id, substs: trait_ref.substs, sig: fn_sig };

View file

@ -795,9 +795,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
debug!("assemble_inherent_candidates_from_param(param_ty={:?})", param_ty);
let bounds = self.param_env.caller_bounds().iter().filter_map(|predicate| {
let bound_predicate = predicate.bound_atom();
let bound_predicate = predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_predicate, _) => {
ty::PredicateKind::Trait(trait_predicate, _) => {
match *trait_predicate.trait_ref.self_ty().kind() {
ty::Param(p) if p == param_ty => {
Some(bound_predicate.rebind(trait_predicate.trait_ref))
@ -805,16 +805,16 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
_ => None,
}
}
ty::PredicateAtom::Subtype(..)
| ty::PredicateAtom::Projection(..)
| ty::PredicateAtom::RegionOutlives(..)
| ty::PredicateAtom::WellFormed(..)
| ty::PredicateAtom::ObjectSafe(..)
| ty::PredicateAtom::ClosureKind(..)
| ty::PredicateAtom::TypeOutlives(..)
| ty::PredicateAtom::ConstEvaluatable(..)
| ty::PredicateAtom::ConstEquate(..)
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => None,
ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Projection(..)
| ty::PredicateKind::RegionOutlives(..)
| ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::TypeOutlives(..)
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
}
});

View file

@ -582,8 +582,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let mut collect_type_param_suggestions =
|self_ty: Ty<'tcx>, parent_pred: &ty::Predicate<'tcx>, obligation: &str| {
// We don't care about regions here, so it's fine to skip the binder here.
if let (ty::Param(_), ty::PredicateAtom::Trait(p, _)) =
(self_ty.kind(), parent_pred.skip_binders())
if let (ty::Param(_), ty::PredicateKind::Trait(p, _)) =
(self_ty.kind(), parent_pred.kind().skip_binder())
{
if let ty::Adt(def, _) = p.trait_ref.self_ty().kind() {
let node = def.did.as_local().map(|def_id| {
@ -637,9 +637,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
};
let mut format_pred = |pred: ty::Predicate<'tcx>| {
let bound_predicate = pred.bound_atom();
let bound_predicate = pred.kind();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Projection(pred) => {
ty::PredicateKind::Projection(pred) => {
let pred = bound_predicate.rebind(pred);
// `<Foo as Iterator>::Item = String`.
let trait_ref =
@ -658,7 +658,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
bound_span_label(trait_ref.self_ty(), &obligation, &quiet);
Some((obligation, trait_ref.self_ty()))
}
ty::PredicateAtom::Trait(poly_trait_ref, _) => {
ty::PredicateKind::Trait(poly_trait_ref, _) => {
let p = poly_trait_ref.trait_ref;
let self_ty = p.self_ty();
let path = p.print_only_trait_path();
@ -992,11 +992,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// implementing a trait would be legal but is rejected
// here).
unsatisfied_predicates.iter().all(|(p, _)| {
match p.skip_binders() {
match p.kind().skip_binder() {
// Hide traits if they are present in predicates as they can be fixed without
// having to implement them.
ty::PredicateAtom::Trait(t, _) => t.def_id() == info.def_id,
ty::PredicateAtom::Projection(p) => {
ty::PredicateKind::Trait(t, _) => t.def_id() == info.def_id,
ty::PredicateKind::Projection(p) => {
p.projection_ty.item_def_id == info.def_id
}
_ => false,

View file

@ -864,9 +864,9 @@ fn bounds_from_generic_predicates<'tcx>(
let mut projections = vec![];
for (predicate, _) in predicates.predicates {
debug!("predicate {:?}", predicate);
let bound_predicate = predicate.bound_atom();
let bound_predicate = predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_predicate, _) => {
ty::PredicateKind::Trait(trait_predicate, _) => {
let entry = types.entry(trait_predicate.self_ty()).or_default();
let def_id = trait_predicate.def_id();
if Some(def_id) != tcx.lang_items().sized_trait() {
@ -875,7 +875,7 @@ fn bounds_from_generic_predicates<'tcx>(
entry.push(trait_predicate.def_id());
}
}
ty::PredicateAtom::Projection(projection_pred) => {
ty::PredicateKind::Projection(projection_pred) => {
projections.push(bound_predicate.rebind(projection_pred));
}
_ => {}

View file

@ -532,7 +532,7 @@ fn check_type_defn<'tcx, F>(
fcx.register_predicate(traits::Obligation::new(
cause,
fcx.param_env,
ty::PredicateAtom::ConstEvaluatable(
ty::PredicateKind::ConstEvaluatable(
ty::WithOptConstParam::unknown(discr_def_id.to_def_id()),
discr_substs,
)

View file

@ -562,8 +562,8 @@ fn type_param_predicates(
let extra_predicates = extend.into_iter().chain(
icx.type_parameter_bounds_in_generics(ast_generics, param_id, ty, OnlySelfBounds(true))
.into_iter()
.filter(|(predicate, _)| match predicate.skip_binders() {
ty::PredicateAtom::Trait(data, _) => data.self_ty().is_param(index),
.filter(|(predicate, _)| match predicate.kind().skip_binder() {
ty::PredicateKind::Trait(data, _) => data.self_ty().is_param(index),
_ => false,
}),
);
@ -1027,7 +1027,7 @@ fn super_predicates_of(tcx: TyCtxt<'_>, trait_def_id: DefId) -> ty::GenericPredi
// which will, in turn, reach indirect supertraits.
for &(pred, span) in superbounds {
debug!("superbound: {:?}", pred);
if let ty::PredicateAtom::Trait(bound, _) = pred.skip_binders() {
if let ty::PredicateKind::Trait(bound, _) = pred.kind().skip_binder() {
tcx.at(span).super_predicates_of(bound.def_id());
}
}
@ -1946,7 +1946,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
} else {
let span = bound_pred.bounded_ty.span;
let re_root_empty = tcx.lifetimes.re_root_empty;
let predicate = ty::Binder::bind(ty::PredicateAtom::TypeOutlives(
let predicate = ty::Binder::bind(ty::PredicateKind::TypeOutlives(
ty::OutlivesPredicate(ty, re_root_empty),
));
predicates.insert((predicate.to_predicate(tcx), span));
@ -1990,7 +1990,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
hir::GenericBound::Outlives(lifetime) => {
let region = AstConv::ast_region_to_region(&icx, lifetime, None);
predicates.insert((
ty::Binder::bind(ty::PredicateAtom::TypeOutlives(
ty::Binder::bind(ty::PredicateKind::TypeOutlives(
ty::OutlivesPredicate(ty, region),
))
.to_predicate(tcx),
@ -2010,7 +2010,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
}
_ => bug!(),
};
let pred = ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(r1, r2))
let pred = ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(r1, r2))
.to_predicate(icx.tcx);
(pred, span)
@ -2075,7 +2075,7 @@ fn const_evaluatable_predicates_of<'tcx>(
if let ty::ConstKind::Unevaluated(def, substs, None) = ct.val {
let span = self.tcx.hir().span(c.hir_id);
self.preds.insert((
ty::PredicateAtom::ConstEvaluatable(def, substs).to_predicate(self.tcx),
ty::PredicateKind::ConstEvaluatable(def, substs).to_predicate(self.tcx),
span,
));
}
@ -2094,7 +2094,7 @@ fn const_evaluatable_predicates_of<'tcx>(
fn visit_const(&mut self, ct: &'tcx Const<'tcx>) -> ControlFlow<Self::BreakTy> {
if let ty::ConstKind::Unevaluated(def, substs, None) = ct.val {
self.preds.insert((
ty::PredicateAtom::ConstEvaluatable(def, substs).to_predicate(self.tcx),
ty::PredicateKind::ConstEvaluatable(def, substs).to_predicate(self.tcx),
self.span,
));
}
@ -2180,12 +2180,12 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
.predicates
.iter()
.copied()
.filter(|(pred, _)| match pred.skip_binders() {
ty::PredicateAtom::Trait(tr, _) => !is_assoc_item_ty(tr.self_ty()),
ty::PredicateAtom::Projection(proj) => {
.filter(|(pred, _)| match pred.kind().skip_binder() {
ty::PredicateKind::Trait(tr, _) => !is_assoc_item_ty(tr.self_ty()),
ty::PredicateKind::Projection(proj) => {
!is_assoc_item_ty(proj.projection_ty.self_ty())
}
ty::PredicateAtom::TypeOutlives(outlives) => !is_assoc_item_ty(outlives.0),
ty::PredicateKind::TypeOutlives(outlives) => !is_assoc_item_ty(outlives.0),
_ => true,
})
.collect();
@ -2214,7 +2214,8 @@ fn projection_ty_from_predicates(
let (ty_def_id, item_def_id) = key;
let mut projection_ty = None;
for (predicate, _) in tcx.predicates_of(ty_def_id).predicates {
if let ty::PredicateAtom::Projection(projection_predicate) = predicate.skip_binders() {
if let ty::PredicateKind::Projection(projection_predicate) = predicate.kind().skip_binder()
{
if item_def_id == projection_predicate.projection_ty.item_def_id {
projection_ty = Some(projection_predicate.projection_ty);
break;
@ -2261,7 +2262,7 @@ fn predicates_from_bound<'tcx>(
}
hir::GenericBound::Outlives(ref lifetime) => {
let region = astconv.ast_region_to_region(lifetime, None);
let pred = ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(param_ty, region))
let pred = ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(param_ty, region))
.to_predicate(astconv.tcx());
vec![(pred, lifetime.span)]
}

View file

@ -36,13 +36,14 @@ fn associated_type_bounds<'tcx>(
let trait_def_id = tcx.associated_item(assoc_item_def_id).container.id();
let trait_predicates = tcx.trait_explicit_predicates_and_bounds(trait_def_id.expect_local());
let bounds_from_parent =
trait_predicates.predicates.iter().copied().filter(|(pred, _)| match pred.skip_binders() {
ty::PredicateAtom::Trait(tr, _) => tr.self_ty() == item_ty,
ty::PredicateAtom::Projection(proj) => proj.projection_ty.self_ty() == item_ty,
ty::PredicateAtom::TypeOutlives(outlives) => outlives.0 == item_ty,
let bounds_from_parent = trait_predicates.predicates.iter().copied().filter(|(pred, _)| {
match pred.kind().skip_binder() {
ty::PredicateKind::Trait(tr, _) => tr.self_ty() == item_ty,
ty::PredicateKind::Projection(proj) => proj.projection_ty.self_ty() == item_ty,
ty::PredicateKind::TypeOutlives(outlives) => outlives.0 == item_ty,
_ => false,
});
}
});
let all_bounds = tcx
.arena

View file

@ -183,7 +183,8 @@ pub fn setup_constraining_predicates<'tcx>(
for j in i..predicates.len() {
// Note that we don't have to care about binders here,
// as the impl trait ref never contains any late-bound regions.
if let ty::PredicateAtom::Projection(projection) = predicates[j].0.skip_binders() {
if let ty::PredicateKind::Projection(projection) = predicates[j].0.kind().skip_binder()
{
// Special case: watch out for some kind of sneaky attempt
// to project out an associated type defined by this very
// trait.

View file

@ -198,7 +198,7 @@ fn unconstrained_parent_impl_substs<'tcx>(
// the functions in `cgp` add the constrained parameters to a list of
// unconstrained parameters.
for (predicate, _) in impl_generic_predicates.predicates.iter() {
if let ty::PredicateAtom::Projection(proj) = predicate.skip_binders() {
if let ty::PredicateKind::Projection(proj) = predicate.kind().skip_binder() {
let projection_ty = proj.projection_ty;
let projected_ty = proj.ty;
@ -360,13 +360,13 @@ fn check_predicates<'tcx>(
fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tcx>, span: Span) {
debug!("can_specialize_on(predicate = {:?})", predicate);
match predicate.skip_binders() {
match predicate.kind().skip_binder() {
// Global predicates are either always true or always false, so we
// are fine to specialize on.
_ if predicate.is_global() => (),
// We allow specializing on explicitly marked traits with no associated
// items.
ty::PredicateAtom::Trait(pred, hir::Constness::NotConst) => {
ty::PredicateKind::Trait(pred, hir::Constness::NotConst) => {
if !matches!(
trait_predicate_kind(tcx, predicate),
Some(TraitSpecializationKind::Marker)
@ -393,20 +393,20 @@ fn trait_predicate_kind<'tcx>(
tcx: TyCtxt<'tcx>,
predicate: ty::Predicate<'tcx>,
) -> Option<TraitSpecializationKind> {
match predicate.skip_binders() {
ty::PredicateAtom::Trait(pred, hir::Constness::NotConst) => {
match predicate.kind().skip_binder() {
ty::PredicateKind::Trait(pred, hir::Constness::NotConst) => {
Some(tcx.trait_def(pred.def_id()).specialization_kind)
}
ty::PredicateAtom::Trait(_, hir::Constness::Const)
| ty::PredicateAtom::RegionOutlives(_)
| ty::PredicateAtom::TypeOutlives(_)
| ty::PredicateAtom::Projection(_)
| ty::PredicateAtom::WellFormed(_)
| ty::PredicateAtom::Subtype(_)
| ty::PredicateAtom::ObjectSafe(_)
| ty::PredicateAtom::ClosureKind(..)
| ty::PredicateAtom::ConstEvaluatable(..)
| ty::PredicateAtom::ConstEquate(..)
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => None,
ty::PredicateKind::Trait(_, hir::Constness::Const)
| ty::PredicateKind::RegionOutlives(_)
| ty::PredicateKind::TypeOutlives(_)
| ty::PredicateKind::Projection(_)
| ty::PredicateKind::WellFormed(_)
| ty::PredicateKind::Subtype(_)
| ty::PredicateKind::ObjectSafe(_)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
}
}

View file

@ -29,8 +29,8 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
// process predicates and convert to `RequiredPredicates` entry, see below
for &(predicate, span) in predicates.predicates {
match predicate.skip_binders() {
ty::PredicateAtom::TypeOutlives(OutlivesPredicate(ref ty, ref reg)) => {
match predicate.kind().skip_binder() {
ty::PredicateKind::TypeOutlives(OutlivesPredicate(ref ty, ref reg)) => {
insert_outlives_predicate(
tcx,
(*ty).into(),
@ -40,7 +40,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
)
}
ty::PredicateAtom::RegionOutlives(OutlivesPredicate(ref reg1, ref reg2)) => {
ty::PredicateKind::RegionOutlives(OutlivesPredicate(ref reg1, ref reg2)) => {
insert_outlives_predicate(
tcx,
(*reg1).into(),
@ -50,15 +50,15 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
)
}
ty::PredicateAtom::Trait(..)
| ty::PredicateAtom::Projection(..)
| ty::PredicateAtom::WellFormed(..)
| ty::PredicateAtom::ObjectSafe(..)
| ty::PredicateAtom::ClosureKind(..)
| ty::PredicateAtom::Subtype(..)
| ty::PredicateAtom::ConstEvaluatable(..)
| ty::PredicateAtom::ConstEquate(..)
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => (),
ty::PredicateKind::Trait(..)
| ty::PredicateKind::Projection(..)
| ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..)
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => (),
}
}

View file

@ -30,9 +30,9 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
if tcx.has_attr(item_def_id, sym::rustc_outlives) {
let mut pred: Vec<String> = predicates
.iter()
.map(|(out_pred, _)| match out_pred.bound_atom().skip_binder() {
ty::PredicateAtom::RegionOutlives(p) => p.to_string(),
ty::PredicateAtom::TypeOutlives(p) => p.to_string(),
.map(|(out_pred, _)| match out_pred.kind().skip_binder() {
ty::PredicateKind::RegionOutlives(p) => p.to_string(),
ty::PredicateKind::TypeOutlives(p) => p.to_string(),
err => bug!("unexpected predicate {:?}", err),
})
.collect();
@ -85,12 +85,12 @@ fn inferred_outlives_crate(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CratePredica
|(ty::OutlivesPredicate(kind1, region2), &span)| {
match kind1.unpack() {
GenericArgKind::Type(ty1) => Some((
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(ty1, region2))
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty1, region2))
.to_predicate(tcx),
span,
)),
GenericArgKind::Lifetime(region1) => Some((
ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(
ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(
region1, region2,
))
.to_predicate(tcx),