/src/test/rustdoc/titles.rs

https://gitlab.com/rust-lang/rust · Rust · 56 lines · 24 code · 13 blank · 19 comment · 0 complexity · 48478b537d8e1e0c25c92ead417c80c3 MD5 · raw file

  1. #![crate_name = "foo"]
  2. #![feature(rustdoc_internals)]
  3. // @matches 'foo/index.html' '//h1' 'Crate foo'
  4. // @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo'
  5. // @matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod'
  6. // @matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod'
  7. pub mod foo_mod {
  8. pub struct __Thing {}
  9. }
  10. extern "C" {
  11. // @matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo::foo_ffn'
  12. pub fn foo_ffn();
  13. }
  14. // @matches 'foo/fn.foo_fn.html' '//h1' 'Function foo::foo_fn'
  15. pub fn foo_fn() {}
  16. // @matches 'foo/trait.FooTrait.html' '//h1' 'Trait foo::FooTrait'
  17. // @matches 'foo/trait.FooTrait.html' '//h2[@class="location"]' 'FooTrait'
  18. pub trait FooTrait {}
  19. // @matches 'foo/struct.FooStruct.html' '//h1' 'Struct foo::FooStruct'
  20. // @matches 'foo/struct.FooStruct.html' '//h2[@class="location"]' 'FooStruct'
  21. pub struct FooStruct;
  22. // @matches 'foo/enum.FooEnum.html' '//h1' 'Enum foo::FooEnum'
  23. // @matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum'
  24. pub enum FooEnum {}
  25. // @matches 'foo/type.FooType.html' '//h1' 'Type Definition foo::FooType'
  26. // @matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType'
  27. pub type FooType = FooStruct;
  28. // @matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo::foo_macro'
  29. #[macro_export]
  30. macro_rules! foo_macro {
  31. () => {};
  32. }
  33. // @matches 'foo/primitive.bool.html' '//h1' 'Primitive Type bool'
  34. #[doc(primitive = "bool")]
  35. mod bool {}
  36. // @matches 'foo/static.FOO_STATIC.html' '//h1' 'Static foo::FOO_STATIC'
  37. pub static FOO_STATIC: FooStruct = FooStruct;
  38. extern "C" {
  39. // @matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static foo::FOO_FSTATIC'
  40. pub static FOO_FSTATIC: FooStruct;
  41. }
  42. // @matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant foo::FOO_CONSTANT'
  43. pub const FOO_CONSTANT: FooStruct = FooStruct;