Review comments
This commit is contained in:
parent
eba10270c6
commit
f6a53b4c69
15 changed files with 34 additions and 31 deletions
|
@ -642,7 +642,7 @@ impl AutoTraitFinder<'tcx> {
|
|||
// We check this by calling is_of_param on the relevant types
|
||||
// from the various possible predicates
|
||||
|
||||
let bound_predicate = predicate.bound_atom(select.infcx().tcx);
|
||||
let bound_predicate = predicate.bound_atom();
|
||||
match bound_predicate.skip_binder() {
|
||||
ty::PredicateAtom::Trait(p, _) => {
|
||||
if self.is_param_no_infer(p.trait_ref.substs)
|
||||
|
|
|
@ -255,7 +255,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
let bound_predicate = obligation.predicate.bound_atom(self.tcx);
|
||||
let bound_predicate = obligation.predicate.bound_atom();
|
||||
match bound_predicate.skip_binder() {
|
||||
ty::PredicateAtom::Trait(trait_predicate, _) => {
|
||||
let trait_predicate = bound_predicate.rebind(trait_predicate);
|
||||
|
@ -1079,7 +1079,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
// FIXME: It should be possible to deal with `ForAll` in a cleaner way.
|
||||
let bound_error = error.bound_atom(self.tcx);
|
||||
let bound_error = error.bound_atom();
|
||||
let (cond, error) = match (cond.skip_binders(), bound_error.skip_binder()) {
|
||||
(ty::PredicateAtom::Trait(..), ty::PredicateAtom::Trait(error, _)) => {
|
||||
(cond, bound_error.rebind(error))
|
||||
|
@ -1091,7 +1091,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
};
|
||||
|
||||
for obligation in super::elaborate_predicates(self.tcx, std::iter::once(cond)) {
|
||||
let bound_predicate = obligation.predicate.bound_atom(self.tcx);
|
||||
let bound_predicate = obligation.predicate.bound_atom();
|
||||
if let ty::PredicateAtom::Trait(implication, _) = bound_predicate.skip_binder() {
|
||||
let error = error.to_poly_trait_ref();
|
||||
let implication = bound_predicate.rebind(implication.trait_ref);
|
||||
|
@ -1172,7 +1172,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
//
|
||||
// this can fail if the problem was higher-ranked, in which
|
||||
// cause I have no idea for a good error message.
|
||||
let bound_predicate = predicate.bound_atom(self.tcx);
|
||||
let bound_predicate = predicate.bound_atom();
|
||||
if let ty::PredicateAtom::Projection(data) = bound_predicate.skip_binder() {
|
||||
let mut selcx = SelectionContext::new(self);
|
||||
let (data, _) = self.replace_bound_vars_with_fresh_vars(
|
||||
|
@ -1459,7 +1459,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
let bound_predicate = predicate.bound_atom(self.tcx);
|
||||
let bound_predicate = predicate.bound_atom();
|
||||
let mut err = match bound_predicate.skip_binder() {
|
||||
ty::PredicateAtom::Trait(data, _) => {
|
||||
let self_ty = data.trait_ref.self_ty();
|
||||
|
|
|
@ -623,7 +623,7 @@ fn prune_cache_value_obligations<'a, 'tcx>(
|
|||
.obligations
|
||||
.iter()
|
||||
.filter(|obligation| {
|
||||
let bound_predicate = obligation.predicate.bound_atom(infcx.tcx);
|
||||
let bound_predicate = obligation.predicate.bound_atom();
|
||||
match bound_predicate.skip_binder() {
|
||||
// We found a `T: Foo<X = U>` predicate, let's check
|
||||
// if `U` references any unresolved type
|
||||
|
@ -908,7 +908,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
|
|||
let infcx = selcx.infcx();
|
||||
for predicate in env_predicates {
|
||||
debug!(?predicate);
|
||||
let bound_predicate = predicate.bound_atom(infcx.tcx);
|
||||
let bound_predicate = predicate.bound_atom();
|
||||
if let ty::PredicateAtom::Projection(data) = predicate.skip_binders() {
|
||||
let data = bound_predicate.rebind(data);
|
||||
let same_def_id = data.projection_def_id() == obligation.predicate.item_def_id;
|
||||
|
|
|
@ -449,8 +449,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
let result = ensure_sufficient_stack(|| {
|
||||
let bound_predicate =
|
||||
obligation.predicate.bound_atom_with_opt_escaping(self.infcx().tcx);
|
||||
let bound_predicate = obligation.predicate.bound_atom();
|
||||
match bound_predicate.skip_binder() {
|
||||
ty::PredicateAtom::Trait(t, _) => {
|
||||
let t = bound_predicate.rebind(t);
|
||||
|
@ -1176,7 +1175,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(idx, bound)| {
|
||||
let bound_predicate = bound.bound_atom(self.infcx.tcx);
|
||||
let bound_predicate = bound.bound_atom();
|
||||
if let ty::PredicateAtom::Trait(pred, _) = bound_predicate.skip_binder() {
|
||||
let bound = bound_predicate.rebind(pred.trait_ref);
|
||||
if self.infcx.probe(|_| {
|
||||
|
@ -1568,7 +1567,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
use self::BuiltinImplConditions::{Ambiguous, None, Where};
|
||||
|
||||
match self_ty.kind() {
|
||||
match *self_ty.kind() {
|
||||
ty::Infer(ty::IntVar(_))
|
||||
| ty::Infer(ty::FloatVar(_))
|
||||
| ty::FnDef(..)
|
||||
|
@ -1597,7 +1596,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
ty::Array(element_ty, _) => {
|
||||
// (*) binder moved here
|
||||
Where(obligation.predicate.rebind(vec![*element_ty]))
|
||||
Where(obligation.predicate.rebind(vec![element_ty]))
|
||||
}
|
||||
|
||||
ty::Tuple(tys) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue