/src/test/rustdoc/default-trait-method-link.rs

https://gitlab.com/jianglu/rust · Rust · 25 lines · 5 code · 3 blank · 17 comment · 0 complexity · 0d599ef30624f7e4217a081791996ef8 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. #![crate_name = "foo"]
  11. // @has foo/trait.Foo.html '//a[@href="../foo/trait.Foo.html#tymethod.req"]' 'req'
  12. // @has foo/trait.Foo.html '//a[@href="../foo/trait.Foo.html#method.prov"]' 'prov'
  13. /// Always make sure to implement [`req`], but you don't have to implement [`prov`].
  14. ///
  15. /// [`req`]: Foo::req
  16. /// [`prov`]: Foo::prov
  17. pub trait Foo {
  18. /// Required
  19. fn req();
  20. /// Provided
  21. fn prov() {}
  22. }