Skip to content

Commit 477b7ba

Browse files
Add regression test for implementations displayed on reference primitive type
1 parent 900cda2 commit 477b7ba

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#![crate_name = "foo"]
2+
3+
#![feature(rustdoc_internals)]
4+
5+
// @has foo/index.html
6+
// @has - '//h2[@id="primitives"]' 'Primitive Types'
7+
// @has - '//a[@href="primitive.reference.html"]' 'reference'
8+
// @has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types'
9+
// @has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
10+
// @has foo/primitive.reference.html
11+
// @has - '//a[@class="primitive"]' 'reference'
12+
// @has - '//span[@class="in-band"]' 'Primitive Type reference'
13+
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
14+
15+
// There should be only one implementation listed.
16+
// @count - '//*[@class="impl has-srclink"]' 1
17+
// @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header in-band"]' \
18+
// 'impl<A, B> Foo<&A> for &B'
19+
#[doc(primitive = "reference")]
20+
/// this is a test!
21+
mod reference {}
22+
23+
pub struct Bar;
24+
25+
// This implementation should **not** show up.
26+
impl<T> From<&T> for Bar {
27+
fn from(s: &T) -> Self {
28+
Bar
29+
}
30+
}
31+
32+
pub trait Foo<T> {
33+
fn stuff(&self, other: &T) {}
34+
}
35+
36+
// This implementation should show up.
37+
impl<A, B> Foo<&A> for &B {}

0 commit comments

Comments
 (0)