mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
rustc: Make "ne" use traits
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user