/src/test/rustdoc/pub-restricted.rs

https://gitlab.com/jianglu/rust · Rust · 44 lines · 17 code · 5 blank · 22 comment · 0 complexity · 6939c5a05c29bb03472cb86eff3aa699 MD5 · raw file

  1. // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // http://rust-lang.org/COPYRIGHT.
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. // ignore-tidy-linelength
  11. // compile-flags: --document-private-items
  12. #![feature(crate_visibility_modifier)]
  13. #![crate_name = "foo"]
  14. // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
  15. pub struct FooPublic;
  16. // @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
  17. crate struct FooJustCrate;
  18. // @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
  19. pub(crate) struct FooPubCrate;
  20. // @has 'foo/struct.FooSelf.html' '//pre' 'pub(self) struct FooSelf'
  21. pub(self) struct FooSelf;
  22. // @has 'foo/struct.FooInSelf.html' '//pre' 'pub(self) struct FooInSelf'
  23. pub(in self) struct FooInSelf;
  24. mod a {
  25. // @has 'foo/a/struct.FooSuper.html' '//pre' 'pub(super) struct FooSuper'
  26. pub(super) struct FooSuper;
  27. // @has 'foo/a/struct.FooInSuper.html' '//pre' 'pub(super) struct FooInSuper'
  28. pub(in super) struct FooInSuper;
  29. // @has 'foo/a/struct.FooInA.html' '//pre' 'pub(in a) struct FooInA'
  30. pub(in a) struct FooInA;
  31. mod b {
  32. // @has 'foo/a/b/struct.FooInSelfSuperB.html' '//pre' 'pub(in self::super::b) struct FooInSelfSuperB'
  33. pub(in self::super::b) struct FooInSelfSuperB;
  34. // @has 'foo/a/b/struct.FooInSuperSuper.html' '//pre' 'pub(in super::super) struct FooInSuperSuper'
  35. pub(in super::super) struct FooInSuperSuper;
  36. // @has 'foo/a/b/struct.FooInAB.html' '//pre' 'pub(in a::b) struct FooInAB'
  37. pub(in a::b) struct FooInAB;
  38. }
  39. }