Skip to content

Commit c21b3ff

Browse files
committed
rustc: Make "ne" use traits
1 parent b4d879a commit c21b3ff

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/libsyntax/ast_util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ pure fn binop_to_method_name(op: binop) -> Option<~str> {
110110
ge => return Some(~"ge"),
111111
gt => return Some(~"gt"),
112112
eq => return Some(~"eq"),
113-
and | or | ne => return None
113+
ne => return Some(~"ne"),
114+
and | or => return None
114115
}
115116
}
116117

src/rustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4530,7 +4530,7 @@ struct Resolver {
45304530
self.add_fixed_trait_for_expr(expr.id,
45314531
self.lang_items.ord_trait);
45324532
}
4533-
expr_binary(eq, _, _) => {
4533+
expr_binary(eq, _, _) | expr_binary(ne, _, _) => {
45344534
self.add_fixed_trait_for_expr(expr.id,
45354535
self.lang_items.eq_trait);
45364536
}

src/rustc/middle/typeck/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11081108
11091109
// Hack: Unify the two sides if this is a relational operator.
11101110
match op {
1111-
ast::eq | ast::lt | ast::le | ast::ne | ast::ge | ast::gt => {
1111+
ast::eq | ast::ne | ast::lt | ast::le | ast::ge | ast::gt => {
11121112
check_expr_with(fcx, rhs, lhs_t);
11131113
}
11141114
_ => {}

0 commit comments

Comments
 (0)