diff options
| author | bors <bors@rust-lang.org> | 2023-07-20 07:12:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-20 07:12:22 +0000 |
| commit | c67cb3e577bdd4de640eb11d96cd5ef5afe0eb0b (patch) | |
| tree | 718bce56573cbb50af071101db19daf13ce003a3 /tests | |
| parent | 0646a5d1aa3745cb448db247f6fa432890a1812b (diff) | |
| parent | 770c8d06672ea8d317df7bdf5ff5f8ce954ecbdd (diff) | |
| download | rust-c67cb3e577bdd4de640eb11d96cd5ef5afe0eb0b.tar.gz rust-c67cb3e577bdd4de640eb11d96cd5ef5afe0eb0b.zip | |
Auto merge of #113878 - matthiaskrgr:rollup-u0d3kzx, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #113710 (Fix rpath for libdir is specified) - #113787 (Update documentation for std::process::Command's new method) - #113795 (Properly document `lifetime_mapping` in `OpaqueTy`) - #113857 (Add tests for `--document-hidden-items` option) - #113871 (Use the correct span for displaying the line following a derive sugge…) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rustdoc/display-hidden-items.rs | 71 | ||||
| -rw-r--r-- | tests/ui/modules/issue-107649.stderr | 2 |
2 files changed, 72 insertions, 1 deletions
diff --git a/tests/rustdoc/display-hidden-items.rs b/tests/rustdoc/display-hidden-items.rs new file mode 100644 index 00000000000..d97d5b4a968 --- /dev/null +++ b/tests/rustdoc/display-hidden-items.rs @@ -0,0 +1,71 @@ +// Test to ensure that the `--document-hidden-items` option is working as expected. +// compile-flags: -Z unstable-options --document-hidden-items +// ignore-tidy-linelength + +#![crate_name = "foo"] + +// @has 'foo/index.html' +// @has - '//*[@id="reexport.hidden_reexport"]/code' 'pub use hidden::inside_hidden as hidden_reexport;' +#[doc(hidden)] +pub use hidden::inside_hidden as hidden_reexport; + +// @has - '//*[@class="item-name"]/a[@class="trait"]' 'TraitHidden' +// @has 'foo/trait.TraitHidden.html' +#[doc(hidden)] +pub trait TraitHidden {} + +// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="trait"]' 'Trait' +pub trait Trait { + // @has 'foo/trait.Trait.html' + // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' + #[doc(hidden)] + const BAR: u32 = 0; + + // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()' + #[doc(hidden)] + fn foo() {} +} + +// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="struct"]' 'Struct' +// @has 'foo/struct.Struct.html' +pub struct Struct { + // @has - '//*[@id="structfield.a"]/code' 'a: u32' + #[doc(hidden)] + pub a: u32, +} + +impl Struct { + // @has - '//*[@id="method.new"]/*[@class="code-header"]' 'pub fn new() -> Self' + #[doc(hidden)] + pub fn new() -> Self { Self { a: 0 } } +} + +impl Trait for Struct { + // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' + // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()' +} +// @has - '//*[@id="impl-TraitHidden-for-Struct"]/*[@class="code-header"]' 'impl TraitHidden for Struct' +impl TraitHidden for Struct {} + +// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'HiddenEnum' +// @has 'foo/enum.HiddenEnum.html' +#[doc(hidden)] +pub enum HiddenEnum { + A, +} + +// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'Enum' +pub enum Enum { + // @has 'foo/enum.Enum.html' '//*[@id="variant.A"]/*[@class="code-header"]' 'A' + #[doc(hidden)] + A, +} + +// @has 'foo/index.html' '//*[@class="item-name"]/a[@class="mod"]' 'hidden' +#[doc(hidden)] +pub mod hidden { + // @has 'foo/hidden/index.html' + // @has - '//*[@class="item-name"]/a[@class="fn"]' 'inside_hidden' + // @has 'foo/hidden/fn.inside_hidden.html' + pub fn inside_hidden() {} +} diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr index 38a910b57b4..5705e84e0d9 100644 --- a/tests/ui/modules/issue-107649.stderr +++ b/tests/ui/modules/issue-107649.stderr @@ -11,7 +11,7 @@ help: consider annotating `Dummy` with `#[derive(Debug)]` --> $DIR/auxiliary/dummy_lib.rs:2:1 | 2 + #[derive(Debug)] -3 | #[path = "auxiliary/dummy_lib.rs"] +3 | pub struct Dummy; | error: aborting due to previous error |
