Skip to content

Commit

Permalink
auto merge of #12929 : sfackler/rust/automatically-derived, r=cmr
Browse files Browse the repository at this point in the history
This will enable rustdoc to treat them specially.

I also got rid of `std::cmp::cmp2`, which is isomorphic to the `TotalOrd` impl for 2-tuples and never used.
  • Loading branch information
bors committed Mar 16, 2014
2 parents d956975 + 05c7323 commit d73c899
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/librustc/middle/lint.rs
Expand Up @@ -985,7 +985,7 @@ static other_attrs: &'static [&'static str] = &[
"crate_map", "cfg", "doc", "export_name", "link_section",
"no_mangle", "static_assert", "unsafe_no_drop_flag", "packed",
"simd", "repr", "deriving", "unsafe_destructor", "link", "phase",
"macro_export", "must_use",
"macro_export", "must_use", "automatically_derived",

//mod-level
"path", "link_name", "link_args", "macro_escape", "no_implicit_prelude",
Expand Down
20 changes: 0 additions & 20 deletions src/libstd/cmp.rs
Expand Up @@ -130,18 +130,6 @@ totalord_impl!(uint)

totalord_impl!(char)

/// Compares (a1, b1) against (a2, b2), where the a values are more significant.
pub fn cmp2<A:TotalOrd,B:TotalOrd>(
a1: &A, b1: &B,
a2: &A, b2: &B) -> Ordering
{
match a1.cmp(a2) {
Less => Less,
Greater => Greater,
Equal => b1.cmp(b2)
}
}

/**
Return `o1` if it is not `Equal`, otherwise `o2`. Simulates the
lexical ordering on a type `(int, int)`.
Expand Down Expand Up @@ -206,14 +194,6 @@ mod test {
assert_eq!(12.cmp(-5), Greater);
}

#[test]
fn test_cmp2() {
assert_eq!(cmp2(1, 2, 3, 4), Less);
assert_eq!(cmp2(3, 2, 3, 4), Less);
assert_eq!(cmp2(5, 2, 3, 4), Greater);
assert_eq!(cmp2(5, 5, 5, 4), Greater);
}

#[test]
fn test_int_totaleq() {
assert!(5.equals(&5));
Expand Down
12 changes: 4 additions & 8 deletions src/libsyntax/ext/deriving/generic.rs
Expand Up @@ -186,7 +186,6 @@ use codemap;
use codemap::Span;
use opt_vec;
use parse::token::InternedString;
use parse::token;

use std::vec_ng::Vec;
use std::vec_ng;
Expand Down Expand Up @@ -399,19 +398,16 @@ impl<'a> TraitDef<'a> {
cx.path_all(self.span, false, vec!( type_ident ), self_lifetimes,
opt_vec::take_vec(self_ty_params)), None);

let doc_attr = cx.attribute(
let attr = cx.attribute(
self.span,
cx.meta_name_value(self.span,
InternedString::new("doc"),
ast::LitStr(token::intern_and_get_ident(
"Automatically derived."),
ast::CookedStr)));
cx.meta_word(self.span,
InternedString::new("automatically_derived")));
let opt_trait_ref = Some(trait_ref);
let ident = ast_util::impl_pretty_name(&opt_trait_ref, self_type);
cx.item(
self.span,
ident,
vec_ng::append(vec!(doc_attr), self.attributes.as_slice()),
vec_ng::append(vec!(attr), self.attributes.as_slice()),
ast::ItemImpl(trait_generics, opt_trait_ref,
self_type, methods.map(|x| *x)))
}
Expand Down

0 comments on commit d73c899

Please sign in to comment.