Skip to content

Commit

Permalink
fix elaborate for predicates with unbound variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jul 27, 2020
1 parent 8d4c99a commit bbd581c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/librustc_infer/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trait_selection/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit bbd581c

Please sign in to comment.