From 4ddb541818dd700fdbee8e569ad53e3a24cefc04 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Fri, 3 Jun 2016 22:59:45 +0100 Subject: [PATCH] rustdoc: Fix generating redirect pages for statics and consts These were missing from the cache for some reason meaning the redirect pages failed to render. --- src/librustdoc/html/render.rs | 4 +++- src/test/rustdoc/redirect-const.rs | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc/redirect-const.rs diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 396f71173f834..34f56c95ecf28 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1120,7 +1120,9 @@ impl DocFolder for Cache { clean::StructItem(..) | clean::EnumItem(..) | clean::TypedefItem(..) | clean::TraitItem(..) | clean::FunctionItem(..) | clean::ModuleItem(..) | - clean::ForeignFunctionItem(..) if !self.stripped_mod => { + clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) | + clean::ConstantItem(..) | clean::StaticItem(..) + if !self.stripped_mod => { // Reexported items mean that the same id can show up twice // in the rustdoc ast that we're looking at. We know, // however, that a reexported item doesn't show up in the diff --git a/src/test/rustdoc/redirect-const.rs b/src/test/rustdoc/redirect-const.rs new file mode 100644 index 0000000000000..c95e5537c8879 --- /dev/null +++ b/src/test/rustdoc/redirect-const.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="foo"] + +pub use hidden::STATIC_FOO; +pub use hidden::CONST_FOO; + +mod hidden { + // @has foo/hidden/static.STATIC_FOO.html + // @has - '//p/a' '../../foo/static.STATIC_FOO.html' + pub static STATIC_FOO: u64 = 0; + // @has foo/hidden/constant.CONST_FOO.html + // @has - '//p/a' '../../foo/constant.CONST_FOO.html' + pub const CONST_FOO: u64 = 0; +}