/src/test/rustdoc/impl-disambiguation.rs

https://gitlab.com/jianglu/rust · Rust · 40 lines · 14 code · 7 blank · 19 comment · 5 complexity · 551488e735ace14f2bbd3ba12da7c1bd MD5 · raw file

  1. // Copyright 2017 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. #![crate_name = "foo"]
  11. pub trait Foo {}
  12. pub struct Bar<T> { field: T }
  13. // @has foo/trait.Foo.html '//*[@class="item-list"]//code' \
  14. // "impl Foo for Bar<u8>"
  15. impl Foo for Bar<u8> {}
  16. // @has foo/trait.Foo.html '//*[@class="item-list"]//code' \
  17. // "impl Foo for Bar<u16>"
  18. impl Foo for Bar<u16> {}
  19. // @has foo/trait.Foo.html '//*[@class="item-list"]//code' \
  20. // "impl<'a> Foo for &'a Bar<u8>"
  21. impl<'a> Foo for &'a Bar<u8> {}
  22. pub mod mod1 {
  23. pub struct Baz {}
  24. }
  25. pub mod mod2 {
  26. pub enum Baz {}
  27. }
  28. // @has foo/trait.Foo.html '//*[@class="item-list"]//code' \
  29. // "impl Foo for foo::mod1::Baz"
  30. impl Foo for mod1::Baz {}
  31. // @has foo/trait.Foo.html '//*[@class="item-list"]//code' \
  32. // "impl<'a> Foo for &'a foo::mod2::Baz"
  33. impl<'a> Foo for &'a mod2::Baz {}