Review changes
This commit is contained in:
@@ -454,16 +454,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
let result = ensure_sufficient_stack(|| {
|
||||
let bound_predicate = obligation.predicate.bound_atom();
|
||||
let bound_predicate = obligation.predicate.kind();
|
||||
match bound_predicate.skip_binder() {
|
||||
ty::PredicateAtom::Trait(t, _) => {
|
||||
ty::PredicateKind::Trait(t, _) => {
|
||||
let t = bound_predicate.rebind(t);
|
||||
debug_assert!(!t.has_escaping_bound_vars());
|
||||
let obligation = obligation.with(t);
|
||||
self.evaluate_trait_predicate_recursively(previous_stack, obligation)
|
||||
}
|
||||
|
||||
ty::PredicateAtom::Subtype(p) => {
|
||||
ty::PredicateKind::Subtype(p) => {
|
||||
let p = bound_predicate.rebind(p);
|
||||
// Does this code ever run?
|
||||
match self.infcx.subtype_predicate(&obligation.cause, obligation.param_env, p) {
|
||||
@@ -479,7 +479,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateAtom::WellFormed(arg) => match wf::obligations(
|
||||
ty::PredicateKind::WellFormed(arg) => match wf::obligations(
|
||||
self.infcx,
|
||||
obligation.param_env,
|
||||
obligation.cause.body_id,
|
||||
@@ -494,12 +494,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
None => Ok(EvaluatedToAmbig),
|
||||
},
|
||||
|
||||
ty::PredicateAtom::TypeOutlives(..) | ty::PredicateAtom::RegionOutlives(..) => {
|
||||
ty::PredicateKind::TypeOutlives(..) | ty::PredicateKind::RegionOutlives(..) => {
|
||||
// We do not consider region relationships when evaluating trait matches.
|
||||
Ok(EvaluatedToOkModuloRegions)
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ObjectSafe(trait_def_id) => {
|
||||
ty::PredicateKind::ObjectSafe(trait_def_id) => {
|
||||
if self.tcx().is_object_safe(trait_def_id) {
|
||||
Ok(EvaluatedToOk)
|
||||
} else {
|
||||
@@ -507,7 +507,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateAtom::Projection(data) => {
|
||||
ty::PredicateKind::Projection(data) => {
|
||||
let data = bound_predicate.rebind(data);
|
||||
let project_obligation = obligation.with(data);
|
||||
match project::poly_project_and_unify_type(self, &project_obligation) {
|
||||
@@ -528,7 +528,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ClosureKind(_, closure_substs, kind) => {
|
||||
ty::PredicateKind::ClosureKind(_, closure_substs, kind) => {
|
||||
match self.infcx.closure_kind(closure_substs) {
|
||||
Some(closure_kind) => {
|
||||
if closure_kind.extends(kind) {
|
||||
@@ -541,7 +541,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ConstEvaluatable(def_id, substs) => {
|
||||
ty::PredicateKind::ConstEvaluatable(def_id, substs) => {
|
||||
match const_evaluatable::is_const_evaluatable(
|
||||
self.infcx,
|
||||
def_id,
|
||||
@@ -555,7 +555,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ConstEquate(c1, c2) => {
|
||||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
||||
debug!(?c1, ?c2, "evaluate_predicate_recursively: equating consts");
|
||||
|
||||
let evaluate = |c: &'tcx ty::Const<'tcx>| {
|
||||
@@ -598,7 +598,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
|
||||
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
|
||||
bug!("TypeWellFormedFromEnv is only used for chalk")
|
||||
}
|
||||
}
|
||||
@@ -845,8 +845,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
fn coinductive_predicate(&self, predicate: ty::Predicate<'tcx>) -> bool {
|
||||
let result = match predicate.skip_binders() {
|
||||
ty::PredicateAtom::Trait(ref data, _) => self.tcx().trait_is_auto(data.def_id()),
|
||||
let result = match predicate.kind().skip_binder() {
|
||||
ty::PredicateKind::Trait(ref data, _) => self.tcx().trait_is_auto(data.def_id()),
|
||||
_ => false,
|
||||
};
|
||||
debug!(?predicate, ?result, "coinductive_predicate");
|
||||
@@ -1174,8 +1174,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(idx, bound)| {
|
||||
let bound_predicate = bound.bound_atom();
|
||||
if let ty::PredicateAtom::Trait(pred, _) = bound_predicate.skip_binder() {
|
||||
let bound_predicate = bound.kind();
|
||||
if let ty::PredicateKind::Trait(pred, _) = bound_predicate.skip_binder() {
|
||||
let bound = bound_predicate.rebind(pred.trait_ref);
|
||||
if self.infcx.probe(|_| {
|
||||
match self.match_normalize_trait_ref(
|
||||
|
||||
Reference in New Issue
Block a user