/src/test/rustdoc/duplicate-cfg.rs

https://gitlab.com/rust-lang/rust · Rust · 53 lines · 25 code · 6 blank · 22 comment · 0 complexity · 3e34e020c0312a5c05b675d3300a4e00 MD5 · raw file

  1. #![crate_name = "foo"]
  2. #![feature(doc_cfg)]
  3. // @has 'foo/index.html'
  4. // @matches '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]' '^sync$'
  5. // @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only'
  6. // @has 'foo/struct.Foo.html'
  7. // @has '-' '//*[@class="stab portability"]' 'sync'
  8. #[doc(cfg(feature = "sync"))]
  9. #[doc(cfg(feature = "sync"))]
  10. /// my feature sync struct
  11. pub struct Foo;
  12. // @has 'foo/bar/index.html'
  13. // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.'
  14. #[doc(cfg(feature = "sync"))]
  15. pub mod bar {
  16. // @has 'foo/bar/struct.Bar.html'
  17. // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.'
  18. #[doc(cfg(feature = "sync"))]
  19. pub struct Bar;
  20. }
  21. // @has 'foo/baz/index.html'
  22. // @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.'
  23. #[doc(cfg(all(feature = "sync", feature = "send")))]
  24. pub mod baz {
  25. // @has 'foo/baz/struct.Baz.html'
  26. // @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.'
  27. #[doc(cfg(feature = "sync"))]
  28. pub struct Baz;
  29. }
  30. // @has 'foo/qux/index.html'
  31. // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync only.'
  32. #[doc(cfg(feature = "sync"))]
  33. pub mod qux {
  34. // @has 'foo/qux/struct.Qux.html'
  35. // @has '-' '//*[@class="stab portability"]' 'Available on crate features sync and send only.'
  36. #[doc(cfg(all(feature = "sync", feature = "send")))]
  37. pub struct Qux;
  38. }
  39. // @has 'foo/quux/index.html'
  40. // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync and crate feature send and foo only.'
  41. #[doc(cfg(all(feature = "sync", feature = "send", foo)))]
  42. pub mod quux {
  43. // @has 'foo/quux/struct.Quux.html'
  44. // @has '-' '//*[@class="stab portability"]' 'Available on crate feature sync and crate feature send and foo and bar only.'
  45. #[doc(cfg(all(feature = "send", feature = "sync", bar)))]
  46. pub struct Quux;
  47. }