Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement equality constraints in where clauses #22074

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Translate equality predicates in collect
  • Loading branch information
jroesch committed Feb 8, 2015
commit a2b9dc8085e27d94fbe9b342830d9a20f829df2b
7 changes: 6 additions & 1 deletion src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
@@ -554,7 +554,12 @@ fn early_bound_lifetime_names(generics: &ast::Generics) -> Vec<ast::Name> {
collector.visit_lifetime_ref(bound);
}
}
&ast::WherePredicate::EqPredicate(_) => unimplemented!()
&ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref ty_left,
ref ty_right,
..}) => {
collector.visit_ty(&**ty_left);
collector.visit_ty(&**ty_right);
}
}
}
}
7 changes: 3 additions & 4 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
@@ -1293,10 +1293,9 @@ fn ty_generics<'a,'tcx>(ccx: &CollectCtxt<'a,'tcx>,
}

&ast::WherePredicate::EqPredicate(ref eq_pred) => {
// FIXME(#20041)
ccx.tcx.sess.span_bug(eq_pred.span,
"Equality constraints are not yet \
implemented (#20041)")
let ty_left = ast_ty_to_ty(ccx, &ExplicitRscope, &*eq_pred.ty_left);
let ty_right = ast_ty_to_ty(ccx, &ExplicitRscope, &*eq_pred.ty_right);
result.predicates.push(space, ty::Predicate::Equate(ty::Binder(ty::EquatePredicate(ty_left, ty_right))));
}
}
}