rustc: Make "ne" use traits

This commit is contained in:
Patrick Walton
2012-09-07 12:44:53 -07:00
parent b4d879a2ef
commit c21b3ff818
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -110,7 +110,8 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
ge => return Some(~"ge"),
gt => return Some(~"gt"),
eq => return Some(~"eq"),
and | or | ne => return None
ne => return Some(~"ne"),
and | or => return None
}
}
+1 -1
View File
@@ -4530,7 +4530,7 @@ fn record_candidate_traits_for_expr_if_necessary(expr: @expr) {
self.add_fixed_trait_for_expr(expr.id,
self.lang_items.ord_trait);
}
expr_binary(eq, _, _) => {
expr_binary(eq, _, _) | expr_binary(ne, _, _) => {
self.add_fixed_trait_for_expr(expr.id,
self.lang_items.eq_trait);
}
+1 -1
View File
@@ -1108,7 +1108,7 @@ fn check_binop(fcx: @fn_ctxt, expr: @ast::expr,
// Hack: Unify the two sides if this is a relational operator.
match op {
ast::eq | ast::lt | ast::le | ast::ne | ast::ge | ast::gt => {
ast::eq | ast::ne | ast::lt | ast::le | ast::ge | ast::gt => {
check_expr_with(fcx, rhs, lhs_t);
}
_ => {}