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

View file

@ -110,7 +110,8 @@ pure fn binop_to_method_name(op: binop) -> Option<~str> {
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
}
}

View file

@ -4530,7 +4530,7 @@ struct Resolver {
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);
}

View file

@ -1108,7 +1108,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
// 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);
}
_ => {}