diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-04-05 16:43:21 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-04-05 16:43:21 +0530 |
| commit | bb561dac996d13174ac5286cd94ec8ab49dd97eb (patch) | |
| tree | 9b074e01611864838413b73ce9ff4a45731ad066 /src/test | |
| parent | 3c4d5f92281eefecba5885d09e4981691bbb8e0b (diff) | |
| parent | 95eb8a68aa38ebeaadcca337d6005efabcf4a05e (diff) | |
| download | rust-bb561dac996d13174ac5286cd94ec8ab49dd97eb.tar.gz rust-bb561dac996d13174ac5286cd94ec8ab49dd97eb.zip | |
Rollup merge of #32678 - mitaa:rdoc-stripped, r=alexcrichton
rustdoc: make rustdoc less pass-aware Instead of hardcoding knowledge about the strip-private pass into the rendering process we represent (some) stripped items as `ItemEnum::StrippedItem`. Rustdoc will, for example, generate redirect pages for public items contained in private modules which have been re-exported to somewhere externally reachable - this will now not only work for the `strip-private` pass, but for other passes as well, such as the `strip-hidden` pass. r? @alexcrichton
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/auxiliary/reexp_stripped.rs | 21 | ||||
| -rw-r--r-- | src/test/rustdoc/redirect.rs | 48 | ||||
| -rw-r--r-- | src/test/rustdoc/structfields.rs | 44 |
3 files changed, 113 insertions, 0 deletions
diff --git a/src/test/auxiliary/reexp_stripped.rs b/src/test/auxiliary/reexp_stripped.rs new file mode 100644 index 00000000000..2b061e3997d --- /dev/null +++ b/src/test/auxiliary/reexp_stripped.rs @@ -0,0 +1,21 @@ +// 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use private::Quz; +pub use hidden::Bar; + +mod private { + pub struct Quz; +} + +#[doc(hidden)] +pub mod hidden { + pub struct Bar; +} diff --git a/src/test/rustdoc/redirect.rs b/src/test/rustdoc/redirect.rs new file mode 100644 index 00000000000..98e66e8c024 --- /dev/null +++ b/src/test/rustdoc/redirect.rs @@ -0,0 +1,48 @@ +// 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:reexp_stripped.rs +// build-aux-docs +// ignore-cross-compile + +extern crate reexp_stripped; + +pub trait Foo {} + +// @has redirect/index.html +// @has - '//code' 'pub use reexp_stripped::Bar' +// @has - '//code/a' 'Bar' +// @has reexp_stripped/hidden/struct.Bar.html +// @has - '//p/a' '../../reexp_stripped/struct.Bar.html' +// @has 'reexp_stripped/struct.Bar.html' +#[doc(no_inline)] +pub use reexp_stripped::Bar; +impl Foo for Bar {} + +// @has redirect/index.html +// @has - '//code' 'pub use reexp_stripped::Quz' +// @has - '//code/a' 'Quz' +// @has reexp_stripped/private/struct.Quz.html +// @has - '//p/a' '../../reexp_stripped/struct.Quz.html' +// @has 'reexp_stripped/struct.Quz.html' +#[doc(no_inline)] +pub use reexp_stripped::Quz; +impl Foo for Quz {} + +mod private_no_inline { + pub struct Qux; + impl ::Foo for Qux {} +} + +// @has redirect/index.html +// @has - '//code' 'pub use private_no_inline::Qux' +// @!has - '//code/a' 'Qux' +#[doc(no_inline)] +pub use private_no_inline::Qux; diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs new file mode 100644 index 00000000000..c4327f70728 --- /dev/null +++ b/src/test/rustdoc/structfields.rs @@ -0,0 +1,44 @@ +// 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// @has structfields/struct.Foo.html +pub struct Foo { + // @has - //pre "pub a: ()" + pub a: (), + // @has - //pre "// some fields omitted" + // @!has - //pre "b: ()" + b: (), + // @!has - //pre "c: usize" + #[doc(hidden)] + c: usize, + // @has - //pre "pub d: usize" + pub d: usize, +} + +// @has structfields/struct.Bar.html +pub struct Bar { + // @has - //pre "pub a: ()" + pub a: (), + // @!has - //pre "// some fields omitted" +} + +// @has structfields/enum.Qux.html +pub enum Qux { + Quz { + // @has - //pre "a: ()" + a: (), + // @!has - //pre "b: ()" + #[doc(hidden)] + b: (), + // @has - //pre "c: usize" + c: usize, + // @has - //pre "// some fields omitted" + }, +} |
