let infcx = self.selcx.infcx();
- match *obligation.predicate.kind() {
- ty::PredicateKind::ForAll(binder) => match binder.skip_binder() {
+ let binder = obligation.predicate.bound_atom();
+ if binder.skip_binder().has_escaping_bound_vars() {
+ match binder.skip_binder() {
// Evaluation will discard candidates using the leak check.
// This means we need to pass it the bound version of our
// predicate.
ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
- },
- ty::PredicateKind::Atom(atom) => match atom {
+ }
+ } else {
+ match binder.skip_binder() {
ty::PredicateAtom::Trait(data, _) => {
let trait_obligation = obligation.with(Binder::dummy(data));
ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
- },
+ }
}
}