Skip to content

Commit 9272f9c

Browse files
committed
---
yaml --- r: 125900 b: refs/heads/try c: 724bcec h: refs/heads/master v: v3
1 parent 6b64692 commit 9272f9c

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: 51355478f42c398e41a9b78bfcf93b00a93c7f1e
5+
refs/heads/try: 724bcec089b34ede9b09aa72dac78ab554516603
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/fmt/num.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use iter::Iterator; // NOTE(stage0): Remove after snapshot.
2626
use option::{Some, None}; // NOTE(stage0): Remove after snapshot.
2727

2828
/// A type that represents a specific radix
29+
#[doc(hidden)]
2930
trait GenericRadix {
3031
/// The number of digits.
3132
fn base(&self) -> u8;

branches/try/src/librustdoc/clean/inline.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,17 @@ fn build_impl(cx: &core::DocContext,
278278
}
279279

280280
let associated_trait = csearch::get_impl_trait(tcx, did);
281+
// If this is an impl for a #[doc(hidden)] trait, be sure to not inline it.
282+
match associated_trait {
283+
Some(ref t) => {
284+
let trait_attrs = load_attrs(tcx, t.def_id);
285+
if trait_attrs.iter().any(|a| is_doc_hidden(a)) {
286+
return None
287+
}
288+
}
289+
None => {}
290+
}
291+
281292
let attrs = load_attrs(tcx, did);
282293
let ty = ty::lookup_item_type(tcx, did);
283294
let methods = csearch::get_impl_methods(&tcx.sess.cstore,
@@ -302,7 +313,7 @@ fn build_impl(cx: &core::DocContext,
302313
};
303314
Some(item)
304315
}).collect();
305-
Some(clean::Item {
316+
return Some(clean::Item {
306317
inner: clean::ImplItem(clean::Impl {
307318
derived: clean::detect_derived(attrs.as_slice()),
308319
trait_: associated_trait.clean().map(|bound| {
@@ -321,7 +332,21 @@ fn build_impl(cx: &core::DocContext,
321332
visibility: Some(ast::Inherited),
322333
stability: stability::lookup(tcx, did).clean(),
323334
def_id: did,
324-
})
335+
});
336+
337+
fn is_doc_hidden(a: &clean::Attribute) -> bool {
338+
match *a {
339+
clean::List(ref name, ref inner) if name.as_slice() == "doc" => {
340+
inner.iter().any(|a| {
341+
match *a {
342+
clean::Word(ref s) => s.as_slice() == "hidden",
343+
_ => false,
344+
}
345+
})
346+
}
347+
_ => false
348+
}
349+
}
325350
}
326351

327352
fn build_module(cx: &core::DocContext, tcx: &ty::ctxt,

0 commit comments

Comments
 (0)