Skip to content

Commit a444c4f

Browse files
committed
std: Remove assert_receiver_is_total_eq
I think that deriving must have made progress since it was originally written, this was a pretty easy change! Closes rust-lang#13101
1 parent 4b40bc8 commit a444c4f

File tree

4 files changed

+6
-46
lines changed

4 files changed

+6
-46
lines changed

src/libcore/cmp.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,8 @@ pub trait PartialEq<Sized? Rhs = Self> for Sized? {
9191
/// - transitive: `a == b` and `b == c` implies `a == c`.
9292
#[stable]
9393
pub trait Eq for Sized?: PartialEq<Self> {
94-
// FIXME #13101: this method is used solely by #[deriving] to
95-
// assert that every component of a type implements #[deriving]
96-
// itself, the current deriving infrastructure means doing this
97-
// assertion without using a method on this trait is nearly
98-
// impossible.
99-
//
100-
// This should never be implemented by hand.
101-
#[doc(hidden)]
102-
#[inline(always)]
94+
#[cfg(stage0)]
95+
#[allow(missing_docs)]
10396
fn assert_receiver_is_total_eq(&self) {}
10497
}
10598

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145

146146
use self::Option::*;
147147

148-
use cmp::{Eq, Ord};
148+
use cmp::Ord;
149149
use default::Default;
150150
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator};
151151
use iter::{ExactSizeIterator};

src/libcore/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
use self::Searcher::{Naive, TwoWay, TwoWayLong};
2020

21-
use cmp::{mod, Eq};
21+
use cmp;
2222
use default::Default;
2323
use iter::range;
2424
use iter::{DoubleEndedIteratorExt, ExactSizeIterator};

src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item, Expr};
11+
use ast::{MetaItem, Item};
1212
use codemap::Span;
1313
use ext::base::ExtCtxt;
14-
use ext::build::AstBuilder;
1514
use ext::deriving::generic::*;
1615
use ext::deriving::generic::ty::*;
17-
use parse::token::InternedString;
1816
use ptr::P;
1917

2018
pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
@@ -24,44 +22,13 @@ pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
2422
push: F) where
2523
F: FnOnce(P<Item>),
2624
{
27-
fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> {
28-
cs_same_method(|cx, span, exprs| {
29-
// create `a.<method>(); b.<method>(); c.<method>(); ...`
30-
// (where method is `assert_receiver_is_total_eq`)
31-
let stmts = exprs.into_iter().map(|e| cx.stmt_expr(e)).collect();
32-
let block = cx.block(span, stmts, None);
33-
cx.expr_block(block)
34-
},
35-
|cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"),
36-
cx,
37-
span,
38-
substr)
39-
}
40-
41-
let inline = cx.meta_word(span, InternedString::new("inline"));
42-
let hidden = cx.meta_word(span, InternedString::new("hidden"));
43-
let doc = cx.meta_list(span, InternedString::new("doc"), vec!(hidden));
44-
let attrs = vec!(cx.attribute(span, inline),
45-
cx.attribute(span, doc));
4625
let trait_def = TraitDef {
4726
span: span,
4827
attributes: Vec::new(),
4928
path: Path::new(vec!("std", "cmp", "Eq")),
5029
additional_bounds: Vec::new(),
5130
generics: LifetimeBounds::empty(),
52-
methods: vec!(
53-
MethodDef {
54-
name: "assert_receiver_is_total_eq",
55-
generics: LifetimeBounds::empty(),
56-
explicit_self: borrowed_explicit_self(),
57-
args: vec!(),
58-
ret_ty: nil_ty(),
59-
attributes: attrs,
60-
combine_substructure: combine_substructure(|a, b, c| {
61-
cs_total_eq_assert(a, b, c)
62-
})
63-
}
64-
)
31+
methods: Vec::new(),
6532
};
6633
trait_def.expand(cx, mitem, item, push)
6734
}

0 commit comments

Comments
 (0)