Skip to content

Commit

Permalink
Add regression test for implementations displayed on reference primit…
Browse files Browse the repository at this point in the history
…ive type
  • Loading branch information
GuillaumeGomez committed Aug 31, 2022
1 parent 900cda2 commit 477b7ba
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/rustdoc/primitive-reference.rs
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 477b7ba

Please sign in to comment.