Skip to content

Commit ded761b

Browse files
committed
fix elaborate for predicates with unbound variables
1 parent 7e43275 commit ded761b

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/librustc_infer/traits/util.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,11 @@ impl Elaborator<'tcx> {
151151

152152
fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
153153
let tcx = self.visited.tcx;
154-
let pred = match obligation.predicate.kind() {
155-
// We have to be careful and rebind this when
156-
// dealing with a predicate further down.
157-
ty::PredicateKind::ForAll(binder) => binder.skip_binder().kind(),
158-
pred => pred,
159-
};
160-
161-
match pred {
162-
ty::PredicateKind::ForAll(_) => bug!("unexpected predicate: {:?}", pred),
154+
155+
match obligation.predicate.ignore_qualifiers(tcx).skip_binder().kind() {
156+
ty::PredicateKind::ForAll(_) => {
157+
bug!("unexpected predicate: {:?}", obligation.predicate)
158+
}
163159
ty::PredicateKind::Trait(data, _) => {
164160
// Get predicates declared on the trait.
165161
let predicates = tcx.super_predicates_of(data.def_id());

src/librustc_trait_selection/traits/auto_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl AutoTraitFinder<'tcx> {
763763
}
764764
}
765765
Ok(None) => {
766-
// It's ok not to make progress when hvave no inference variables -
766+
// It's ok not to make progress when have no inference variables -
767767
// in that case, we were only performing unifcation to check if an
768768
// error occurred (which would indicate that it's impossible for our
769769
// type to implement the auto trait).

0 commit comments

Comments
 (0)