Skip to content

Commit 16749d1

Browse files
committed
Add visibility tests for associated items
1 parent c404984 commit 16749d1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: tests/rustdoc/visibility.rs

+25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// compile-flags: --document-private-items
22

33
#![crate_name = "foo"]
4+
#![feature(inherent_associated_types)]
5+
#![allow(incomplete_features)]
46

57
// @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic 🔒'
68
// @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
@@ -103,3 +105,26 @@ impl PubTrait for FooPublic {
103105
const CONST: usize = 0;
104106
fn function() {}
105107
}
108+
109+
pub struct Assoc;
110+
111+
// @has foo/struct.Assoc.html
112+
impl Assoc {
113+
// @has - '//*[@id="associatedtype.TypePub"]' 'pub type TypePub'
114+
pub type TypePub = usize;
115+
116+
// @has - '//*[@id="associatedtype.TypePriv"]' 'pub(crate) type TypePriv'
117+
type TypePriv = usize;
118+
119+
// @has - '//*[@id="associatedconstant.CONST_PUB"]' 'pub const CONST_PUB'
120+
pub const CONST_PUB: usize = 0;
121+
122+
// @has - '//*[@id="associatedconstant.CONST_PRIV"]' 'pub(crate) const CONST_PRIV'
123+
const CONST_PRIV: usize = 0;
124+
125+
// @has - '//*[@id="method.function_pub"]' 'pub fn function_pub()'
126+
pub fn function_pub() {}
127+
128+
// @has - '//*[@id="method.function_priv"]' 'pub(crate) fn function_priv()'
129+
fn function_priv() {}
130+
}

0 commit comments

Comments
 (0)