// Regression test for . #![crate_name = "foo"] pub struct GenericStruct(T); impl GenericStruct { pub fn on_gen(arg: T) {} } impl GenericStruct { pub fn on_u32(arg: u32) {} } pub trait Foo {} pub trait Bar {} impl Foo for GenericStruct {} impl Bar for GenericStruct {} // @has 'foo/type.TypedefStruct.html' // We check that we have the implementation of the type alias itself. // @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct' // @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' // @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl GenericStruct' // @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' // @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl Foo for GenericStruct' // This trait implementation doesn't match the type alias parameters so shouldn't appear in docs. // @!has - '//h3' 'impl Bar for GenericStruct {}' // Same goes for the `Deref` impl. // @!has - '//h2' 'Methods from Deref' pub type TypedefStruct = GenericStruct; impl TypedefStruct { pub fn on_alias() {} } impl std::ops::Deref for GenericStruct { type Target = u32; fn deref(&self) -> &Self::Target { &self.0 } } pub struct Wrap(GenericStruct); // @has 'foo/type.Alias.html' // @has - '//h2' 'Methods from Deref' // @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl Deref for Wrap' pub type Alias = Wrap; impl std::ops::Deref for Wrap { type Target = GenericStruct; fn deref(&self) -> &Self::Target { &self.0 } }