Skip to content

Commit d73c899

Browse files
committed
auto merge of #12929 : sfackler/rust/automatically-derived, r=cmr
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.
2 parents d956975 + 05c7323 commit d73c899

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

src/librustc/middle/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ static other_attrs: &'static [&'static str] = &[
985985
"crate_map", "cfg", "doc", "export_name", "link_section",
986986
"no_mangle", "static_assert", "unsafe_no_drop_flag", "packed",
987987
"simd", "repr", "deriving", "unsafe_destructor", "link", "phase",
988-
"macro_export", "must_use",
988+
"macro_export", "must_use", "automatically_derived",
989989

990990
//mod-level
991991
"path", "link_name", "link_args", "macro_escape", "no_implicit_prelude",

src/libstd/cmp.rs

-20
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,6 @@ totalord_impl!(uint)
130130

131131
totalord_impl!(char)
132132

133-
/// Compares (a1, b1) against (a2, b2), where the a values are more significant.
134-
pub fn cmp2<A:TotalOrd,B:TotalOrd>(
135-
a1: &A, b1: &B,
136-
a2: &A, b2: &B) -> Ordering
137-
{
138-
match a1.cmp(a2) {
139-
Less => Less,
140-
Greater => Greater,
141-
Equal => b1.cmp(b2)
142-
}
143-
}
144-
145133
/**
146134
Return `o1` if it is not `Equal`, otherwise `o2`. Simulates the
147135
lexical ordering on a type `(int, int)`.
@@ -206,14 +194,6 @@ mod test {
206194
assert_eq!(12.cmp(-5), Greater);
207195
}
208196

209-
#[test]
210-
fn test_cmp2() {
211-
assert_eq!(cmp2(1, 2, 3, 4), Less);
212-
assert_eq!(cmp2(3, 2, 3, 4), Less);
213-
assert_eq!(cmp2(5, 2, 3, 4), Greater);
214-
assert_eq!(cmp2(5, 5, 5, 4), Greater);
215-
}
216-
217197
#[test]
218198
fn test_int_totaleq() {
219199
assert!(5.equals(&5));

src/libsyntax/ext/deriving/generic.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ use codemap;
186186
use codemap::Span;
187187
use opt_vec;
188188
use parse::token::InternedString;
189-
use parse::token;
190189

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

402-
let doc_attr = cx.attribute(
401+
let attr = cx.attribute(
403402
self.span,
404-
cx.meta_name_value(self.span,
405-
InternedString::new("doc"),
406-
ast::LitStr(token::intern_and_get_ident(
407-
"Automatically derived."),
408-
ast::CookedStr)));
403+
cx.meta_word(self.span,
404+
InternedString::new("automatically_derived")));
409405
let opt_trait_ref = Some(trait_ref);
410406
let ident = ast_util::impl_pretty_name(&opt_trait_ref, self_type);
411407
cx.item(
412408
self.span,
413409
ident,
414-
vec_ng::append(vec!(doc_attr), self.attributes.as_slice()),
410+
vec_ng::append(vec!(attr), self.attributes.as_slice()),
415411
ast::ItemImpl(trait_generics, opt_trait_ref,
416412
self_type, methods.map(|x| *x)))
417413
}

0 commit comments

Comments
 (0)