Skip to content

Commit 05c7323

Browse files
committed
Tag derived impls with #[automatically_derived]
This will enable rustdoc to treat them specially.
1 parent 2c37220 commit 05c7323

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
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/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)