about summary refs log tree commit diff
diff options
context:
space:
mode:
authorwackbyte <wackbyte@pm.me>2023-04-29 16:19:57 -0400
committerwackbyte <wackbyte@pm.me>2023-04-29 16:19:57 -0400
commit16749d1d999c03014b2fd5d646675c3f6f55afac (patch)
tree5f0977d5238d8f5db5ae4e673ae40ce53cf25eab
parentc40498422c288b95735c182f99062bb838f728fd (diff)
downloadrust-16749d1d999c03014b2fd5d646675c3f6f55afac.tar.gz
rust-16749d1d999c03014b2fd5d646675c3f6f55afac.zip
Add visibility tests for associated items
-rw-r--r--tests/rustdoc/visibility.rs25
1 files changed, 25 insertions, 0 deletions
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() {}
+}