]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/deref-typedef.rs
Add test for typedef deref
[rust.git] / src / test / rustdoc / deref-typedef.rs
1 #![crate_name = "foo"]
2
3 // @has 'foo/struct.Bar.html'
4 // @has '-' '//*[@id="deref-methods"]' 'Methods from Deref<Target = FooB>'
5 // @has '-' '//*[@class="impl-items"]//*[@id="method.happy"]' 'pub fn happy(&self)'
6 // @has '-' '//*[@class="sidebar-title"]' 'Methods from Deref<Target=FooB>'
7 // @has '-' '//*[@class="sidebar-links"]/a[@href="#method.happy"]' 'happy'
8 pub struct FooA;
9 pub type FooB = FooA;
10
11 impl FooA {
12     pub fn happy(&self) {}
13 }
14
15 pub struct Bar;
16 impl std::ops::Deref for Bar {
17     type Target = FooB;
18     fn deref(&self) -> &FooB { unimplemented!() }
19 }