]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/primitive-reference.rs
Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
[rust.git] / tests / rustdoc / primitive-reference.rs
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 - '//h1' '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"]' 1
17 // @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header"]' \
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 {}