From 2df8830642fffa6c68aa6318985cfcd2e63db81b Mon Sep 17 00:00:00 2001 From: Tom Jakubowski Date: Mon, 23 Mar 2015 14:01:28 -0700 Subject: rustdoc: Support for "array" primitive Impls on `clean::Type::FixedVector` are now collected in the array primitive page instead of the slice primitive page. Also add a primitive docs for arrays to `std`. --- src/librustdoc/html/format.rs | 2 +- src/librustdoc/html/render.rs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/librustdoc/html') diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 03a2d708ee4..0e6e008c616 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -486,7 +486,7 @@ impl fmt::Display for clean::Type { primitive_link(f, clean::Slice, &format!("[{}]", **t)) } clean::FixedVector(ref t, ref s) => { - primitive_link(f, clean::Slice, + primitive_link(f, clean::PrimitiveType::Array, &format!("[{}; {}]", **t, *s)) } clean::Bottom => f.write_str("!"), diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 81daac7b90f..2018de17e79 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1026,7 +1026,8 @@ impl DocFolder for Cache { match item { clean::Item{ attrs, inner: clean::ImplItem(i), .. } => { use clean::{Primitive, Vector, ResolvedPath, BorrowedRef}; - use clean::{FixedVector, Slice, Tuple, PrimitiveTuple}; + use clean::PrimitiveType::{Array, Slice, PrimitiveTuple}; + use clean::{FixedVector, Tuple}; // extract relevant documentation for this impl let dox = match attrs.into_iter().find(|a| { @@ -1056,12 +1057,16 @@ impl DocFolder for Cache { Some(ast_util::local_def(p.to_node_id())) } - // In a DST world, we may only need - // Vector/FixedVector, but for now we also pick up - // borrowed references - Vector(..) | FixedVector(..) | - BorrowedRef{ type_: box Vector(..), .. } | - BorrowedRef{ type_: box FixedVector(..), .. } => + FixedVector(..) | + BorrowedRef { type_: box FixedVector(..), .. } => + { + Some(ast_util::local_def(Array.to_node_id())) + } + + // In a DST world, we may only need Vector, but for now we + // also pick up borrowed references + Vector(..) | + BorrowedRef{ type_: box Vector(..), .. } => { Some(ast_util::local_def(Slice.to_node_id())) } -- cgit 1.4.1-3-g733a5