/src/test/rustdoc/visibility.rs

https://gitlab.com/rust-lang/rust · Rust · 105 lines · 33 code · 12 blank · 60 comment · 1 complexity · 54ebbb2c4a728fa78da30c10b3e24c69 MD5 · raw file

  1. // compile-flags: --document-private-items
  2. #![crate_name = "foo"]
  3. // @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic 🔒'
  4. // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
  5. pub struct FooPublic;
  6. // @has 'foo/index.html' '//a[@href="struct.FooJustCrate.html"]/..' 'FooJustCrate 🔒'
  7. // @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
  8. pub(crate) struct FooJustCrate;
  9. // @has 'foo/index.html' '//a[@href="struct.FooPubCrate.html"]/..' 'FooPubCrate 🔒'
  10. // @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
  11. pub(crate) struct FooPubCrate;
  12. // @has 'foo/index.html' '//a[@href="struct.FooSelf.html"]/..' 'FooSelf 🔒'
  13. // @has 'foo/struct.FooSelf.html' '//pre' 'pub(crate) struct FooSelf'
  14. pub(self) struct FooSelf;
  15. // @has 'foo/index.html' '//a[@href="struct.FooInSelf.html"]/..' 'FooInSelf 🔒'
  16. // @has 'foo/struct.FooInSelf.html' '//pre' 'pub(crate) struct FooInSelf'
  17. pub(in self) struct FooInSelf;
  18. // @has 'foo/index.html' '//a[@href="struct.FooPriv.html"]/..' 'FooPriv 🔒'
  19. // @has 'foo/struct.FooPriv.html' '//pre' 'pub(crate) struct FooPriv'
  20. struct FooPriv;
  21. // @!has 'foo/index.html' '//a[@href="pub_mod/index.html"]/..' 'pub_mod 🔒'
  22. pub mod pub_mod {}
  23. // @has 'foo/index.html' '//a[@href="pub_crate_mod/index.html"]/..' 'pub_crate_mod 🔒'
  24. pub(crate) mod pub_crate_mod {}
  25. // @has 'foo/index.html' '//a[@href="a/index.html"]/..' 'a 🔒'
  26. mod a {
  27. // @has 'foo/a/index.html' '//a[@href="struct.FooASuper.html"]/..' 'FooASuper 🔒'
  28. // @has 'foo/a/struct.FooASuper.html' '//pre' 'pub(crate) struct FooASuper'
  29. pub(super) struct FooASuper;
  30. // @has 'foo/a/index.html' '//a[@href="struct.FooAInSuper.html"]/..' 'FooAInSuper 🔒'
  31. // @has 'foo/a/struct.FooAInSuper.html' '//pre' 'pub(crate) struct FooAInSuper'
  32. pub(in super) struct FooAInSuper;
  33. // @has 'foo/a/index.html' '//a[@href="struct.FooAInA.html"]/..' 'FooAInA 🔒'
  34. // @has 'foo/a/struct.FooAInA.html' '//pre' 'struct FooAInA'
  35. // @!has 'foo/a/struct.FooAInA.html' '//pre' 'pub'
  36. pub(in a) struct FooAInA;
  37. // @has 'foo/a/index.html' '//a[@href="struct.FooAPriv.html"]/..' 'FooAPriv 🔒'
  38. // @has 'foo/a/struct.FooAPriv.html' '//pre' 'struct FooAPriv'
  39. // @!has 'foo/a/struct.FooAPriv.html' '//pre' 'pub'
  40. struct FooAPriv;
  41. // @has 'foo/a/index.html' '//a[@href="b/index.html"]/..' 'b 🔒'
  42. mod b {
  43. // @has 'foo/a/b/index.html' '//a[@href="struct.FooBSuper.html"]/..' 'FooBSuper 🔒'
  44. // @has 'foo/a/b/struct.FooBSuper.html' '//pre' 'pub(super) struct FooBSuper'
  45. pub(super) struct FooBSuper;
  46. // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInSuperSuper.html"]/..' 'FooBInSuperSuper 🔒'
  47. // @has 'foo/a/b/struct.FooBInSuperSuper.html' '//pre' 'pub(crate) struct FooBInSuperSuper'
  48. pub(in super::super) struct FooBInSuperSuper;
  49. // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInAB.html"]/..' 'FooBInAB 🔒'
  50. // @has 'foo/a/b/struct.FooBInAB.html' '//pre' 'struct FooBInAB'
  51. // @!has 'foo/a/b/struct.FooBInAB.html' '//pre' 'pub'
  52. pub(in a::b) struct FooBInAB;
  53. // @has 'foo/a/b/index.html' '//a[@href="struct.FooBPriv.html"]/..' 'FooBPriv 🔒'
  54. // @has 'foo/a/b/struct.FooBPriv.html' '//pre' 'struct FooBPriv'
  55. // @!has 'foo/a/b/struct.FooBPriv.html' '//pre' 'pub'
  56. struct FooBPriv;
  57. // @!has 'foo/a/b/index.html' '//a[@href="struct.FooBPub.html"]/..' 'FooBPub 🔒'
  58. // @has 'foo/a/b/struct.FooBPub.html' '//pre' 'pub struct FooBPub'
  59. pub struct FooBPub;
  60. }
  61. }
  62. // @has 'foo/trait.PubTrait.html' '//pre' 'pub trait PubTrait'
  63. //
  64. // @has 'foo/trait.PubTrait.html' '//pre' 'type Type;'
  65. // @!has 'foo/trait.PubTrait.html' '//pre' 'pub type Type;'
  66. //
  67. // @has 'foo/trait.PubTrait.html' '//pre' 'const CONST: usize;'
  68. // @!has 'foo/trait.PubTrait.html' '//pre' 'pub const CONST: usize;'
  69. //
  70. // @has 'foo/trait.PubTrait.html' '//pre' 'fn function();'
  71. // @!has 'foo/trait.PubTrait.html' '//pre' 'pub fn function();'
  72. //
  73. // @!has 'foo/index.html' '//a[@href="trait.PubTrait.html"]/..' 'PubTrait 🔒'
  74. pub trait PubTrait {
  75. type Type;
  76. const CONST: usize;
  77. fn function();
  78. }
  79. // @has 'foo/index.html' '//a[@href="trait.PrivTrait.html"]/..' 'PrivTrait 🔒'
  80. trait PrivTrait {}
  81. // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'type Type'
  82. // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub type Type'
  83. //
  84. // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'const CONST: usize'
  85. // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub const CONST: usize'
  86. //
  87. // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'fn function()'
  88. // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub fn function()'
  89. impl PubTrait for FooPublic {
  90. type Type = usize;
  91. const CONST: usize = 0;
  92. fn function() {}
  93. }