Skip to content

Commit

Permalink
Add regression test for #115480
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 10, 2023
1 parent 6e0b21f commit e18d7a3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/rustdoc-js/auxiliary/equivalent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::borrow::Borrow;

pub trait Equivalent<K: ?Sized> {
fn equivalent(&self, key: &K) -> bool;
}

impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q
where
Q: Eq,
K: Borrow<Q>,
{
fn equivalent(&self, key: &K) -> bool {
PartialEq::eq(self, key.borrow())
}
}
9 changes: 9 additions & 0 deletions tests/rustdoc-js/search-non-local-trait-impl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// exact-check

// This test ensures that methods from blanket impls of not available foreign traits
// don't show up in the search results.

const EXPECTED = {
'query': 'equivalent',
'others': [],
};
4 changes: 4 additions & 0 deletions tests/rustdoc-js/search-non-local-trait-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// aux-build:equivalent.rs

#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError;

0 comments on commit e18d7a3

Please sign in to comment.