1
Fork 0

Review comments

This commit is contained in:
Jack Huey 2020-10-16 15:14:38 -04:00
parent eba10270c6
commit f6a53b4c69
15 changed files with 34 additions and 31 deletions

View file

@ -1095,7 +1095,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
obligation.predicate
);
let bound_predicate = obligation.predicate.bound_atom(tcx);
let bound_predicate = obligation.predicate.bound_atom();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(pred, _) => {
let pred = bound_predicate.rebind(pred);

View file

@ -192,7 +192,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
obligation.predicate
);
let bound_predicate = obligation.predicate.bound_atom(self.tcx);
let bound_predicate = obligation.predicate.bound_atom();
if let ty::PredicateAtom::Projection(proj_predicate) =
obligation.predicate.skip_binders()
{

View file

@ -583,7 +583,7 @@ 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(self.tcx);
let bound_predicate = obligation.predicate.bound_atom();
let trait_pred = match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_pred, _)
if traits.contains(&trait_pred.def_id()) =>

View file

@ -226,14 +226,14 @@ 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 bound_predicate = predicate.bound_atom(tcx);
let bound_p = p.bound_atom(tcx);
match (predicate.skip_binders(), p.skip_binders()) {
let predicate = predicate.bound_atom();
let p = p.bound_atom();
match (predicate.skip_binder(), p.skip_binder()) {
(ty::PredicateAtom::Trait(a, _), ty::PredicateAtom::Trait(b, _)) => {
relator.relate(bound_predicate.rebind(a), bound_p.rebind(b)).is_ok()
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
}
(ty::PredicateAtom::Projection(a), ty::PredicateAtom::Projection(b)) => {
relator.relate(bound_predicate.rebind(a), bound_p.rebind(b)).is_ok()
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
}
_ => predicate == p,
}

View file

@ -796,13 +796,12 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
// FIXME: do we want to commit to this behavior for param bounds?
debug!("assemble_inherent_candidates_from_param(param_ty={:?})", param_ty);
let tcx = self.tcx;
let bounds = self.param_env.caller_bounds().iter().filter_map(|predicate| {
let bound_predicate = predicate.bound_atom(tcx);
let bound_predicate = predicate.bound_atom();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_predicate, _) => {
match trait_predicate.trait_ref.self_ty().kind() {
ty::Param(ref p) if *p == param_ty => {
match *trait_predicate.trait_ref.self_ty().kind() {
ty::Param(p) if p == param_ty => {
Some(bound_predicate.rebind(trait_predicate.trait_ref))
}
_ => None,

View file

@ -637,7 +637,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
};
let mut format_pred = |pred: ty::Predicate<'tcx>| {
let bound_predicate = pred.bound_atom(tcx);
let bound_predicate = pred.bound_atom();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Projection(pred) => {
let pred = bound_predicate.rebind(pred);

View file

@ -850,7 +850,7 @@ fn bounds_from_generic_predicates<'tcx>(
let mut projections = vec![];
for (predicate, _) in predicates.predicates {
debug!("predicate {:?}", predicate);
let bound_predicate = predicate.bound_atom(tcx);
let bound_predicate = predicate.bound_atom();
match bound_predicate.skip_binder() {
ty::PredicateAtom::Trait(trait_predicate, _) => {
let entry = types.entry(trait_predicate.self_ty()).or_default();