Skip to content

Commit fd4a88f

Browse files
Add test for typedef deref
1 parent 12f029b commit fd4a88f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/rustdoc/deref-typedef.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

0 commit comments

Comments
 (0)