diff options
| author | bors <bors@rust-lang.org> | 2023-06-05 04:54:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-05 04:54:21 +0000 |
| commit | 51f714c8c5021fe25442e46798b1cbef2f2249ed (patch) | |
| tree | 0cc8d5cbe38339e9386a2358692ab62156c8729b /tests/rustdoc | |
| parent | e4106065bf1bb515935d5d024e8d9c86454e2b22 (diff) | |
| parent | 16749d1d999c03014b2fd5d646675c3f6f55afac (diff) | |
| download | rust-51f714c8c5021fe25442e46798b1cbef2f2249ed.tar.gz rust-51f714c8c5021fe25442e46798b1cbef2f2249ed.zip | |
Auto merge of #110945 - wackbyte:doc-vis-on-inherent-assoc-types, r=jsha
rustdoc: render visibility on associated types This should only affect inherent associated types (#8995).
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/anchors.no_type_anchor2.html | 2 | ||||
| -rw-r--r-- | tests/rustdoc/visibility.rs | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html index f8b59160f15..71e93990e29 100644 --- a/tests/rustdoc/anchors.no_type_anchor2.html +++ b/tests/rustdoc/anchors.no_type_anchor2.html @@ -1 +1 @@ -<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file +<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">pub type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file diff --git a/tests/rustdoc/visibility.rs b/tests/rustdoc/visibility.rs index 4099b54f081..4f9b06fd7a2 100644 --- a/tests/rustdoc/visibility.rs +++ b/tests/rustdoc/visibility.rs @@ -1,6 +1,8 @@ // compile-flags: --document-private-items #![crate_name = "foo"] +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] // @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic 🔒' // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic' @@ -103,3 +105,26 @@ impl PubTrait for FooPublic { const CONST: usize = 0; fn function() {} } + +pub struct Assoc; + +// @has foo/struct.Assoc.html +impl Assoc { + // @has - '//*[@id="associatedtype.TypePub"]' 'pub type TypePub' + pub type TypePub = usize; + + // @has - '//*[@id="associatedtype.TypePriv"]' 'pub(crate) type TypePriv' + type TypePriv = usize; + + // @has - '//*[@id="associatedconstant.CONST_PUB"]' 'pub const CONST_PUB' + pub const CONST_PUB: usize = 0; + + // @has - '//*[@id="associatedconstant.CONST_PRIV"]' 'pub(crate) const CONST_PRIV' + const CONST_PRIV: usize = 0; + + // @has - '//*[@id="method.function_pub"]' 'pub fn function_pub()' + pub fn function_pub() {} + + // @has - '//*[@id="method.function_priv"]' 'pub(crate) fn function_priv()' + fn function_priv() {} +} |
