1
Fork 0

rollup merge of #23633: tomjakubowski/rustdoc-array-prim

Previously, impls for `[T; n]` were collected in the same place as impls for `[T]` and `&[T]`. This splits them out into their own primitive page in both core and std.
This commit is contained in:
Alex Crichton 2015-03-23 15:11:06 -07:00
commit 19510ac70b
6 changed files with 38 additions and 10 deletions

View file

@ -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("!"),

View file

@ -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()))
}