fix elaborate for predicates with unbound variables

This commit is contained in:
Bastian Kauschke 2020-06-19 19:19:21 +02:00
parent 8d4c99ad88
commit bbd581c583
2 changed files with 5 additions and 9 deletions

View file

@ -151,15 +151,11 @@ impl Elaborator<'tcx> {
fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
let tcx = self.visited.tcx;
let pred = match obligation.predicate.kind() {
// We have to be careful and rebind this when
// dealing with a predicate further down.
ty::PredicateKind::ForAll(binder) => binder.skip_binder().kind(),
pred => pred,
};
match pred {
ty::PredicateKind::ForAll(_) => bug!("unexpected predicate: {:?}", pred),
match obligation.predicate.ignore_qualifiers(tcx).skip_binder().kind() {
ty::PredicateKind::ForAll(_) => {
bug!("unexpected predicate: {:?}", obligation.predicate)
}
ty::PredicateKind::Trait(data, _) => {
// Get predicates declared on the trait.
let predicates = tcx.super_predicates_of(data.def_id());

View file

@ -763,7 +763,7 @@ impl AutoTraitFinder<'tcx> {
}
}
Ok(None) => {
// It's ok not to make progress when hvave no inference variables -
// It's ok not to make progress when have no inference variables -
// in that case, we were only performing unifcation to check if an
// error occurred (which would indicate that it's impossible for our
// type to implement the auto trait).