diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-08-30 20:51:58 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-08-31 11:22:14 +0200 |
| commit | 477b7ba1657986a31b60ccf149011c037ef649d1 (patch) | |
| tree | e8354598ad018c2237b03a5676e2a1339857e04d | |
| parent | 900cda2043654f0bf0bb4dabfb696f643dd1a3a6 (diff) | |
| download | rust-477b7ba1657986a31b60ccf149011c037ef649d1.tar.gz rust-477b7ba1657986a31b60ccf149011c037ef649d1.zip | |
Add regression test for implementations displayed on reference primitive type
| -rw-r--r-- | src/test/rustdoc/primitive-reference.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/rustdoc/primitive-reference.rs b/src/test/rustdoc/primitive-reference.rs new file mode 100644 index 00000000000..5c119340609 --- /dev/null +++ b/src/test/rustdoc/primitive-reference.rs @@ -0,0 +1,37 @@ +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +// @has foo/index.html +// @has - '//h2[@id="primitives"]' 'Primitive Types' +// @has - '//a[@href="primitive.reference.html"]' 'reference' +// @has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' +// @has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' +// @has foo/primitive.reference.html +// @has - '//a[@class="primitive"]' 'reference' +// @has - '//span[@class="in-band"]' 'Primitive Type reference' +// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' + +// There should be only one implementation listed. +// @count - '//*[@class="impl has-srclink"]' 1 +// @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header in-band"]' \ +// 'impl<A, B> Foo<&A> for &B' +#[doc(primitive = "reference")] +/// this is a test! +mod reference {} + +pub struct Bar; + +// This implementation should **not** show up. +impl<T> From<&T> for Bar { + fn from(s: &T) -> Self { + Bar + } +} + +pub trait Foo<T> { + fn stuff(&self, other: &T) {} +} + +// This implementation should show up. +impl<A, B> Foo<&A> for &B {} |
