auto merge of #14592 : alexcrichton/rust/rustdoc-links, r=huonw
These are a few assorted fixes for some issues I found this morning (details in the commits).
This commit is contained in:
commit
073c8f10fc
|
@ -110,7 +110,7 @@ HTML_DEPS += doc/version_info.html
|
||||||
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
|
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
|
||||||
$(wildcard $(D)/*.*) | doc/
|
$(wildcard $(D)/*.*) | doc/
|
||||||
@$(call E, version-info: $@)
|
@$(call E, version-info: $@)
|
||||||
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
|
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
|
||||||
$(CFG_VER_HASH) | head -c 8)/;\
|
$(CFG_VER_HASH) | head -c 8)/;\
|
||||||
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
|
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
|
||||||
|
|
||||||
|
@ -156,7 +156,9 @@ doc/footer.tex: $(D)/footer.inc | doc/
|
||||||
# HTML (rustdoc)
|
# HTML (rustdoc)
|
||||||
DOC_TARGETS += doc/not_found.html
|
DOC_TARGETS += doc/not_found.html
|
||||||
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
|
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
|
||||||
$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css http://doc.rust-lang.org/rust.css $<
|
@$(call E, rustdoc: $@)
|
||||||
|
$(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
|
||||||
|
--markdown-css http://doc.rust-lang.org/rust.css $<
|
||||||
|
|
||||||
define DEF_DOC
|
define DEF_DOC
|
||||||
|
|
||||||
|
@ -164,7 +166,7 @@ define DEF_DOC
|
||||||
DOC_TARGETS += doc/$(1).html
|
DOC_TARGETS += doc/$(1).html
|
||||||
doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
|
doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
|
||||||
@$$(call E, rustdoc: $$@)
|
@$$(call E, rustdoc: $$@)
|
||||||
$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
|
$$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
|
||||||
|
|
||||||
ifneq ($(ONLY_HTML_DOCS),1)
|
ifneq ($(ONLY_HTML_DOCS),1)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ li {list-style-type: none; }
|
||||||
* [The `time` library](time/index.html)
|
* [The `time` library](time/index.html)
|
||||||
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
|
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
|
||||||
* [The `url` library](url/index.html)
|
* [The `url` library](url/index.html)
|
||||||
* [The `workcache` library](workcache/index.html)
|
|
||||||
* [The `log` library](log/index.html)
|
* [The `log` library](log/index.html)
|
||||||
|
|
||||||
# Tooling
|
# Tooling
|
||||||
|
|
|
@ -14,11 +14,9 @@
|
||||||
//! These definitions are similar to their `ct` equivalents, but differ in that
|
//! These definitions are similar to their `ct` equivalents, but differ in that
|
||||||
//! these can be statically allocated and are slightly optimized for the runtime
|
//! these can be statically allocated and are slightly optimized for the runtime
|
||||||
|
|
||||||
#![allow(missing_doc)]
|
|
||||||
#![doc(hidden)]
|
|
||||||
|
|
||||||
use option::Option;
|
use option::Option;
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum Piece<'a> {
|
pub enum Piece<'a> {
|
||||||
String(&'a str),
|
String(&'a str),
|
||||||
// FIXME(#8259): this shouldn't require the unit-value here
|
// FIXME(#8259): this shouldn't require the unit-value here
|
||||||
|
@ -26,12 +24,14 @@ pub enum Piece<'a> {
|
||||||
Argument(Argument<'a>),
|
Argument(Argument<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub struct Argument<'a> {
|
pub struct Argument<'a> {
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
pub format: FormatSpec,
|
pub format: FormatSpec,
|
||||||
pub method: Option<&'a Method<'a>>
|
pub method: Option<&'a Method<'a>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub struct FormatSpec {
|
pub struct FormatSpec {
|
||||||
pub fill: char,
|
pub fill: char,
|
||||||
pub align: Alignment,
|
pub align: Alignment,
|
||||||
|
@ -40,38 +40,60 @@ pub struct FormatSpec {
|
||||||
pub width: Count,
|
pub width: Count,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Possible alignments that can be requested as part of a formatting directive.
|
||||||
#[deriving(PartialEq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum Alignment {
|
pub enum Alignment {
|
||||||
|
/// Indication that contents should be left-aligned.
|
||||||
AlignLeft,
|
AlignLeft,
|
||||||
|
/// Indication that contents should be right-aligned.
|
||||||
AlignRight,
|
AlignRight,
|
||||||
|
/// No alignment was requested.
|
||||||
AlignUnknown,
|
AlignUnknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum Count {
|
pub enum Count {
|
||||||
CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
|
CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum Position {
|
pub enum Position {
|
||||||
ArgumentNext, ArgumentIs(uint)
|
ArgumentNext, ArgumentIs(uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Flags which can be passed to formatting via a directive.
|
||||||
|
///
|
||||||
|
/// These flags are discovered through the `flags` field of the `Formatter`
|
||||||
|
/// structure. The flag in that structure is a union of these flags into a
|
||||||
|
/// `uint` where each flag's discriminant is the corresponding bit.
|
||||||
pub enum Flag {
|
pub enum Flag {
|
||||||
|
/// A flag which enables number formatting to always print the sign of a
|
||||||
|
/// number.
|
||||||
FlagSignPlus,
|
FlagSignPlus,
|
||||||
|
/// Currently not a used flag
|
||||||
FlagSignMinus,
|
FlagSignMinus,
|
||||||
|
/// Indicates that the "alternate formatting" for a type should be used.
|
||||||
|
///
|
||||||
|
/// The meaning of this flag is type-specific.
|
||||||
FlagAlternate,
|
FlagAlternate,
|
||||||
|
/// Indicates that padding should be done with a `0` character as well as
|
||||||
|
/// being aware of the sign to be printed.
|
||||||
FlagSignAwareZeroPad,
|
FlagSignAwareZeroPad,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum Method<'a> {
|
pub enum Method<'a> {
|
||||||
Plural(Option<uint>, &'a [PluralArm<'a>], &'a [Piece<'a>]),
|
Plural(Option<uint>, &'a [PluralArm<'a>], &'a [Piece<'a>]),
|
||||||
Select(&'a [SelectArm<'a>], &'a [Piece<'a>]),
|
Select(&'a [SelectArm<'a>], &'a [Piece<'a>]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum PluralSelector {
|
pub enum PluralSelector {
|
||||||
Keyword(PluralKeyword),
|
Keyword(PluralKeyword),
|
||||||
Literal(uint),
|
Literal(uint),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub enum PluralKeyword {
|
pub enum PluralKeyword {
|
||||||
Zero,
|
Zero,
|
||||||
One,
|
One,
|
||||||
|
@ -80,11 +102,13 @@ pub enum PluralKeyword {
|
||||||
Many,
|
Many,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub struct PluralArm<'a> {
|
pub struct PluralArm<'a> {
|
||||||
pub selector: PluralSelector,
|
pub selector: PluralSelector,
|
||||||
pub result: &'a [Piece<'a>],
|
pub result: &'a [Piece<'a>],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
pub struct SelectArm<'a> {
|
pub struct SelectArm<'a> {
|
||||||
pub selector: &'a str,
|
pub selector: &'a str,
|
||||||
pub result: &'a [Piece<'a>],
|
pub result: &'a [Piece<'a>],
|
||||||
|
|
|
@ -129,7 +129,7 @@ pub fn record_extern_fqn(cx: &core::DocContext,
|
||||||
match cx.maybe_typed {
|
match cx.maybe_typed {
|
||||||
core::Typed(ref tcx) => {
|
core::Typed(ref tcx) => {
|
||||||
let fqn = csearch::get_item_path(tcx, did);
|
let fqn = csearch::get_item_path(tcx, did);
|
||||||
let fqn = fqn.move_iter().map(|i| i.to_str().to_string()).collect();
|
let fqn = fqn.move_iter().map(|i| i.to_str()).collect();
|
||||||
cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, kind));
|
cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, kind));
|
||||||
}
|
}
|
||||||
core::NotTyped(..) => {}
|
core::NotTyped(..) => {}
|
||||||
|
@ -138,10 +138,18 @@ pub fn record_extern_fqn(cx: &core::DocContext,
|
||||||
|
|
||||||
pub fn build_external_trait(tcx: &ty::ctxt, did: ast::DefId) -> clean::Trait {
|
pub fn build_external_trait(tcx: &ty::ctxt, did: ast::DefId) -> clean::Trait {
|
||||||
let def = ty::lookup_trait_def(tcx, did);
|
let def = ty::lookup_trait_def(tcx, did);
|
||||||
let methods = ty::trait_methods(tcx, did);
|
let methods = ty::trait_methods(tcx, did).clean();
|
||||||
|
let provided = ty::provided_trait_methods(tcx, did);
|
||||||
|
let mut methods = methods.move_iter().map(|meth| {
|
||||||
|
if provided.iter().any(|a| a.def_id == meth.def_id) {
|
||||||
|
clean::Provided(meth)
|
||||||
|
} else {
|
||||||
|
clean::Required(meth)
|
||||||
|
}
|
||||||
|
});
|
||||||
clean::Trait {
|
clean::Trait {
|
||||||
generics: def.generics.clean(),
|
generics: def.generics.clean(),
|
||||||
methods: methods.iter().map(|i| i.clean()).collect(),
|
methods: methods.collect(),
|
||||||
parents: Vec::new(), // FIXME: this is likely wrong
|
parents: Vec::new(), // FIXME: this is likely wrong
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +215,7 @@ fn build_impls(cx: &core::DocContext,
|
||||||
match tcx.inherent_impls.borrow().find(&did) {
|
match tcx.inherent_impls.borrow().find(&did) {
|
||||||
None => {}
|
None => {}
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
impls.extend(i.borrow().iter().map(|&did| { build_impl(tcx, did) }));
|
impls.extend(i.borrow().iter().map(|&did| { build_impl(cx, tcx, did) }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,19 +231,20 @@ fn build_impls(cx: &core::DocContext,
|
||||||
csearch::each_top_level_item_of_crate(&tcx.sess.cstore,
|
csearch::each_top_level_item_of_crate(&tcx.sess.cstore,
|
||||||
did.krate,
|
did.krate,
|
||||||
|def, _, _| {
|
|def, _, _| {
|
||||||
populate_impls(tcx, def, &mut impls)
|
populate_impls(cx, tcx, def, &mut impls)
|
||||||
});
|
});
|
||||||
|
|
||||||
fn populate_impls(tcx: &ty::ctxt,
|
fn populate_impls(cx: &core::DocContext,
|
||||||
|
tcx: &ty::ctxt,
|
||||||
def: decoder::DefLike,
|
def: decoder::DefLike,
|
||||||
impls: &mut Vec<clean::Item>) {
|
impls: &mut Vec<Option<clean::Item>>) {
|
||||||
match def {
|
match def {
|
||||||
decoder::DlImpl(did) => impls.push(build_impl(tcx, did)),
|
decoder::DlImpl(did) => impls.push(build_impl(cx, tcx, did)),
|
||||||
decoder::DlDef(ast::DefMod(did)) => {
|
decoder::DlDef(ast::DefMod(did)) => {
|
||||||
csearch::each_child_of_item(&tcx.sess.cstore,
|
csearch::each_child_of_item(&tcx.sess.cstore,
|
||||||
did,
|
did,
|
||||||
|def, _, _| {
|
|def, _, _| {
|
||||||
populate_impls(tcx, def, impls)
|
populate_impls(cx, tcx, def, impls)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -243,18 +252,26 @@ fn build_impls(cx: &core::DocContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impls
|
impls.move_iter().filter_map(|a| a).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
|
fn build_impl(cx: &core::DocContext,
|
||||||
|
tcx: &ty::ctxt,
|
||||||
|
did: ast::DefId) -> Option<clean::Item> {
|
||||||
|
if !cx.inlined.borrow_mut().get_mut_ref().insert(did) {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
|
||||||
let associated_trait = csearch::get_impl_trait(tcx, did);
|
let associated_trait = csearch::get_impl_trait(tcx, did);
|
||||||
let attrs = load_attrs(tcx, did);
|
let attrs = load_attrs(tcx, did);
|
||||||
let ty = ty::lookup_item_type(tcx, did);
|
let ty = ty::lookup_item_type(tcx, did);
|
||||||
let methods = csearch::get_impl_methods(&tcx.sess.cstore, did).iter().map(|did| {
|
let methods = csearch::get_impl_methods(&tcx.sess.cstore,
|
||||||
let mut item = match ty::method(tcx, *did).clean() {
|
did).iter().filter_map(|did| {
|
||||||
clean::Provided(item) => item,
|
let method = ty::method(tcx, *did);
|
||||||
clean::Required(item) => item,
|
if method.vis != ast::Public && associated_trait.is_none() {
|
||||||
};
|
return None
|
||||||
|
}
|
||||||
|
let mut item = ty::method(tcx, *did).clean();
|
||||||
item.inner = match item.inner.clone() {
|
item.inner = match item.inner.clone() {
|
||||||
clean::TyMethodItem(clean::TyMethod {
|
clean::TyMethodItem(clean::TyMethod {
|
||||||
fn_style, decl, self_, generics
|
fn_style, decl, self_, generics
|
||||||
|
@ -268,9 +285,9 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
|
||||||
}
|
}
|
||||||
_ => fail!("not a tymethod"),
|
_ => fail!("not a tymethod"),
|
||||||
};
|
};
|
||||||
item
|
Some(item)
|
||||||
}).collect();
|
}).collect();
|
||||||
clean::Item {
|
Some(clean::Item {
|
||||||
inner: clean::ImplItem(clean::Impl {
|
inner: clean::ImplItem(clean::Impl {
|
||||||
derived: clean::detect_derived(attrs.as_slice()),
|
derived: clean::detect_derived(attrs.as_slice()),
|
||||||
trait_: associated_trait.clean().map(|bound| {
|
trait_: associated_trait.clean().map(|bound| {
|
||||||
|
@ -288,7 +305,7 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> clean::Item {
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
visibility: Some(ast::Inherited),
|
visibility: Some(ast::Inherited),
|
||||||
def_id: did,
|
def_id: did,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_module(cx: &core::DocContext, tcx: &ty::ctxt,
|
fn build_module(cx: &core::DocContext, tcx: &ty::ctxt,
|
||||||
|
|
|
@ -93,6 +93,7 @@ impl<'a> Clean<Crate> for visit_ast::RustdocVisitor<'a> {
|
||||||
cx.sess().cstore.iter_crate_data(|n, meta| {
|
cx.sess().cstore.iter_crate_data(|n, meta| {
|
||||||
externs.push((n, meta.clean()));
|
externs.push((n, meta.clean()));
|
||||||
});
|
});
|
||||||
|
externs.sort_by(|&(a, _), &(b, _)| a.cmp(&b));
|
||||||
|
|
||||||
// Figure out the name of this crate
|
// Figure out the name of this crate
|
||||||
let input = driver::FileInput(cx.src.clone());
|
let input = driver::FileInput(cx.src.clone());
|
||||||
|
@ -132,24 +133,33 @@ impl<'a> Clean<Crate> for visit_ast::RustdocVisitor<'a> {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let mut tmp = Vec::new();
|
let mut tmp = Vec::new();
|
||||||
for child in m.items.iter() {
|
for child in m.items.mut_iter() {
|
||||||
match child.inner {
|
let inner = match child.inner {
|
||||||
ModuleItem(..) => {},
|
ModuleItem(ref mut m) => m,
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
};
|
||||||
let prim = match Primitive::find(child.attrs.as_slice()) {
|
let prim = match Primitive::find(child.attrs.as_slice()) {
|
||||||
Some(prim) => prim,
|
Some(prim) => prim,
|
||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
primitives.push(prim);
|
primitives.push(prim);
|
||||||
tmp.push(Item {
|
let mut i = Item {
|
||||||
source: Span::empty(),
|
source: Span::empty(),
|
||||||
name: Some(prim.to_url_str().to_string()),
|
name: Some(prim.to_url_str().to_string()),
|
||||||
attrs: child.attrs.clone(),
|
attrs: Vec::new(),
|
||||||
visibility: Some(ast::Public),
|
visibility: None,
|
||||||
def_id: ast_util::local_def(prim.to_node_id()),
|
def_id: ast_util::local_def(prim.to_node_id()),
|
||||||
inner: PrimitiveItem(prim),
|
inner: PrimitiveItem(prim),
|
||||||
});
|
};
|
||||||
|
// Push one copy to get indexed for the whole crate, and push a
|
||||||
|
// another copy in the proper location which will actually get
|
||||||
|
// documented. The first copy will also serve as a redirect to
|
||||||
|
// the other copy.
|
||||||
|
tmp.push(i.clone());
|
||||||
|
i.visibility = Some(ast::Public);
|
||||||
|
i.attrs = child.attrs.clone();
|
||||||
|
inner.items.push(i);
|
||||||
|
|
||||||
}
|
}
|
||||||
m.items.extend(tmp.move_iter());
|
m.items.extend(tmp.move_iter());
|
||||||
}
|
}
|
||||||
|
@ -942,9 +952,8 @@ impl Clean<TraitMethod> for ast::TraitMethod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<TraitMethod> for ty::Method {
|
impl Clean<Item> for ty::Method {
|
||||||
fn clean(&self) -> TraitMethod {
|
fn clean(&self) -> Item {
|
||||||
let m = if self.provided_source.is_some() {Provided} else {Required};
|
|
||||||
let cx = super::ctxtkey.get().unwrap();
|
let cx = super::ctxtkey.get().unwrap();
|
||||||
let tcx = match cx.maybe_typed {
|
let tcx = match cx.maybe_typed {
|
||||||
core::Typed(ref tcx) => tcx,
|
core::Typed(ref tcx) => tcx,
|
||||||
|
@ -972,7 +981,7 @@ impl Clean<TraitMethod> for ty::Method {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
m(Item {
|
Item {
|
||||||
name: Some(self.ident.clean()),
|
name: Some(self.ident.clean()),
|
||||||
visibility: Some(ast::Inherited),
|
visibility: Some(ast::Inherited),
|
||||||
def_id: self.def_id,
|
def_id: self.def_id,
|
||||||
|
@ -984,7 +993,7 @@ impl Clean<TraitMethod> for ty::Method {
|
||||||
self_: self_,
|
self_: self_,
|
||||||
decl: (self.def_id, &sig).clean(),
|
decl: (self.def_id, &sig).clean(),
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ pub enum ExternalLocation {
|
||||||
|
|
||||||
/// Metadata about an implementor of a trait.
|
/// Metadata about an implementor of a trait.
|
||||||
pub struct Implementor {
|
pub struct Implementor {
|
||||||
|
def_id: ast::DefId,
|
||||||
generics: clean::Generics,
|
generics: clean::Generics,
|
||||||
trait_: clean::Type,
|
trait_: clean::Type,
|
||||||
for_: clean::Type,
|
for_: clean::Type,
|
||||||
|
@ -531,6 +532,11 @@ fn write_shared(cx: &Context,
|
||||||
|
|
||||||
try!(write!(&mut f, r"implementors['{}'] = [", krate.name));
|
try!(write!(&mut f, r"implementors['{}'] = [", krate.name));
|
||||||
for imp in imps.iter() {
|
for imp in imps.iter() {
|
||||||
|
// If the trait and implementation are in the same crate, then
|
||||||
|
// there's no need to emit information about it (there's inlining
|
||||||
|
// going on). If they're in different crates then the crate defining
|
||||||
|
// the trait will be interested in our implementation.
|
||||||
|
if imp.def_id.krate == did.krate { continue }
|
||||||
try!(write!(&mut f, r#""impl{} {} for {}","#,
|
try!(write!(&mut f, r#""impl{} {} for {}","#,
|
||||||
imp.generics, imp.trait_, imp.for_));
|
imp.generics, imp.trait_, imp.for_));
|
||||||
}
|
}
|
||||||
|
@ -759,6 +765,7 @@ impl DocFolder for Cache {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
});
|
});
|
||||||
v.push(Implementor {
|
v.push(Implementor {
|
||||||
|
def_id: item.def_id,
|
||||||
generics: i.generics.clone(),
|
generics: i.generics.clone(),
|
||||||
trait_: i.trait_.get_ref().clone(),
|
trait_: i.trait_.get_ref().clone(),
|
||||||
for_: i.for_.clone(),
|
for_: i.for_.clone(),
|
||||||
|
@ -860,6 +867,12 @@ impl DocFolder for Cache {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
self.paths.insert(item.def_id, (stack, item_type::Enum));
|
self.paths.insert(item.def_id, (stack, item_type::Enum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean::PrimitiveItem(..) if item.visibility.is_some() => {
|
||||||
|
self.paths.insert(item.def_id, (self.stack.clone(),
|
||||||
|
shortty(&item)));
|
||||||
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,21 +1088,21 @@ impl Context {
|
||||||
writer.flush()
|
writer.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Private modules may survive the strip-private pass if they
|
||||||
|
// contain impls for public types. These modules can also
|
||||||
|
// contain items such as publicly reexported structures.
|
||||||
|
//
|
||||||
|
// External crates will provide links to these structures, so
|
||||||
|
// these modules are recursed into, but not rendered normally (a
|
||||||
|
// flag on the context).
|
||||||
|
if !self.render_redirect_pages {
|
||||||
|
self.render_redirect_pages = ignore_private_item(&item);
|
||||||
|
}
|
||||||
|
|
||||||
match item.inner {
|
match item.inner {
|
||||||
// modules are special because they add a namespace. We also need to
|
// modules are special because they add a namespace. We also need to
|
||||||
// recurse into the items of the module as well.
|
// recurse into the items of the module as well.
|
||||||
clean::ModuleItem(..) => {
|
clean::ModuleItem(..) => {
|
||||||
// Private modules may survive the strip-private pass if they
|
|
||||||
// contain impls for public types. These modules can also
|
|
||||||
// contain items such as publicly reexported structures.
|
|
||||||
//
|
|
||||||
// External crates will provide links to these structures, so
|
|
||||||
// these modules are recursed into, but not rendered normally (a
|
|
||||||
// flag on the context).
|
|
||||||
if !self.render_redirect_pages {
|
|
||||||
self.render_redirect_pages = ignore_private_module(&item);
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = item.name.get_ref().to_string();
|
let name = item.name.get_ref().to_string();
|
||||||
let mut item = Some(item);
|
let mut item = Some(item);
|
||||||
self.recurse(name, |this| {
|
self.recurse(name, |this| {
|
||||||
|
@ -1323,7 +1336,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
|
||||||
item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
|
item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
|
||||||
try!(document(w, item));
|
try!(document(w, item));
|
||||||
let mut indices = range(0, items.len()).filter(|i| {
|
let mut indices = range(0, items.len()).filter(|i| {
|
||||||
!ignore_private_module(&items[*i])
|
!ignore_private_item(&items[*i])
|
||||||
}).collect::<Vec<uint>>();
|
}).collect::<Vec<uint>>();
|
||||||
|
|
||||||
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
|
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
|
||||||
|
@ -2009,7 +2022,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
|
||||||
fn build_sidebar(m: &clean::Module) -> HashMap<String, Vec<String>> {
|
fn build_sidebar(m: &clean::Module) -> HashMap<String, Vec<String>> {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
for item in m.items.iter() {
|
for item in m.items.iter() {
|
||||||
if ignore_private_module(item) { continue }
|
if ignore_private_item(item) { continue }
|
||||||
|
|
||||||
let short = shortty(item).to_static_str();
|
let short = shortty(item).to_static_str();
|
||||||
let myname = match item.name {
|
let myname = match item.name {
|
||||||
|
@ -2059,12 +2072,13 @@ fn item_primitive(w: &mut fmt::Formatter,
|
||||||
render_methods(w, it)
|
render_methods(w, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ignore_private_module(it: &clean::Item) -> bool {
|
fn ignore_private_item(it: &clean::Item) -> bool {
|
||||||
match it.inner {
|
match it.inner {
|
||||||
clean::ModuleItem(ref m) => {
|
clean::ModuleItem(ref m) => {
|
||||||
(m.items.len() == 0 && it.doc_value().is_none()) ||
|
(m.items.len() == 0 && it.doc_value().is_none()) ||
|
||||||
it.visibility != Some(ast::Public)
|
it.visibility != Some(ast::Public)
|
||||||
}
|
}
|
||||||
|
clean::PrimitiveItem(..) => it.visibility != Some(ast::Public),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,10 @@
|
||||||
for (var j = 0; j < structs.length; j++) {
|
for (var j = 0; j < structs.length; j++) {
|
||||||
var code = $('<code>').append(structs[j]);
|
var code = $('<code>').append(structs[j]);
|
||||||
$.each(code.find('a'), function(idx, a) {
|
$.each(code.find('a'), function(idx, a) {
|
||||||
$(a).attr('href', rootPath + $(a).attr('href'));
|
var href = $(a).attr('href');
|
||||||
|
if (!href.startsWith('http')) {
|
||||||
|
$(a).attr('href', rootPath + $(a).attr('href'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var li = $('<li>').append(code);
|
var li = $('<li>').append(code);
|
||||||
list.append(li);
|
list.append(li);
|
||||||
|
|
Loading…
Reference in New Issue